Rev 4340 | Rev 4343 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4340 | Rev 4342 | ||
---|---|---|---|
Line 28... | Line 28... | ||
28 | # |
28 | # |
29 | 29 | ||
30 | ## Common compiler flags |
30 | ## Common compiler flags |
31 | # |
31 | # |
32 | 32 | ||
33 | -include ../../../Makefile.config |
- | |
34 | - | ||
35 | LIBC_PREFIX = $(shell pwd) |
33 | LIBC_PREFIX = $(shell pwd) |
36 | SOFTINT_PREFIX = ../softint |
34 | SOFTINT_PREFIX = ../softint |
37 | RTLD_PREFIX = ../../lib/rtld |
35 | RTLD_PREFIX = ../../lib/rtld |
38 | 36 | ||
39 | ## Setup toolchain |
37 | ## Setup toolchain |
Line 45... | Line 43... | ||
45 | PIC_CFLAGS := $(CFLAGS) -fPIC -D__IN_SHARED_LIBC__ |
43 | PIC_CFLAGS := $(CFLAGS) -fPIC -D__IN_SHARED_LIBC__ |
46 | 44 | ||
47 | ## Sources |
45 | ## Sources |
48 | # |
46 | # |
49 | 47 | ||
50 | - | ||
51 | GENERIC_SOURCES = \ |
48 | GENERIC_SOURCES = \ |
52 | generic/libc.c \ |
49 | generic/libc.c \ |
53 | generic/ddi.c \ |
50 | generic/ddi.c \ |
54 | generic/as.c \ |
51 | generic/as.c \ |
55 | generic/cap.c \ |
52 | generic/cap.c \ |
Line 91... | Line 88... | ||
91 | generic/udebug.c \ |
88 | generic/udebug.c \ |
92 | generic/vfs/vfs.c \ |
89 | generic/vfs/vfs.c \ |
93 | generic/vfs/canonify.c |
90 | generic/vfs/canonify.c |
94 | 91 | ||
95 | ARCH_SOURCES += \ |
92 | ARCH_SOURCES += \ |
96 | arch/$(ARCH)/src/entry.s \ |
93 | arch/$(UARCH)/src/entry.s \ |
97 | arch/$(ARCH)/src/thread_entry.s |
94 | arch/$(UARCH)/src/thread_entry.s |
98 | 95 | ||
99 | GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES))) |
96 | GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES))) |
100 | ARCH_OBJECTS := $(addsuffix .o,$(basename $(ARCH_SOURCES))) |
97 | ARCH_OBJECTS := $(addsuffix .o,$(basename $(ARCH_SOURCES))) |
101 | OBJECTS := $(GENERIC_OBJECTS) $(ARCH_OBJECTS) |
98 | OBJECTS := $(GENERIC_OBJECTS) $(ARCH_OBJECTS) |
102 | PIC_OBJECTS := $(addsuffix .pio,$(basename $(OBJECTS))) |
99 | PIC_OBJECTS := $(addsuffix .pio,$(basename $(OBJECTS))) |
103 | 100 | ||
104 | .PHONY: all clean depend kerninc |
101 | .PHONY: all clean depend kerninc |
105 | 102 | ||
106 | all: kerninc libc.a libc.pic.a arch/$(ARCH)/_link.ld |
103 | all: kerninc libc.a libc.pic.a arch/$(UARCH)/_link.ld |
107 | 104 | ||
108 | kerninc: |
105 | kerninc: |
109 | ln -sfn ../../../../kernel/generic/include include/kernel |
106 | ln -sfn ../../../../kernel/generic/include include/kernel |
110 | ln -sfn kernel/arch include/arch |
107 | ln -sfn kernel/arch include/arch |
111 | ln -sfn ../arch/$(ARCH)/include include/libarch |
108 | ln -sfn ../arch/$(UARCH)/include include/libarch |
112 | 109 | ||
113 | -include Makefile.depend |
110 | -include Makefile.depend |
114 | 111 | ||
115 | clean: |
112 | clean: |
116 | -rm -f include/kernel include/arch include/libarch libc.a libc.pic.a arch/$(ARCH)/_link.ld Makefile.depend |
113 | -rm -f include/kernel include/arch include/libarch libc.a libc.pic.a arch/$(UARCH)/_link.ld Makefile.depend |
117 | find . \( -name '*.o' -o -name '*.pio' \) -follow -exec rm \{\} \; |
114 | find . \( -name '*.o' -o -name '*.pio' \) -follow -exec rm \{\} \; |
118 | 115 | ||
119 | depend: kerninc |
116 | depend: kerninc |
120 | -makedepend -f - -- $(DEFS) $(CFLAGS) -- $(ARCH_SOURCES) $(GENERIC_SOURCES) > Makefile.depend 2> /dev/null |
117 | -makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(ARCH_SOURCES) $(GENERIC_SOURCES) > Makefile.depend 2> /dev/null |
121 | -makedepend $(DEFS) $(PIC_CFLAGS) -o.pio -f - $(ARCH_SOURCES) $(GENERIC_SOURCES) >> Makefile.depend 2> /dev/null |
118 | -makedepend $(DEFS) $(PIC_CFLAGS) -o.pio -f - $(ARCH_SOURCES) $(GENERIC_SOURCES) >> Makefile.depend 2> /dev/null |
122 | 119 | ||
123 | libc.a: depend $(OBJECTS) |
120 | libc.a: depend $(OBJECTS) |
124 | $(AR) rc $@ $(LIBS) $(OBJECTS) |
121 | $(AR) rc $@ $(LIBS) $(OBJECTS) |
125 | 122 | ||
126 | libc.pic.a: depend $(PIC_OBJECTS) |
123 | libc.pic.a: depend $(PIC_OBJECTS) |
127 | $(AR) rc $@ $(LIBS) $(PIC_OBJECTS) |
124 | $(AR) rc $@ $(LIBS) $(PIC_OBJECTS) |
128 | 125 | ||
129 | arch/$(ARCH)/_link.ld: arch/$(ARCH)/_link.ld.in |
126 | arch/$(UARCH)/_link.ld: arch/$(UARCH)/_link.ld.in |
130 | $(CC) $(DEFS) $(CFLAGS) -DLIBC_PREFIX=$(LIBC_PREFIX) -E -x c $< | grep -v "^\#" > $@ |
127 | $(CC) $(DEFS) $(CFLAGS) -DLIBC_PREFIX=$(LIBC_PREFIX) -E -x c $< | grep -v "^\#" > $@ |
131 | 128 | ||
132 | %.o: %.S |
129 | %.o: %.S |
133 | $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@ |
130 | $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@ |
134 | 131 |