Rev 4343 | Rev 4354 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
491 | decky | 1 | # |
2071 | jermar | 2 | # Copyright (c) 2005 Martin Decky |
2955 | svoboda | 3 | # Copyright (c) 2008 Jiri Svoboda |
491 | decky | 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 | # |
||
447 | decky | 29 | |
491 | decky | 30 | ## Common compiler flags |
31 | # |
||
447 | decky | 32 | |
2528 | jermar | 33 | LIBC_PREFIX = $(shell pwd) |
1073 | cejka | 34 | SOFTINT_PREFIX = ../softint |
3686 | svoboda | 35 | RTLD_PREFIX = ../../lib/rtld |
447 | decky | 36 | |
502 | decky | 37 | ## Setup toolchain |
491 | decky | 38 | # |
447 | decky | 39 | |
502 | decky | 40 | include $(LIBC_PREFIX)/Makefile.toolchain |
447 | decky | 41 | |
4338 | svoboda | 42 | CFLAGS += -I$(RTLD_PREFIX)/include -I../../srv/loader/include -D__32_BITS__ |
3564 | svoboda | 43 | PIC_CFLAGS := $(CFLAGS) -fPIC -D__IN_SHARED_LIBC__ |
1451 | cejka | 44 | |
491 | decky | 45 | ## Sources |
46 | # |
||
47 | |||
48 | GENERIC_SOURCES = \ |
||
504 | decky | 49 | generic/libc.c \ |
1180 | jermar | 50 | generic/ddi.c \ |
1237 | jermar | 51 | generic/as.c \ |
1308 | jermar | 52 | generic/cap.c \ |
4338 | svoboda | 53 | generic/console.c \ |
4347 | svoboda | 54 | generic/event.c \ |
4337 | svoboda | 55 | generic/mem.c \ |
999 | palkovsky | 56 | generic/string.c \ |
2586 | jermar | 57 | generic/fibril.c \ |
3171 | svoboda | 58 | generic/pcb.c \ |
3400 | svoboda | 59 | generic/smc.c \ |
1065 | jermar | 60 | generic/thread.c \ |
2586 | jermar | 61 | generic/tls.c \ |
1175 | jermar | 62 | generic/task.c \ |
1111 | jermar | 63 | generic/futex.c \ |
3403 | svoboda | 64 | generic/io/asprintf.c \ |
974 | cejka | 65 | generic/io/io.c \ |
1234 | cejka | 66 | generic/io/printf.c \ |
4338 | svoboda | 67 | generic/io/fprintf.c \ |
68 | generic/io/stdio.c \ |
||
1363 | vana | 69 | generic/io/stream.c \ |
1234 | cejka | 70 | generic/io/sprintf.c \ |
71 | generic/io/snprintf.c \ |
||
72 | generic/io/vprintf.c \ |
||
73 | generic/io/vsprintf.c \ |
||
74 | generic/io/vsnprintf.c \ |
||
75 | generic/io/printf_core.c \ |
||
1113 | palkovsky | 76 | malloc/malloc.c \ |
1351 | palkovsky | 77 | generic/sysinfo.c \ |
1392 | palkovsky | 78 | generic/ipc.c \ |
79 | generic/async.c \ |
||
3686 | svoboda | 80 | generic/dlfcn.c \ |
3474 | svoboda | 81 | generic/loader.c \ |
3403 | svoboda | 82 | generic/getopt.c \ |
1392 | palkovsky | 83 | generic/libadt/list.o \ |
1435 | palkovsky | 84 | generic/libadt/hash_table.o \ |
1472 | palkovsky | 85 | generic/time.c \ |
86 | generic/err.c \ |
||
1505 | palkovsky | 87 | generic/stdlib.c \ |
4343 | svoboda | 88 | generic/kbd.c \ |
2671 | jermar | 89 | generic/mman.c \ |
3448 | svoboda | 90 | generic/udebug.c \ |
2753 | jermar | 91 | generic/vfs/vfs.c \ |
92 | generic/vfs/canonify.c |
||
491 | decky | 93 | |
805 | palkovsky | 94 | ARCH_SOURCES += \ |
4342 | svoboda | 95 | arch/$(UARCH)/src/entry.s \ |
96 | arch/$(UARCH)/src/thread_entry.s |
||
491 | decky | 97 | |
98 | GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES))) |
||
99 | ARCH_OBJECTS := $(addsuffix .o,$(basename $(ARCH_SOURCES))) |
||
4337 | svoboda | 100 | OBJECTS := $(GENERIC_OBJECTS) $(ARCH_OBJECTS) |
101 | PIC_OBJECTS := $(addsuffix .pio,$(basename $(OBJECTS))) |
||
491 | decky | 102 | |
954 | palkovsky | 103 | .PHONY: all clean depend kerninc |
491 | decky | 104 | |
4342 | svoboda | 105 | all: kerninc libc.a libc.pic.a arch/$(UARCH)/_link.ld |
491 | decky | 106 | |
954 | palkovsky | 107 | kerninc: |
2479 | jermar | 108 | ln -sfn ../../../../kernel/generic/include include/kernel |
1015 | decky | 109 | ln -sfn kernel/arch include/arch |
4342 | svoboda | 110 | ln -sfn ../arch/$(UARCH)/include include/libarch |
954 | palkovsky | 111 | |
491 | decky | 112 | -include Makefile.depend |
113 | |||
447 | decky | 114 | clean: |
4342 | svoboda | 115 | -rm -f include/kernel include/arch include/libarch libc.a libc.pic.a arch/$(UARCH)/_link.ld Makefile.depend |
2955 | svoboda | 116 | find . \( -name '*.o' -o -name '*.pio' \) -follow -exec rm \{\} \; |
447 | decky | 117 | |
1113 | palkovsky | 118 | depend: kerninc |
4342 | svoboda | 119 | -makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(ARCH_SOURCES) $(GENERIC_SOURCES) > Makefile.depend 2> /dev/null |
2955 | svoboda | 120 | -makedepend $(DEFS) $(PIC_CFLAGS) -o.pio -f - $(ARCH_SOURCES) $(GENERIC_SOURCES) >> Makefile.depend 2> /dev/null |
447 | decky | 121 | |
2955 | svoboda | 122 | libc.a: depend $(OBJECTS) |
3772 | svoboda | 123 | $(AR) rc $@ $(LIBS) $(OBJECTS) |
447 | decky | 124 | |
2955 | svoboda | 125 | libc.pic.a: depend $(PIC_OBJECTS) |
126 | $(AR) rc $@ $(LIBS) $(PIC_OBJECTS) |
||
127 | |||
4342 | svoboda | 128 | arch/$(UARCH)/_link.ld: arch/$(UARCH)/_link.ld.in |
2528 | jermar | 129 | $(CC) $(DEFS) $(CFLAGS) -DLIBC_PREFIX=$(LIBC_PREFIX) -E -x c $< | grep -v "^\#" > $@ |
502 | decky | 130 | |
491 | decky | 131 | %.o: %.S |
132 | $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@ |
||
133 | |||
447 | decky | 134 | %.o: %.s |
491 | decky | 135 | $(AS) $(AFLAGS) $< -o $@ |
447 | decky | 136 | |
137 | %.o: %.c |
||
491 | decky | 138 | $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ |
2955 | svoboda | 139 | |
140 | %.pio: %.S |
||
141 | $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@ |
||
142 | |||
143 | %.pio: %.s |
||
144 | $(AS) $(AFLAGS) $< -o $@ |
||
145 | |||
146 | %.pio: %.c |
||
147 | $(CC) $(DEFS) $(PIC_CFLAGS) -c $< -o $@ |