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 | EXTRA_OUTPUT = $(START_FILES)
|
---|
36 | EXTRA_CFLAGS += -fno-builtin -D_LIBC_SOURCE
|
---|
37 | LIBRARY = libc
|
---|
38 | SOVERSION = 0.0
|
---|
39 |
|
---|
40 | -include $(CONFIG_MAKEFILE)
|
---|
41 | -include arch/$(UARCH)/Makefile.inc
|
---|
42 |
|
---|
43 | GENERIC_SOURCES = \
|
---|
44 | generic/libc.c \
|
---|
45 | generic/ddi.c \
|
---|
46 | generic/as.c \
|
---|
47 | generic/bd.c \
|
---|
48 | generic/bd_srv.c \
|
---|
49 | generic/perm.c \
|
---|
50 | generic/cap.c \
|
---|
51 | generic/clipboard.c \
|
---|
52 | generic/config.c \
|
---|
53 | generic/context.c \
|
---|
54 | generic/corecfg.c \
|
---|
55 | generic/ctype.c \
|
---|
56 | generic/devman.c \
|
---|
57 | generic/device/hw_res.c \
|
---|
58 | generic/device/hw_res_parsed.c \
|
---|
59 | generic/device/pio_window.c \
|
---|
60 | generic/device/clock_dev.c \
|
---|
61 | generic/device/led_dev.c \
|
---|
62 | generic/dirent.c \
|
---|
63 | generic/dhcp.c \
|
---|
64 | generic/dnsr.c \
|
---|
65 | generic/dlfcn.c \
|
---|
66 | generic/elf/elf.c \
|
---|
67 | generic/elf/elf_load.c \
|
---|
68 | generic/elf/elf_mod.c \
|
---|
69 | generic/event.c \
|
---|
70 | generic/errno.c \
|
---|
71 | generic/gsort.c \
|
---|
72 | generic/inttypes.c \
|
---|
73 | generic/ipc_test.c \
|
---|
74 | generic/loc.c \
|
---|
75 | generic/mem.c \
|
---|
76 | generic/str.c \
|
---|
77 | generic/string.c \
|
---|
78 | generic/str_error.c \
|
---|
79 | generic/strtol.c \
|
---|
80 | generic/l18n/langs.c \
|
---|
81 | generic/pcb.c \
|
---|
82 | generic/smc.c \
|
---|
83 | generic/task.c \
|
---|
84 | generic/imath.c \
|
---|
85 | generic/inet/addr.c \
|
---|
86 | generic/inet/endpoint.c \
|
---|
87 | generic/inet/host.c \
|
---|
88 | generic/inet/hostname.c \
|
---|
89 | generic/inet/hostport.c \
|
---|
90 | generic/inet/tcp.c \
|
---|
91 | generic/inet/udp.c \
|
---|
92 | generic/inet.c \
|
---|
93 | generic/inetcfg.c \
|
---|
94 | generic/inetping.c \
|
---|
95 | generic/io/asprintf.c \
|
---|
96 | generic/io/input.c \
|
---|
97 | generic/io/io.c \
|
---|
98 | generic/io/chardev.c \
|
---|
99 | generic/io/chardev_srv.c \
|
---|
100 | generic/io/chargrid.c \
|
---|
101 | generic/io/output.c \
|
---|
102 | generic/io/printf.c \
|
---|
103 | generic/io/log.c \
|
---|
104 | generic/io/logctl.c \
|
---|
105 | generic/io/label.c \
|
---|
106 | generic/io/kio.c \
|
---|
107 | generic/io/klog.c \
|
---|
108 | generic/io/serial.c \
|
---|
109 | generic/io/snprintf.c \
|
---|
110 | generic/io/vprintf.c \
|
---|
111 | generic/io/vsnprintf.c \
|
---|
112 | generic/io/printf_core.c \
|
---|
113 | generic/io/con_srv.c \
|
---|
114 | generic/io/console.c \
|
---|
115 | generic/io/table.c \
|
---|
116 | generic/io/visualizer.c \
|
---|
117 | generic/io/window.c \
|
---|
118 | generic/iplink.c \
|
---|
119 | generic/iplink_srv.c \
|
---|
120 | generic/irc.c \
|
---|
121 | generic/irq.c \
|
---|
122 | generic/ieee_double.c \
|
---|
123 | generic/power_of_ten.c \
|
---|
124 | generic/double_to_str.c \
|
---|
125 | generic/malloc.c \
|
---|
126 | generic/rndgen.c \
|
---|
127 | generic/stdio/scanf.c \
|
---|
128 | generic/stdio/sprintf.c \
|
---|
129 | generic/stdio/sscanf.c \
|
---|
130 | generic/stdio/sstream.c \
|
---|
131 | generic/stdio/vsprintf.c \
|
---|
132 | generic/thread/fibril.c \
|
---|
133 | generic/thread/fibril_synch.c \
|
---|
134 | generic/thread/thread.c \
|
---|
135 | generic/thread/tls.c \
|
---|
136 | generic/thread/futex.c \
|
---|
137 | generic/thread/mpsc.c \
|
---|
138 | generic/sysinfo.c \
|
---|
139 | generic/ipc.c \
|
---|
140 | generic/ns.c \
|
---|
141 | generic/async/client.c \
|
---|
142 | generic/async/server.c \
|
---|
143 | generic/async/ports.c \
|
---|
144 | generic/loader.c \
|
---|
145 | generic/getopt.c \
|
---|
146 | generic/adt/checksum.c \
|
---|
147 | generic/adt/circ_buf.c \
|
---|
148 | generic/adt/list.c \
|
---|
149 | generic/adt/hash_table.c \
|
---|
150 | generic/adt/odict.c \
|
---|
151 | generic/adt/prodcons.c \
|
---|
152 | generic/time.c \
|
---|
153 | generic/tmpfile.c \
|
---|
154 | generic/stdio.c \
|
---|
155 | generic/stdlib.c \
|
---|
156 | generic/udebug.c \
|
---|
157 | generic/vfs/canonify.c \
|
---|
158 | generic/vfs/inbox.c \
|
---|
159 | generic/vfs/mtab.c \
|
---|
160 | generic/vfs/vfs.c \
|
---|
161 | generic/setjmp.c \
|
---|
162 | generic/stack.c \
|
---|
163 | generic/stacktrace.c \
|
---|
164 | generic/arg_parse.c \
|
---|
165 | generic/stats.c \
|
---|
166 | generic/assert.c \
|
---|
167 | generic/bsearch.c \
|
---|
168 | generic/pci.c \
|
---|
169 | generic/pio_trace.c \
|
---|
170 | generic/qsort.c \
|
---|
171 | generic/ubsan.c \
|
---|
172 | generic/uuid.c \
|
---|
173 | generic/vbd.c \
|
---|
174 | generic/vol.c
|
---|
175 |
|
---|
176 | ifeq ($(CONFIG_RTLD),y)
|
---|
177 | GENERIC_SOURCES += \
|
---|
178 | generic/rtld/rtld.c \
|
---|
179 | generic/rtld/dynamic.c \
|
---|
180 | generic/rtld/module.c \
|
---|
181 | generic/rtld/symbol.c
|
---|
182 | endif
|
---|
183 |
|
---|
184 | ARCH_SOURCES += $(ARCH_AUTOCHECK_HEADERS:%.h=%.check.c)
|
---|
185 |
|
---|
186 | SOURCES = \
|
---|
187 | $(GENERIC_SOURCES) \
|
---|
188 | $(ARCH_SOURCES)
|
---|
189 |
|
---|
190 | TEST_SOURCES = \
|
---|
191 | test/adt/circ_buf.c \
|
---|
192 | test/adt/odict.c \
|
---|
193 | test/cap.c \
|
---|
194 | test/casting.c \
|
---|
195 | test/double_to_str.c \
|
---|
196 | test/fibril/timer.c \
|
---|
197 | test/getopt.c \
|
---|
198 | test/gsort.c \
|
---|
199 | test/ieee_double.c \
|
---|
200 | test/imath.c \
|
---|
201 | test/inttypes.c \
|
---|
202 | test/io/table.c \
|
---|
203 | test/main.c \
|
---|
204 | test/mem.c \
|
---|
205 | test/perf.c \
|
---|
206 | test/perm.c \
|
---|
207 | test/qsort.c \
|
---|
208 | test/sprintf.c \
|
---|
209 | test/stdio/scanf.c \
|
---|
210 | test/stdio.c \
|
---|
211 | test/stdlib.c \
|
---|
212 | test/str.c \
|
---|
213 | test/string.c \
|
---|
214 | test/strtol.c \
|
---|
215 | test/uuid.c
|
---|
216 |
|
---|
217 | include $(USPACE_PREFIX)/Makefile.common
|
---|
218 |
|
---|
219 | $(LIBC_PREFIX)/crt0.o: $(LIBC_PREFIX)/arch/$(UARCH)/src/entry.o
|
---|
220 | cp $< $@
|
---|
221 |
|
---|
222 | $(LIBC_PREFIX)/crt1.o: $(LIBC_PREFIX)/generic/crt/entry.o
|
---|
223 | cp $< $@
|
---|
224 |
|
---|
225 | AUTOCHECK = $(realpath $(ROOT_PATH)/tools/autocheck.awk)
|
---|
226 |
|
---|
227 | %.check.c: %.h $(AUTOCHECK)
|
---|
228 | cd $(<D) && $(AUTOCHECK) $(<F) > $(@F)
|
---|