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