Rev 288 | Rev 293 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 288 | Rev 289 | ||
---|---|---|---|
1 | include Makefile.config |
1 | include Makefile.config |
2 | include ../arch/$(ARCH)/Makefile.inc |
2 | include ../arch/$(ARCH)/Makefile.inc |
3 | 3 | ||
4 | sources=cpu/cpu.c \ |
4 | sources=cpu/cpu.c \ |
5 | main/main.c \ |
5 | main/main.c \ |
6 | main/kinit.c \ |
6 | main/kinit.c \ |
7 | main/uinit.c \ |
7 | main/uinit.c \ |
8 | proc/scheduler.c \ |
8 | proc/scheduler.c \ |
9 | proc/thread.c \ |
9 | proc/thread.c \ |
10 | proc/task.c \ |
10 | proc/task.c \ |
11 | mm/heap.c \ |
11 | mm/heap.c \ |
12 | mm/frame.c \ |
12 | mm/frame.c \ |
13 | mm/page.c \ |
13 | mm/page.c \ |
14 | mm/tlb.c \ |
14 | mm/tlb.c \ |
15 | mm/vm.c \ |
15 | mm/vm.c \ |
16 | lib/func.c \ |
16 | lib/func.c \ |
17 | lib/list.c \ |
17 | lib/list.c \ |
18 | lib/memstr.c \ |
18 | lib/memstr.c \ |
19 | lib/the.c \ |
19 | lib/the.c \ |
20 | debug/print.c \ |
20 | debug/print.c \ |
21 | debug/symtab.c \ |
21 | debug/symtab.c \ |
22 | time/clock.c \ |
22 | time/clock.c \ |
23 | time/timeout.c \ |
23 | time/timeout.c \ |
24 | time/delay.c \ |
24 | time/delay.c \ |
25 | preempt/preemption.c \ |
25 | preempt/preemption.c \ |
26 | synch/spinlock.c \ |
26 | synch/spinlock.c \ |
27 | synch/condvar.c \ |
27 | synch/condvar.c \ |
28 | synch/rwlock.c \ |
28 | synch/rwlock.c \ |
29 | synch/mutex.c \ |
29 | synch/mutex.c \ |
30 | synch/semaphore.c \ |
30 | synch/semaphore.c \ |
31 | synch/waitq.c \ |
31 | synch/waitq.c \ |
32 | smp/ipi.c \ |
32 | smp/ipi.c \ |
33 | fb/font-8x16.c |
33 | fb/font-8x16.c |
34 | 34 | ||
35 | ifdef DEBUG_SPINLOCK |
35 | ifdef DEBUG_SPINLOCK |
36 | CFLAGS+=-D$(DEBUG_SPINLOCK) |
36 | CFLAGS+=-D$(DEBUG_SPINLOCK) |
37 | endif |
37 | endif |
38 | 38 | ||
39 | ifdef USERSPACE |
39 | ifdef USERSPACE |
40 | CFLAGS+=-D$(USERSPACE) |
40 | CFLAGS+=-D$(USERSPACE) |
41 | endif |
41 | endif |
42 | 42 | ||
43 | ifdef TEST |
43 | ifdef TEST |
44 | test_objects:=$(addsuffix .o,$(basename ../test/$(TEST_DIR)/$(TEST_FILE))) |
44 | test_objects:=$(addsuffix .o,$(basename ../test/$(TEST_DIR)/$(TEST_FILE))) |
45 | CFLAGS+=-D$(TEST) |
45 | CFLAGS+=-D$(TEST) |
46 | endif |
46 | endif |
47 | arch_objects:=$(addsuffix .o,$(basename $(arch_sources))) |
47 | arch_objects:=$(addsuffix .o,$(basename $(arch_sources))) |
48 | objects:=$(addsuffix .o,$(basename $(sources))) |
48 | objects:=$(addsuffix .o,$(basename $(sources))) |
49 | 49 | ||
50 | .PHONY : all config depend build clean dist-clean boot |
50 | .PHONY : all config depend build clean dist-clean boot |
51 | 51 | ||
52 | all: dist-clean config depend build |
52 | all: dist-clean config depend build |
53 | 53 | ||
54 | -include Makefile.depend |
54 | -include Makefile.depend |
55 | 55 | ||
56 | config: |
56 | config: |
57 | find . ../include -name arch -type l -exec rm \{\} \; |
57 | find . ../include -name arch -type l -exec rm \{\} \; |
58 | ln -s ../arch/$(ARCH)/src arch |
58 | ln -s ../arch/$(ARCH)/src arch |
59 | ln -s ../arch/$(ARCH)/include ../include/arch |
59 | ln -s ../arch/$(ARCH)/include ../include/arch |
60 | 60 | ||
61 | depend: |
61 | depend: |
62 | $(CC) $(CPPFLAGS) -M $(arch_sources) $(sources) >Makefile.depend |
62 | $(CC) $(CPPFLAGS) -M $(arch_sources) $(sources) >Makefile.depend |
63 | 63 | ||
64 | build: kernel.bin boot |
64 | build: kernel.bin boot |
65 | 65 | ||
66 | clean: |
66 | clean: |
67 | find . ../arch/$(ARCH)/src ../test -name '*.o' -exec rm \{\} \; |
67 | find . ../arch/$(ARCH)/src ../test -name '*.o' -exec rm \{\} \; |
68 | -rm *.bin kernel.map kernel.map.pre debug/real_map.bin |
68 | -rm *.bin kernel.map kernel.map.pre debug/real_map.bin |
69 | $(MAKE) -C ../arch/$(ARCH)/boot clean |
69 | $(MAKE) -C ../arch/$(ARCH)/boot clean |
70 | 70 | ||
71 | dist-clean: |
71 | dist-clean: |
72 | find . ../include -name arch -type l -exec rm \{\} \; |
72 | find . ../include -name arch -type l -exec rm \{\} \; |
73 | -rm Makefile.depend |
73 | -rm Makefile.depend |
74 | -$(MAKE) clean |
74 | -$(MAKE) clean |
75 | 75 | ||
76 | kernel.bin: $(arch_objects) $(objects) $(test_objects) |
76 | kernel.bin: $(arch_objects) $(objects) $(test_objects) ../arch/$(ARCH)/_link.ld |
77 | $(OBJCOPY) -I binary -O $(BFD_NAME) -B $(BFD_ARCH) --prefix-sections=symtab Makefile debug/empty_map.o |
77 | $(OBJCOPY) -I binary -O $(BFD_NAME) -B $(BFD_ARCH) --prefix-sections=symtab Makefile debug/empty_map.o |
78 | $(LD) $(LFLAGS) $(arch_objects) $(objects) $(test_objects) debug/empty_map.o -o $@ -Map kernel.map.pre |
78 | $(LD) -T ../arch/$(ARCH)/_link.ld $(LFLAGS) $(arch_objects) $(objects) $(test_objects) debug/empty_map.o -o $@ -Map kernel.map.pre |
79 | ../tools/genmap.py kernel.map.pre debug/real_map.bin |
79 | ../tools/genmap.py kernel.map.pre debug/real_map.bin |
80 | $(OBJCOPY) -I binary -O $(BFD_NAME) -B $(BFD_ARCH) --prefix-sections=symtab debug/real_map.bin debug/real_map.o |
80 | $(OBJCOPY) -I binary -O $(BFD_NAME) -B $(BFD_ARCH) --prefix-sections=symtab debug/real_map.bin debug/real_map.o |
81 | $(LD) $(LFLAGS) $(arch_objects) $(objects) $(test_objects) debug/real_map.o -o $@ -Map kernel.map |
81 | $(LD) -T ../arch/$(ARCH)/_link.ld $(LFLAGS) $(arch_objects) $(objects) $(test_objects) debug/real_map.o -o $@ -Map kernel.map |
82 | 82 | ||
83 | %.s: %.S |
83 | %.s: %.S |
84 | $(CC) $(CPPFLAGS) -E $< >$@ |
84 | $(CC) $(CPPFLAGS) -E $< >$@ |
85 | 85 | ||
86 | %.o: %.s |
86 | %.o: %.s |
87 | $(AS) $(ASFLAGS) $< -o $@ |
87 | $(AS) $(ASFLAGS) $< -o $@ |
88 | 88 | ||
89 | %.o: %.c |
89 | %.o: %.c |
90 | $(CC) $(CFLAGS) -c $< -o $@ |
90 | $(CC) $(CFLAGS) -c $< -o $@ |
91 | 91 | ||
92 | KS=`cat kernel.bin | wc -c` |
92 | KS=`cat kernel.bin | wc -c` |
93 | 93 | ||
94 | boot: |
94 | boot: |
95 | $(MAKE) -C ../arch/$(ARCH)/boot build KERNEL_SIZE=$(KS) |
95 | $(MAKE) -C ../arch/$(ARCH)/boot build KERNEL_SIZE=$(KS) |
96 | 96 |