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