| [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)/..
|
|---|
| [3eddaff] | 32 |
|
|---|
| [079f440] | 33 | INCLUDE_KERNEL = include/kernel
|
|---|
| 34 | INCLUDE_ARCH = include/arch
|
|---|
| 35 | INCLUDE_LIBARCH = include/libarch
|
|---|
| [3eddaff] | 36 |
|
|---|
| [1b1164e8] | 37 | COMMON_MAKEFILE = $(ROOT_PATH)/Makefile.common
|
|---|
| [4196304] | 38 | COMMON_HEADER = $(ROOT_PATH)/common.h
|
|---|
| 39 | COMMON_HEADER_ARCH = arch/$(UARCH)/include/common.h
|
|---|
| [ac47b7c2] | 40 |
|
|---|
| [1b1164e8] | 41 | CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config
|
|---|
| [3eddaff] | 42 |
|
|---|
| [c53d906] | 43 | LINKER_SCRIPTS = \
|
|---|
| 44 | $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld \
|
|---|
| [729f774f] | 45 | $(LIBC_PREFIX)/arch/$(UARCH)/_link-loader.ld \
|
|---|
| 46 | $(LIBC_PREFIX)/arch/$(UARCH)/_link-shlib.ld \
|
|---|
| 47 | $(LIBC_PREFIX)/arch/$(UARCH)/_link-dlexe.ld
|
|---|
| [c53d906] | 48 |
|
|---|
| [2ca5f632] | 49 | PRE_DEPEND = $(INCLUDE_KERNEL) $(INCLUDE_ARCH) $(INCLUDE_LIBARCH) $(COMMON_HEADER_ARCH)
|
|---|
| [c53d906] | 50 | EXTRA_OUTPUT = $(LINKER_SCRIPTS)
|
|---|
| [2ca5f632] | 51 | EXTRA_CLEAN = $(INCLUDE_KERNEL) $(INCLUDE_ARCH) $(INCLUDE_LIBARCH) $(COMMON_HEADER_ARCH) $(LINKER_SCRIPTS)
|
|---|
| [4196304] | 52 | LIBRARY = libc
|
|---|
| [ec3e2ed0] | 53 | SLIBRARY = libc.so.0.0
|
|---|
| [042fbe0] | 54 | LSONAME = libc.so0
|
|---|
| [ec3e2ed0] | 55 |
|
|---|
| [0e4ab80] | 56 |
|
|---|
| [1b1164e8] | 57 | -include $(COMMON_MAKEFILE)
|
|---|
| 58 | -include $(CONFIG_MAKEFILE)
|
|---|
| 59 | -include arch/$(UARCH)/Makefile.inc
|
|---|
| [fcd7053] | 60 |
|
|---|
| [8a1fb09] | 61 | EXTRA_CFLAGS += -I../../srv/loader/include
|
|---|
| [0e4ab80] | 62 |
|
|---|
| 63 | GENERIC_SOURCES = \
|
|---|
| [cc6f688] | 64 | generic/libc.c \
|
|---|
| [a1e17fc] | 65 | generic/ddi.c \
|
|---|
| [11fa83a] | 66 | generic/as.c \
|
|---|
| [7981e3cc] | 67 | generic/cap.c \
|
|---|
| [079f440] | 68 | generic/clipboard.c \
|
|---|
| [1090b8c] | 69 | generic/devmap.c \
|
|---|
| [729fa2d6] | 70 | generic/devman.c \
|
|---|
| [5cd136ab] | 71 | generic/device/hw_res.c \
|
|---|
| [ce79069b] | 72 | generic/device/char_dev.c \
|
|---|
| [05641a9e] | 73 | generic/event.c \
|
|---|
| [db24058] | 74 | generic/errno.c \
|
|---|
| [e64c4b2] | 75 | generic/mem.c \
|
|---|
| [19f857a] | 76 | generic/str.c \
|
|---|
| [2721a75] | 77 | generic/str_error.c \
|
|---|
| [fa23560] | 78 | generic/fibril.c \
|
|---|
| [079f440] | 79 | generic/fibril_synch.c \
|
|---|
| [c98e6ee] | 80 | generic/pcb.c \
|
|---|
| 81 | generic/smc.c \
|
|---|
| [c05290e] | 82 | generic/thread.c \
|
|---|
| [fa23560] | 83 | generic/tls.c \
|
|---|
| [f30e6a0b] | 84 | generic/task.c \
|
|---|
| [1cef26f] | 85 | generic/futex.c \
|
|---|
| [ab00d5a] | 86 | generic/io/asprintf.c \
|
|---|
| [4e2cf8b] | 87 | generic/io/io.c \
|
|---|
| [3214a20] | 88 | generic/io/printf.c \
|
|---|
| [9b415c9] | 89 | generic/io/log.c \
|
|---|
| [2595dab] | 90 | generic/io/klog.c \
|
|---|
| [3214a20] | 91 | generic/io/snprintf.c \
|
|---|
| 92 | generic/io/vprintf.c \
|
|---|
| 93 | generic/io/vsnprintf.c \
|
|---|
| 94 | generic/io/printf_core.c \
|
|---|
| [2595dab] | 95 | generic/io/console.c \
|
|---|
| [369a5f8] | 96 | generic/io/screenbuffer.c \
|
|---|
| [007e6efa] | 97 | generic/ipc/ns.c \
|
|---|
| [db24058] | 98 | generic/malloc.c \
|
|---|
| [450cd3a] | 99 | generic/sysinfo.c \
|
|---|
| [80649a91] | 100 | generic/ipc.c \
|
|---|
| 101 | generic/async.c \
|
|---|
| [7907cf9] | 102 | generic/async_sess.c \
|
|---|
| [45454e9b] | 103 | generic/loader.c \
|
|---|
| [216d6fc] | 104 | generic/getopt.c \
|
|---|
| [a99330e] | 105 | generic/adt/list.c \
|
|---|
| 106 | generic/adt/hash_table.c \
|
|---|
| [7390870] | 107 | generic/adt/dynamic_fifo.c \
|
|---|
| 108 | generic/adt/measured_strings.c \
|
|---|
| 109 | generic/adt/char_map.c \
|
|---|
| [c594489] | 110 | generic/time.c \
|
|---|
| [83b1d61] | 111 | generic/stdlib.c \
|
|---|
| [2f02aa17] | 112 | generic/mman.c \
|
|---|
| [9a1b20c] | 113 | generic/udebug.c \
|
|---|
| [dadcec1] | 114 | generic/vfs/vfs.c \
|
|---|
| [1ea99cc] | 115 | generic/vfs/canonify.c \
|
|---|
| [e4554d4] | 116 | generic/net/inet.c \
|
|---|
| [753bca3] | 117 | generic/net/icmp_common.c \
|
|---|
| 118 | generic/net/icmp_api.c \
|
|---|
| [c7a8442] | 119 | generic/net/modules.c \
|
|---|
| [c69d327] | 120 | generic/net/packet.c \
|
|---|
| [d9e2e0e] | 121 | generic/net/socket_client.c \
|
|---|
| 122 | generic/net/socket_parse.c \
|
|---|
| [0a72efc] | 123 | generic/stacktrace.c \
|
|---|
| [88dea9d] | 124 | generic/arg_parse.c \
|
|---|
| [549012c] | 125 | generic/sort.c \
|
|---|
| [04803bf] | 126 | generic/stats.c \
|
|---|
| [7fb3f1c] | 127 | generic/assert.c
|
|---|
| 128 |
|
|---|
| 129 | ifeq ($(CONFIG_RTLD), y)
|
|---|
| 130 | GENERIC_SOURCES += \
|
|---|
| 131 | generic/dlfcn.c \
|
|---|
| [8a1fb09] | 132 | generic/rtld/rtld.c \
|
|---|
| 133 | generic/rtld/elf_load.c \
|
|---|
| 134 | generic/rtld/dynamic.c \
|
|---|
| 135 | generic/rtld/module.c \
|
|---|
| 136 | generic/rtld/symbol.c
|
|---|
| [7fb3f1c] | 137 | endif
|
|---|
| [1ea99cc] | 138 |
|
|---|
| [079f440] | 139 | SOURCES = \
|
|---|
| 140 | $(GENERIC_SOURCES) \
|
|---|
| 141 | $(ARCH_SOURCES)
|
|---|
| [0e4ab80] | 142 |
|
|---|
| [1b1164e8] | 143 | include $(USPACE_PREFIX)/Makefile.common
|
|---|
| [3eddaff] | 144 |
|
|---|
| [079f440] | 145 | $(INCLUDE_ARCH): $(INCLUDE_KERNEL) $(INCLUDE_KERNEL)/arch
|
|---|
| 146 | ln -sfn kernel/arch $@
|
|---|
| [25b0e6a] | 147 |
|
|---|
| [079f440] | 148 | $(INCLUDE_LIBARCH): arch/$(UARCH)/include
|
|---|
| 149 | ln -sfn ../$< $@
|
|---|
| [3eddaff] | 150 |
|
|---|
| [079f440] | 151 | $(INCLUDE_KERNEL)/arch: ../../../kernel/generic/include/arch $(INCLUDE_KERNEL)
|
|---|
| [1ea99cc] | 152 |
|
|---|
| [079f440] | 153 | $(INCLUDE_KERNEL): ../../../kernel/generic/include/
|
|---|
| 154 | ln -sfn ../$< $@
|
|---|
| [1ea99cc] | 155 |
|
|---|
| [c53d906] | 156 | $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld: $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld.in
|
|---|
| [1b1164e8] | 157 | $(GCC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -E -x c $< | grep -v "^\#" > $@
|
|---|
| [1ea99cc] | 158 |
|
|---|
| [c53d906] | 159 | $(LIBC_PREFIX)/arch/$(UARCH)/_link-loader.ld: $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld.in
|
|---|
| 160 | $(GCC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -DLOADER -E -x c $< | grep -v "^\#" > $@
|
|---|
| 161 |
|
|---|
| [729f774f] | 162 | $(LIBC_PREFIX)/arch/$(UARCH)/_link-shlib.ld: $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld.in
|
|---|
| 163 | $(GCC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -DSHLIB -E -x c $< | grep -v "^\#" > $@
|
|---|
| 164 |
|
|---|
| 165 | $(LIBC_PREFIX)/arch/$(UARCH)/_link-dlexe.ld: $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld.in
|
|---|
| 166 | $(GCC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -DDLEXE -E -x c $< | grep -v "^\#" > $@
|
|---|
| 167 |
|
|---|
| [4196304] | 168 | $(COMMON_HEADER_ARCH): $(COMMON_HEADER)
|
|---|
| 169 | ln -sfn ../../../$< $@
|
|---|