[0e4ab80] | 1 | #
|
---|
[df4ed85] | 2 | # Copyright (c) 2005 Martin Decky
|
---|
[079f440] | 3 | # Copyright (c) 2007 Jakub Jermar
|
---|
[0e4ab80] | 4 | # All rights reserved.
|
---|
| 5 | #
|
---|
| 6 | # Redistribution and use in source and binary forms, with or without
|
---|
| 7 | # modification, are permitted provided that the following conditions
|
---|
| 8 | # are met:
|
---|
| 9 | #
|
---|
| 10 | # - Redistributions of source code must retain the above copyright
|
---|
| 11 | # notice, this list of conditions and the following disclaimer.
|
---|
| 12 | # - Redistributions in binary form must reproduce the above copyright
|
---|
| 13 | # notice, this list of conditions and the following disclaimer in the
|
---|
| 14 | # documentation and/or other materials provided with the distribution.
|
---|
| 15 | # - The name of the author may not be used to endorse or promote products
|
---|
| 16 | # derived from this software without specific prior written permission.
|
---|
| 17 | #
|
---|
| 18 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
| 19 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
| 20 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
| 21 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
| 22 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
| 23 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
| 24 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
| 25 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
| 26 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
| 27 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
| 28 | #
|
---|
[3eddaff] | 29 |
|
---|
[1b1164e8] | 30 | USPACE_PREFIX = ../..
|
---|
| 31 | ROOT_PATH = $(USPACE_PREFIX)/..
|
---|
[079f440] | 32 |
|
---|
[c0699467] | 33 | INCLUDE_ABI = include/abi
|
---|
[079f440] | 34 | INCLUDE_LIBARCH = include/libarch
|
---|
| 35 |
|
---|
[1b1164e8] | 36 | COMMON_MAKEFILE = $(ROOT_PATH)/Makefile.common
|
---|
[4196304] | 37 | COMMON_HEADER = $(ROOT_PATH)/common.h
|
---|
| 38 | COMMON_HEADER_ARCH = arch/$(UARCH)/include/common.h
|
---|
| 39 |
|
---|
[1b1164e8] | 40 | CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config
|
---|
| 41 |
|
---|
[c53d906] | 42 | LINKER_SCRIPTS = \
|
---|
| 43 | $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld \
|
---|
[729f774f] | 44 | $(LIBC_PREFIX)/arch/$(UARCH)/_link-loader.ld \
|
---|
| 45 | $(LIBC_PREFIX)/arch/$(UARCH)/_link-shlib.ld \
|
---|
| 46 | $(LIBC_PREFIX)/arch/$(UARCH)/_link-dlexe.ld
|
---|
[c53d906] | 47 |
|
---|
[c0699467] | 48 | PRE_DEPEND = $(INCLUDE_ABI) $(INCLUDE_LIBARCH) $(COMMON_HEADER_ARCH)
|
---|
[c53d906] | 49 | EXTRA_OUTPUT = $(LINKER_SCRIPTS)
|
---|
[c0699467] | 50 | EXTRA_CLEAN = $(INCLUDE_ABI) $(INCLUDE_LIBARCH) $(COMMON_HEADER_ARCH) $(LINKER_SCRIPTS)
|
---|
[4196304] | 51 | LIBRARY = libc
|
---|
[ec3e2ed] | 52 | SLIBRARY = libc.so.0.0
|
---|
[042fbe0] | 53 | LSONAME = libc.so0
|
---|
[ec3e2ed] | 54 |
|
---|
[4196304] | 55 |
|
---|
[1b1164e8] | 56 | -include $(COMMON_MAKEFILE)
|
---|
| 57 | -include $(CONFIG_MAKEFILE)
|
---|
| 58 | -include arch/$(UARCH)/Makefile.inc
|
---|
[079f440] | 59 |
|
---|
| 60 | GENERIC_SOURCES = \
|
---|
| 61 | generic/libc.c \
|
---|
| 62 | generic/ddi.c \
|
---|
| 63 | generic/as.c \
|
---|
| 64 | generic/cap.c \
|
---|
[47fecbb] | 65 | generic/cfg.c \
|
---|
[079f440] | 66 | generic/clipboard.c \
|
---|
[729fa2d6] | 67 | generic/devman.c \
|
---|
[5cd136ab] | 68 | generic/device/hw_res.c \
|
---|
[ce79069b] | 69 | generic/device/char_dev.c \
|
---|
[bfdb5af1] | 70 | generic/elf/elf_load.c \
|
---|
[079f440] | 71 | generic/event.c \
|
---|
| 72 | generic/errno.c \
|
---|
[15f3c3f] | 73 | generic/loc.c \
|
---|
[079f440] | 74 | generic/mem.c \
|
---|
[19f857a] | 75 | generic/str.c \
|
---|
[2721a75] | 76 | generic/str_error.c \
|
---|
[749f18c5] | 77 | generic/l18n/langs.c \
|
---|
[079f440] | 78 | generic/fibril.c \
|
---|
| 79 | generic/fibril_synch.c \
|
---|
| 80 | generic/pcb.c \
|
---|
| 81 | generic/smc.c \
|
---|
| 82 | generic/thread.c \
|
---|
| 83 | generic/tls.c \
|
---|
| 84 | generic/task.c \
|
---|
| 85 | generic/futex.c \
|
---|
| 86 | generic/io/asprintf.c \
|
---|
| 87 | generic/io/io.c \
|
---|
| 88 | generic/io/printf.c \
|
---|
[9b415c9] | 89 | generic/io/log.c \
|
---|
[079f440] | 90 | generic/io/klog.c \
|
---|
| 91 | generic/io/snprintf.c \
|
---|
| 92 | generic/io/vprintf.c \
|
---|
| 93 | generic/io/vsnprintf.c \
|
---|
| 94 | generic/io/printf_core.c \
|
---|
| 95 | generic/io/console.c \
|
---|
| 96 | generic/malloc.c \
|
---|
| 97 | generic/sysinfo.c \
|
---|
| 98 | generic/ipc.c \
|
---|
[79ae36dd] | 99 | generic/ns.c \
|
---|
[079f440] | 100 | generic/async.c \
|
---|
| 101 | generic/loader.c \
|
---|
| 102 | generic/getopt.c \
|
---|
[a99330e] | 103 | generic/adt/list.c \
|
---|
| 104 | generic/adt/hash_table.c \
|
---|
[7390870] | 105 | generic/adt/dynamic_fifo.c \
|
---|
| 106 | generic/adt/measured_strings.c \
|
---|
| 107 | generic/adt/char_map.c \
|
---|
[4e1a2f5] | 108 | generic/adt/prodcons.c \
|
---|
[079f440] | 109 | generic/time.c \
|
---|
| 110 | generic/stdlib.c \
|
---|
| 111 | generic/mman.c \
|
---|
| 112 | generic/udebug.c \
|
---|
| 113 | generic/vfs/vfs.c \
|
---|
| 114 | generic/vfs/canonify.c \
|
---|
[e4554d4] | 115 | generic/net/inet.c \
|
---|
[753bca3] | 116 | generic/net/icmp_common.c \
|
---|
| 117 | generic/net/icmp_api.c \
|
---|
[c7a8442] | 118 | generic/net/modules.c \
|
---|
[c69d327] | 119 | generic/net/packet.c \
|
---|
[d9e2e0e] | 120 | generic/net/socket_client.c \
|
---|
| 121 | generic/net/socket_parse.c \
|
---|
[0a72efc] | 122 | generic/stacktrace.c \
|
---|
[88dea9d] | 123 | generic/arg_parse.c \
|
---|
[549012c] | 124 | generic/sort.c \
|
---|
[04803bf] | 125 | generic/stats.c \
|
---|
[7fb3f1c] | 126 | generic/assert.c
|
---|
| 127 |
|
---|
[79ae36dd] | 128 | ifeq ($(CONFIG_RTLD),y)
|
---|
[7fb3f1c] | 129 | GENERIC_SOURCES += \
|
---|
| 130 | generic/dlfcn.c \
|
---|
[8a1fb09] | 131 | generic/rtld/rtld.c \
|
---|
| 132 | generic/rtld/dynamic.c \
|
---|
| 133 | generic/rtld/module.c \
|
---|
| 134 | generic/rtld/symbol.c
|
---|
[7fb3f1c] | 135 | endif
|
---|
[079f440] | 136 |
|
---|
| 137 | SOURCES = \
|
---|
| 138 | $(GENERIC_SOURCES) \
|
---|
| 139 | $(ARCH_SOURCES)
|
---|
| 140 |
|
---|
[1b1164e8] | 141 | include $(USPACE_PREFIX)/Makefile.common
|
---|
[079f440] | 142 |
|
---|
| 143 | $(INCLUDE_LIBARCH): arch/$(UARCH)/include
|
---|
| 144 | ln -sfn ../$< $@
|
---|
| 145 |
|
---|
[c0699467] | 146 | $(INCLUDE_ABI): ../../../abi/include/
|
---|
[079f440] | 147 | ln -sfn ../$< $@
|
---|
| 148 |
|
---|
[c53d906] | 149 | $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld: $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld.in
|
---|
[1b1164e8] | 150 | $(GCC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -E -x c $< | grep -v "^\#" > $@
|
---|
[4196304] | 151 |
|
---|
[c53d906] | 152 | $(LIBC_PREFIX)/arch/$(UARCH)/_link-loader.ld: $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld.in
|
---|
| 153 | $(GCC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -DLOADER -E -x c $< | grep -v "^\#" > $@
|
---|
| 154 |
|
---|
[729f774f] | 155 | $(LIBC_PREFIX)/arch/$(UARCH)/_link-shlib.ld: $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld.in
|
---|
| 156 | $(GCC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -DSHLIB -E -x c $< | grep -v "^\#" > $@
|
---|
| 157 |
|
---|
| 158 | $(LIBC_PREFIX)/arch/$(UARCH)/_link-dlexe.ld: $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld.in
|
---|
| 159 | $(GCC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -DDLEXE -E -x c $< | grep -v "^\#" > $@
|
---|
| 160 |
|
---|
[4196304] | 161 | $(COMMON_HEADER_ARCH): $(COMMON_HEADER)
|
---|
| 162 | ln -sfn ../../../$< $@
|
---|