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