| 1 | #
|
|---|
| 2 | # Copyright (c) 2005 Martin Decky
|
|---|
| 3 | # Copyright (c) 2007 Jakub Jermar
|
|---|
| 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 | #
|
|---|
| 29 |
|
|---|
| 30 | USPACE_PREFIX = ../..
|
|---|
| 31 | ROOT_PATH = $(USPACE_PREFIX)/..
|
|---|
| 32 |
|
|---|
| 33 | CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config
|
|---|
| 34 |
|
|---|
| 35 | LINKER_SCRIPTS = \
|
|---|
| 36 | $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld \
|
|---|
| 37 | $(LIBC_PREFIX)/arch/$(UARCH)/_link-loader.ld \
|
|---|
| 38 | $(LIBC_PREFIX)/arch/$(UARCH)/_link-shlib.ld \
|
|---|
| 39 | $(LIBC_PREFIX)/arch/$(UARCH)/_link-dlexe.ld
|
|---|
| 40 |
|
|---|
| 41 | PRE_DEPEND =
|
|---|
| 42 | EXTRA_OUTPUT = $(LINKER_SCRIPTS)
|
|---|
| 43 | EXTRA_CLEAN = $(LINKER_SCRIPTS)
|
|---|
| 44 | LIBRARY = libc
|
|---|
| 45 | SLIBRARY = libc.so.0.0
|
|---|
| 46 | LSONAME = libc.so.0
|
|---|
| 47 |
|
|---|
| 48 | -include $(CONFIG_MAKEFILE)
|
|---|
| 49 | -include arch/$(UARCH)/Makefile.inc
|
|---|
| 50 |
|
|---|
| 51 | ARCH_AUTOGENS_H := $(addsuffix .h,$(basename $(ARCH_AUTOGENS_AG)))
|
|---|
| 52 | ARCH_AUTOGENS_PROBE_C := $(addsuffix .ag.probe.c,$(basename $(ARCH_AUTOGENS_AG)))
|
|---|
| 53 | ARCH_AUTOGENS_PROBE_S := $(addsuffix .ag.probe.s,$(basename $(ARCH_AUTOGENS_AG)))
|
|---|
| 54 |
|
|---|
| 55 | PRE_DEPEND += $(ARCH_AUTOGENS_H)
|
|---|
| 56 | EXTRA_CLEAN += $(ARCH_AUTOGENS_H) $(ARCH_AUTOGENS_PROBE_C) $(ARCH_AUTOGENS_PROBE_S)
|
|---|
| 57 |
|
|---|
| 58 | GENERIC_SOURCES = \
|
|---|
| 59 | generic/libc.c \
|
|---|
| 60 | generic/ddi.c \
|
|---|
| 61 | generic/as.c \
|
|---|
| 62 | generic/bd.c \
|
|---|
| 63 | generic/bd_srv.c \
|
|---|
| 64 | generic/perm.c \
|
|---|
| 65 | generic/cap.c \
|
|---|
| 66 | generic/clipboard.c \
|
|---|
| 67 | generic/config.c \
|
|---|
| 68 | generic/corecfg.c \
|
|---|
| 69 | generic/devman.c \
|
|---|
| 70 | generic/device/hw_res.c \
|
|---|
| 71 | generic/device/hw_res_parsed.c \
|
|---|
| 72 | generic/device/pio_window.c \
|
|---|
| 73 | generic/device/clock_dev.c \
|
|---|
| 74 | generic/device/led_dev.c \
|
|---|
| 75 | generic/dirent.c \
|
|---|
| 76 | generic/dhcp.c \
|
|---|
| 77 | generic/dnsr.c \
|
|---|
| 78 | generic/dlfcn.c \
|
|---|
| 79 | generic/elf/elf_load.c \
|
|---|
| 80 | generic/elf/elf_mod.c \
|
|---|
| 81 | generic/event.c \
|
|---|
| 82 | generic/errno.c \
|
|---|
| 83 | generic/gsort.c \
|
|---|
| 84 | generic/loc.c \
|
|---|
| 85 | generic/mem.c \
|
|---|
| 86 | generic/str.c \
|
|---|
| 87 | generic/str_error.c \
|
|---|
| 88 | generic/l18n/langs.c \
|
|---|
| 89 | generic/fibril.c \
|
|---|
| 90 | generic/fibril_synch.c \
|
|---|
| 91 | generic/pcb.c \
|
|---|
| 92 | generic/smc.c \
|
|---|
| 93 | generic/smp_memory_barrier.c \
|
|---|
| 94 | generic/thread.c \
|
|---|
| 95 | generic/tls.c \
|
|---|
| 96 | generic/task.c \
|
|---|
| 97 | generic/futex.c \
|
|---|
| 98 | generic/imath.c \
|
|---|
| 99 | generic/inet/addr.c \
|
|---|
| 100 | generic/inet/endpoint.c \
|
|---|
| 101 | generic/inet/host.c \
|
|---|
| 102 | generic/inet/hostname.c \
|
|---|
| 103 | generic/inet/hostport.c \
|
|---|
| 104 | generic/inet/tcp.c \
|
|---|
| 105 | generic/inet/udp.c \
|
|---|
| 106 | generic/inet.c \
|
|---|
| 107 | generic/inetcfg.c \
|
|---|
| 108 | generic/inetping.c \
|
|---|
| 109 | generic/io/asprintf.c \
|
|---|
| 110 | generic/io/input.c \
|
|---|
| 111 | generic/io/io.c \
|
|---|
| 112 | generic/io/chardev.c \
|
|---|
| 113 | generic/io/chardev_srv.c \
|
|---|
| 114 | generic/io/chargrid.c \
|
|---|
| 115 | generic/io/output.c \
|
|---|
| 116 | generic/io/printf.c \
|
|---|
| 117 | generic/io/log.c \
|
|---|
| 118 | generic/io/logctl.c \
|
|---|
| 119 | generic/io/kio.c \
|
|---|
| 120 | generic/io/klog.c \
|
|---|
| 121 | generic/io/snprintf.c \
|
|---|
| 122 | generic/io/vprintf.c \
|
|---|
| 123 | generic/io/vsnprintf.c \
|
|---|
| 124 | generic/io/printf_core.c \
|
|---|
| 125 | generic/io/con_srv.c \
|
|---|
| 126 | generic/io/console.c \
|
|---|
| 127 | generic/io/table.c \
|
|---|
| 128 | generic/io/visualizer.c \
|
|---|
| 129 | generic/io/window.c \
|
|---|
| 130 | generic/iplink.c \
|
|---|
| 131 | generic/iplink_srv.c \
|
|---|
| 132 | generic/irc.c \
|
|---|
| 133 | generic/irq.c \
|
|---|
| 134 | generic/ieee_double.c \
|
|---|
| 135 | generic/power_of_ten.c \
|
|---|
| 136 | generic/double_to_str.c \
|
|---|
| 137 | generic/malloc.c \
|
|---|
| 138 | generic/sysinfo.c \
|
|---|
| 139 | generic/ipc.c \
|
|---|
| 140 | generic/ns.c \
|
|---|
| 141 | generic/async.c \
|
|---|
| 142 | generic/loader.c \
|
|---|
| 143 | generic/getopt.c \
|
|---|
| 144 | generic/adt/checksum.c \
|
|---|
| 145 | generic/adt/list.c \
|
|---|
| 146 | generic/adt/hash_table.c \
|
|---|
| 147 | generic/adt/odict.c \
|
|---|
| 148 | generic/adt/prodcons.c \
|
|---|
| 149 | generic/time.c \
|
|---|
| 150 | generic/stdio.c \
|
|---|
| 151 | generic/stdlib.c \
|
|---|
| 152 | generic/udebug.c \
|
|---|
| 153 | generic/vfs/canonify.c \
|
|---|
| 154 | generic/vfs/inbox.c \
|
|---|
| 155 | generic/vfs/mtab.c \
|
|---|
| 156 | generic/vfs/vfs.c \
|
|---|
| 157 | generic/rcu.c \
|
|---|
| 158 | generic/setjmp.c \
|
|---|
| 159 | generic/stack.c \
|
|---|
| 160 | generic/stacktrace.c \
|
|---|
| 161 | generic/arg_parse.c \
|
|---|
| 162 | generic/stats.c \
|
|---|
| 163 | generic/assert.c \
|
|---|
| 164 | generic/pio_trace.c \
|
|---|
| 165 | generic/qsort.c \
|
|---|
| 166 | generic/uuid.c \
|
|---|
| 167 | generic/vbd.c \
|
|---|
| 168 | generic/vol.c
|
|---|
| 169 |
|
|---|
| 170 | ifeq ($(CONFIG_RTLD),y)
|
|---|
| 171 | GENERIC_SOURCES += \
|
|---|
| 172 | generic/rtld/rtld.c \
|
|---|
| 173 | generic/rtld/dynamic.c \
|
|---|
| 174 | generic/rtld/module.c \
|
|---|
| 175 | generic/rtld/symbol.c
|
|---|
| 176 | endif
|
|---|
| 177 |
|
|---|
| 178 | SOURCES = \
|
|---|
| 179 | $(GENERIC_SOURCES) \
|
|---|
| 180 | $(ARCH_SOURCES)
|
|---|
| 181 |
|
|---|
| 182 | TEST_SOURCES = \
|
|---|
| 183 | test/fibril/timer.c \
|
|---|
| 184 | test/main.c \
|
|---|
| 185 | test/io/table.c \
|
|---|
| 186 | test/odict.c \
|
|---|
| 187 | test/qsort.c \
|
|---|
| 188 | test/sprintf.c \
|
|---|
| 189 | test/str.c
|
|---|
| 190 |
|
|---|
| 191 | include $(USPACE_PREFIX)/Makefile.common
|
|---|
| 192 |
|
|---|
| 193 | %.h: %.ag
|
|---|
| 194 | $(AUTOGEN) probe $< >$<.probe.c
|
|---|
| 195 | $(CC_AUTOGEN) $(DEFS) $(CFLAGS) -S -o $<.probe.s $<.probe.c
|
|---|
| 196 | $(AUTOGEN) generate $< <$<.probe.s >$@
|
|---|
| 197 |
|
|---|
| 198 | $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld: $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld.in
|
|---|
| 199 | $(CC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -E -x c $< | grep -v "^\#" > $@
|
|---|
| 200 |
|
|---|
| 201 | $(LIBC_PREFIX)/arch/$(UARCH)/_link-loader.ld: $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld.in
|
|---|
| 202 | $(CC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -DLOADER -E -x c $< | grep -v "^\#" > $@
|
|---|
| 203 |
|
|---|
| 204 | $(LIBC_PREFIX)/arch/$(UARCH)/_link-shlib.ld: $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld.in
|
|---|
| 205 | $(CC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -DSHLIB -E -x c $< | grep -v "^\#" > $@
|
|---|
| 206 |
|
|---|
| 207 | $(LIBC_PREFIX)/arch/$(UARCH)/_link-dlexe.ld: $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld.in
|
|---|
| 208 | $(CC) $(DEFS) $(CFLAGS) -DLIBC_PATH=$(CURDIR) -DDLEXE -E -x c $< | grep -v "^\#" > $@
|
|---|