Rev 326 | Rev 350 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 326 | Rev 331 | ||
---|---|---|---|
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 | lib/sort.c \ |
|
20 | debug/print.c \ |
21 | debug/print.c \ |
21 | debug/symtab.c \ |
22 | debug/symtab.c \ |
22 | time/clock.c \ |
23 | time/clock.c \ |
23 | time/timeout.c \ |
24 | time/timeout.c \ |
24 | time/delay.c \ |
25 | time/delay.c \ |
25 | preempt/preemption.c \ |
26 | preempt/preemption.c \ |
26 | synch/spinlock.c \ |
27 | synch/spinlock.c \ |
27 | synch/condvar.c \ |
28 | synch/condvar.c \ |
28 | synch/rwlock.c \ |
29 | synch/rwlock.c \ |
29 | synch/mutex.c \ |
30 | synch/mutex.c \ |
30 | synch/semaphore.c \ |
31 | synch/semaphore.c \ |
31 | synch/waitq.c \ |
32 | synch/waitq.c \ |
32 | smp/ipi.c \ |
33 | smp/ipi.c \ |
33 | fb/font-8x16.c |
34 | fb/font-8x16.c |
34 | 35 | ||
35 | # CFLAGS options same for all targets |
36 | # CFLAGS options same for all targets |
36 | CFLAGS+=-nostdinc -I../include -Werror-implicit-function-declaration -Wmissing-prototypes -Werror |
37 | CFLAGS+=-nostdinc -I../include -Werror-implicit-function-declaration -Wmissing-prototypes -Werror |
37 | 38 | ||
38 | ifdef DEBUG_SPINLOCK |
39 | ifdef DEBUG_SPINLOCK |
39 | CFLAGS+=-D$(DEBUG_SPINLOCK) |
40 | CFLAGS+=-D$(DEBUG_SPINLOCK) |
40 | endif |
41 | endif |
41 | 42 | ||
42 | ifdef USERSPACE |
43 | ifdef USERSPACE |
43 | CFLAGS+=-D$(USERSPACE) |
44 | CFLAGS+=-D$(USERSPACE) |
44 | endif |
45 | endif |
45 | 46 | ||
46 | ifdef TEST |
47 | ifdef TEST |
47 | test_objects:=$(addsuffix .o,$(basename ../test/$(TEST_DIR)/$(TEST_FILE))) |
48 | test_objects:=$(addsuffix .o,$(basename ../test/$(TEST_DIR)/$(TEST_FILE))) |
48 | CFLAGS+=-D$(TEST) |
49 | CFLAGS+=-D$(TEST) |
49 | endif |
50 | endif |
50 | arch_objects:=$(addsuffix .o,$(basename $(arch_sources))) |
51 | arch_objects:=$(addsuffix .o,$(basename $(arch_sources))) |
51 | objects:=$(addsuffix .o,$(basename $(sources))) |
52 | objects:=$(addsuffix .o,$(basename $(sources))) |
52 | 53 | ||
53 | .PHONY : all config depend build clean dist-clean boot |
54 | .PHONY : all config depend build clean dist-clean boot |
54 | 55 | ||
55 | all: dist-clean config depend build |
56 | all: dist-clean config depend build |
56 | 57 | ||
57 | -include Makefile.depend |
58 | -include Makefile.depend |
58 | 59 | ||
59 | config: |
60 | config: |
60 | find . ../include -name arch -type l -exec rm \{\} \; |
61 | find . ../include -name arch -type l -exec rm \{\} \; |
61 | ln -s ../arch/$(ARCH)/src arch |
62 | ln -s ../arch/$(ARCH)/src arch |
62 | ln -s ../arch/$(ARCH)/include ../include/arch |
63 | ln -s ../arch/$(ARCH)/include ../include/arch |
63 | 64 | ||
64 | depend: |
65 | depend: |
65 | $(CC) $(CFLAGS) -M $(arch_sources) $(sources) >Makefile.depend |
66 | $(CC) $(CFLAGS) -M $(arch_sources) $(sources) >Makefile.depend |
66 | 67 | ||
67 | build: kernel.bin boot |
68 | build: kernel.bin boot |
68 | 69 | ||
69 | clean: |
70 | clean: |
70 | find . ../arch/$(ARCH)/src ../test -name '*.o' -exec rm \{\} \; |
71 | find . ../arch/$(ARCH)/src ../test -name '*.o' -exec rm \{\} \; |
71 | -rm *.bin kernel.map kernel.map.pre kernel.objdump debug/real_map.bin |
72 | -rm *.bin kernel.map kernel.map.pre kernel.objdump debug/real_map.bin |
72 | $(MAKE) -C ../arch/$(ARCH)/boot clean |
73 | $(MAKE) -C ../arch/$(ARCH)/boot clean |
73 | 74 | ||
74 | dist-clean: |
75 | dist-clean: |
75 | find . ../include -name arch -type l -exec rm \{\} \; |
76 | find . ../include -name arch -type l -exec rm \{\} \; |
76 | -rm Makefile.depend |
77 | -rm Makefile.depend |
77 | -$(MAKE) clean |
78 | -$(MAKE) clean |
78 | 79 | ||
79 | debug/real_map.bin: $(arch_objects) $(objects) $(test_objects) ../arch/$(ARCH)/_link.ld |
80 | debug/real_map.bin: $(arch_objects) $(objects) $(test_objects) ../arch/$(ARCH)/_link.ld |
80 | $(OBJCOPY) -I binary -O $(BFD_NAME) -B $(BFD_ARCH) --prefix-sections=symtab Makefile debug/empty_map.o |
81 | $(OBJCOPY) -I binary -O $(BFD_NAME) -B $(BFD_ARCH) --prefix-sections=symtab Makefile debug/empty_map.o |
81 | $(LD) -T ../arch/$(ARCH)/_link.ld $(LFLAGS) $(arch_objects) $(objects) $(test_objects) debug/empty_map.o -o $@ -Map kernel.map.pre |
82 | $(LD) -T ../arch/$(ARCH)/_link.ld $(LFLAGS) $(arch_objects) $(objects) $(test_objects) debug/empty_map.o -o $@ -Map kernel.map.pre |
82 | $(OBJDUMP) -t $(arch_objects) $(objects) $(test_objects) > kernel.objdump |
83 | $(OBJDUMP) -t $(arch_objects) $(objects) $(test_objects) > kernel.objdump |
83 | ../tools/genmap.py kernel.map.pre kernel.objdump debug/real_map.bin |
84 | ../tools/genmap.py kernel.map.pre kernel.objdump debug/real_map.bin |
84 | 85 | ||
85 | debug/real_map.o: debug/real_map.bin |
86 | debug/real_map.o: debug/real_map.bin |
86 | $(OBJCOPY) -I binary -O $(BFD_NAME) -B $(BFD_ARCH) --prefix-sections=symtab $< $@ |
87 | $(OBJCOPY) -I binary -O $(BFD_NAME) -B $(BFD_ARCH) --prefix-sections=symtab $< $@ |
87 | 88 | ||
88 | 89 | ||
89 | kernel.bin: $(arch_objects) $(objects) $(test_objects) ../arch/$(ARCH)/_link.ld debug/real_map.o |
90 | kernel.bin: $(arch_objects) $(objects) $(test_objects) ../arch/$(ARCH)/_link.ld debug/real_map.o |
90 | $(LD) -T ../arch/$(ARCH)/_link.ld $(LFLAGS) $(arch_objects) $(objects) $(test_objects) debug/real_map.o -o $@ -Map kernel.map |
91 | $(LD) -T ../arch/$(ARCH)/_link.ld $(LFLAGS) $(arch_objects) $(objects) $(test_objects) debug/real_map.o -o $@ -Map kernel.map |
91 | 92 | ||
92 | %.o: %.S |
93 | %.o: %.S |
93 | $(CC) $(ASFLAGS) $(CFLAGS) -c $< -o $@ |
94 | $(CC) $(ASFLAGS) $(CFLAGS) -c $< -o $@ |
94 | 95 | ||
95 | %.o: %.s |
96 | %.o: %.s |
96 | $(AS) $(ASFLAGS) $< -o $@ |
97 | $(AS) $(ASFLAGS) $< -o $@ |
97 | 98 | ||
98 | %.o: %.c |
99 | %.o: %.c |
99 | $(CC) $(CFLAGS) -c $< -o $@ |
100 | $(CC) $(CFLAGS) -c $< -o $@ |
100 | 101 | ||
101 | KS=`cat kernel.bin | wc -c` |
102 | KS=`cat kernel.bin | wc -c` |
102 | 103 | ||
103 | boot: |
104 | boot: |
104 | $(MAKE) -C ../arch/$(ARCH)/boot build KERNEL_SIZE=$(KS) |
105 | $(MAKE) -C ../arch/$(ARCH)/boot build KERNEL_SIZE=$(KS) |
105 | 106 |