Rev 350 | Rev 377 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 350 | Rev 376 | ||
---|---|---|---|
Line 1... | Line 1... | ||
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=src/cpu/cpu.c \ |
5 | main/main.c \ |
5 | src/main/main.c \ |
6 | main/kinit.c \ |
6 | src/main/kinit.c \ |
7 | main/uinit.c \ |
7 | src/main/uinit.c \ |
8 | proc/scheduler.c \ |
8 | src/proc/scheduler.c \ |
9 | proc/thread.c \ |
9 | src/proc/thread.c \ |
10 | proc/task.c \ |
10 | src/proc/task.c \ |
11 | proc/the.c \ |
11 | src/proc/the.c \ |
12 | mm/heap.c \ |
12 | src/mm/heap.c \ |
13 | mm/frame.c \ |
13 | src/mm/frame.c \ |
14 | mm/page.c \ |
14 | src/mm/page.c \ |
15 | mm/tlb.c \ |
15 | src/mm/tlb.c \ |
16 | mm/vm.c \ |
16 | src/mm/vm.c \ |
17 | lib/func.c \ |
17 | src/lib/func.c \ |
18 | lib/list.c \ |
18 | src/lib/list.c \ |
19 | lib/memstr.c \ |
19 | src/lib/memstr.c \ |
20 | lib/sort.c \ |
20 | src/lib/sort.c \ |
21 | debug/print.c \ |
21 | src/debug/print.c \ |
22 | debug/symtab.c \ |
22 | src/debug/symtab.c \ |
23 | time/clock.c \ |
23 | src/time/clock.c \ |
24 | time/timeout.c \ |
24 | src/time/timeout.c \ |
25 | time/delay.c \ |
25 | src/time/delay.c \ |
26 | preempt/preemption.c \ |
26 | src/preempt/preemption.c \ |
27 | synch/spinlock.c \ |
27 | src/synch/spinlock.c \ |
28 | synch/condvar.c \ |
28 | src/synch/condvar.c \ |
29 | synch/rwlock.c \ |
29 | src/synch/rwlock.c \ |
30 | synch/mutex.c \ |
30 | src/synch/mutex.c \ |
31 | synch/semaphore.c \ |
31 | src/synch/semaphore.c \ |
32 | synch/waitq.c \ |
32 | src/synch/waitq.c \ |
33 | smp/ipi.c \ |
33 | src/smp/ipi.c \ |
34 | fb/font-8x16.c |
34 | src/fb/font-8x16.c |
35 | 35 | ||
36 | # CFLAGS options same for all targets |
36 | # CFLAGS options same for all targets |
37 | CFLAGS+=-nostdinc -I../include -Werror-implicit-function-declaration -Wmissing-prototypes -Werror |
37 | CFLAGS+=-nostdinc -Iinclude/ -Werror-implicit-function-declaration -Wmissing-prototypes -Werror |
38 | 38 | ||
39 | ifdef DEBUG_SPINLOCK |
39 | ifdef DEBUG_SPINLOCK |
40 | CFLAGS+=-D$(DEBUG_SPINLOCK) |
40 | CFLAGS+=-D$(DEBUG_SPINLOCK) |
41 | endif |
41 | endif |
42 | 42 | ||
43 | ifdef USERSPACE |
43 | ifdef USERSPACE |
44 | CFLAGS+=-D$(USERSPACE) |
44 | CFLAGS+=-D$(USERSPACE) |
45 | endif |
45 | endif |
46 | 46 | ||
47 | ifdef TEST |
47 | ifdef TEST |
48 | test_objects:=$(addsuffix .o,$(basename ../test/$(TEST_DIR)/$(TEST_FILE))) |
48 | test_objects:=$(addsuffix .o,$(basename test/$(TEST_DIR)/$(TEST_FILE))) |
49 | CFLAGS+=-D$(TEST) |
49 | CFLAGS+=-D$(TEST) |
50 | endif |
50 | endif |
51 | arch_objects:=$(addsuffix .o,$(basename $(arch_sources))) |
51 | arch_objects:=$(addsuffix .o,$(basename $(arch_sources))) |
52 | objects:=$(addsuffix .o,$(basename $(sources))) |
52 | objects:=$(addsuffix .o,$(basename $(sources))) |
53 | 53 | ||
Line 56... | Line 56... | ||
56 | all: dist-clean config depend build |
56 | all: dist-clean config depend build |
57 | 57 | ||
58 | -include Makefile.depend |
58 | -include Makefile.depend |
59 | 59 | ||
60 | config: |
60 | config: |
61 | find . ../include -name arch -type l -exec rm \{\} \; |
61 | find src/ include/ -name arch -type l -exec rm \{\} \; |
62 | ln -s ../arch/$(ARCH)/src arch |
62 | ln -s ../arch/$(ARCH)/src/ src/arch |
63 | ln -s ../arch/$(ARCH)/include ../include/arch |
63 | ln -s ../arch/$(ARCH)/include/ include/arch |
64 | 64 | ||
65 | depend: |
65 | depend: |
66 | $(CC) $(CFLAGS) -M $(arch_sources) $(sources) >Makefile.depend |
66 | $(CC) $(CFLAGS) -M $(arch_sources) $(sources) >Makefile.depend |
67 | 67 | ||
68 | build: kernel.bin boot |
68 | build: kernel.bin boot |
69 | 69 | ||
70 | clean: |
70 | clean: |
71 | find . ../arch/$(ARCH)/src ../test -name '*.o' -exec rm \{\} \; |
71 | find src/ arch/$(ARCH)/src/ test/ -name '*.o' -exec rm \{\} \; |
72 | -rm *.bin kernel.map kernel.map.pre kernel.objdump debug/real_map.bin |
72 | -rm *.bin kernel.map kernel.map.pre kernel.objdump src/debug/real_map.bin |
73 | $(MAKE) -C ../arch/$(ARCH)/boot clean |
73 | $(MAKE) -C arch/$(ARCH)/boot/ clean |
74 | 74 | ||
75 | dist-clean: |
75 | dist-clean: |
76 | find . ../include -name arch -type l -exec rm \{\} \; |
76 | find src/ include/ -name arch -type l -exec rm \{\} \; |
77 | -rm Makefile.depend |
77 | -rm Makefile.depend |
78 | -$(MAKE) clean |
78 | -$(MAKE) clean |
79 | 79 | ||
80 | debug/real_map.bin: $(arch_objects) $(objects) $(test_objects) ../arch/$(ARCH)/_link.ld |
80 | src/debug/real_map.bin: $(arch_objects) $(objects) $(test_objects) arch/$(ARCH)/_link.ld |
81 | $(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 src/debug/empty_map.o |
82 | $(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) src/debug/empty_map.o -o $@ -Map kernel.map.pre |
83 | $(OBJDUMP) -t $(arch_objects) $(objects) $(test_objects) > kernel.objdump |
83 | $(OBJDUMP) -t $(arch_objects) $(objects) $(test_objects) > kernel.objdump |
84 | ../tools/genmap.py kernel.map.pre kernel.objdump debug/real_map.bin |
84 | tools/genmap.py kernel.map.pre kernel.objdump src/debug/real_map.bin |
85 | 85 | ||
86 | debug/real_map.o: debug/real_map.bin |
86 | src/debug/real_map.o: src/debug/real_map.bin |
87 | $(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 $< $@ |
88 | 88 | ||
89 | 89 | ||
90 | 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 src/debug/real_map.o |
91 | $(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) src/debug/real_map.o -o $@ -Map kernel.map |
92 | 92 | ||
93 | %.o: %.S |
93 | %.o: %.S |
94 | $(CC) $(ASFLAGS) $(CFLAGS) -c $< -o $@ |
94 | $(CC) $(ASFLAGS) $(CFLAGS) -c $< -o $@ |
95 | 95 | ||
96 | %.o: %.s |
96 | %.o: %.s |
Line 100... | Line 100... | ||
100 | $(CC) $(CFLAGS) -c $< -o $@ |
100 | $(CC) $(CFLAGS) -c $< -o $@ |
101 | 101 | ||
102 | KS=`cat kernel.bin | wc -c` |
102 | KS=`cat kernel.bin | wc -c` |
103 | 103 | ||
104 | boot: |
104 | boot: |
105 | $(MAKE) -C ../arch/$(ARCH)/boot build KERNEL_SIZE=$(KS) |
105 | $(MAKE) -C arch/$(ARCH)/boot build KERNEL_SIZE=$(KS) |