Rev 10 | Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | jermar | 1 | include Makefile.config |
2 | include ../arch/$(ARCH)/Makefile.inc |
||
3 | |||
4 | sources=cpu/cpu.c \ |
||
5 | main/main.c \ |
||
6 | main/kinit.c \ |
||
7 | main/uinit.c \ |
||
8 | proc/scheduler.c \ |
||
9 | proc/thread.c \ |
||
10 | proc/task.c \ |
||
11 | mm/heap.c \ |
||
12 | mm/frame.c \ |
||
13 | mm/page.c \ |
||
14 | mm/tlb.c \ |
||
15 | mm/vm.c \ |
||
16 | lib/func.c \ |
||
17 | lib/list.c \ |
||
18 | debug/print.c \ |
||
19 | time/clock.c \ |
||
20 | time/timeout.c \ |
||
21 | time/delay.c \ |
||
22 | synch/spinlock.c \ |
||
23 | synch/condvar.c \ |
||
24 | synch/rwlock.c \ |
||
25 | synch/mutex.c \ |
||
26 | synch/semaphore.c \ |
||
27 | synch/waitq.c |
||
28 | |||
29 | ifdef DEBUG_SPINLOCK |
||
30 | CFLAGS+=-D$(DEBUG_SPINLOCK) |
||
31 | endif |
||
32 | |||
33 | ifdef TEST |
||
34 | test_objects:=$(addsuffix .o,$(basename ../test/$(TEST_DIR)/$(TEST_FILE))) |
||
35 | CFLAGS+=-D$(TEST) |
||
36 | endif |
||
37 | arch_objects:=$(addsuffix .o,$(basename $(arch_sources))) |
||
38 | objects:=$(addsuffix .o,$(basename $(sources))) |
||
39 | |||
40 | .PHONY : all config depend build clean dist-clean boot |
||
41 | |||
42 | all: dist-clean config depend build |
||
43 | |||
44 | -include Makefile.depend |
||
45 | |||
46 | config: |
||
47 | find . ../include -name arch -type l -exec rm \{\} \; |
||
48 | ln -s ../arch/$(ARCH)/src arch |
||
49 | ln -s ../arch/$(ARCH)/include ../include/arch |
||
50 | |||
51 | depend: |
||
52 | $(CC) $(CPPFLAGS) -M $(arch_sources) $(sources) >Makefile.depend |
||
53 | |||
54 | build: kernel.bin boot |
||
55 | |||
56 | clean: |
||
57 | find . ../arch/$(ARCH)/src ../test -name '*.o' -exec rm \{\} \; |
||
58 | -rm *.bin kernel.map |
||
59 | $(MAKE) -C ../arch/$(ARCH)/boot clean |
||
60 | |||
61 | dist-clean: |
||
62 | find . ../include -name arch -type l -exec rm \{\} \; |
||
63 | -rm Makefile.depend |
||
64 | -$(MAKE) clean |
||
65 | |||
66 | kernel.bin: $(arch_objects) $(objects) $(test_objects) |
||
67 | $(LD) $(LFLAGS) $(arch_objects) $(objects) $(test_objects) -o $@ >kernel.map |
||
68 | |||
69 | %.s: %.S |
||
70 | $(CC) $(CPPFLAGS) -E $< >$@ |
||
71 | |||
72 | %.o: %.s |
||
73 | $(AS) $< -o $@ |
||
74 | |||
75 | %.o: %.c |
||
76 | $(CC) $(CFLAGS) -c $< -o $@ |
||
77 | |||
78 | KS=`cat kernel.bin | wc -c` |
||
79 | |||
80 | boot: |
||
81 | $(MAKE) -C ../arch/$(ARCH)/boot build KERNEL_SIZE=$(KS) |