Rev 377 | Rev 430 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 377 | Rev 421 | ||
---|---|---|---|
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 | include genarch/Makefile.inc |
|
3 | 4 | ||
4 | sources=src/cpu/cpu.c \ |
5 | sources=src/cpu/cpu.c \ |
5 | src/main/main.c \ |
6 | src/main/main.c \ |
6 | src/main/kinit.c \ |
7 | src/main/kinit.c \ |
7 | src/main/uinit.c \ |
8 | src/main/uinit.c \ |
Line 48... | Line 49... | ||
48 | ifdef TEST |
49 | ifdef TEST |
49 | test_objects:=$(addsuffix .o,$(basename test/$(TEST_DIR)/$(TEST_FILE))) |
50 | test_objects:=$(addsuffix .o,$(basename test/$(TEST_DIR)/$(TEST_FILE))) |
50 | CFLAGS+=-D$(TEST) |
51 | CFLAGS+=-D$(TEST) |
51 | endif |
52 | endif |
52 | arch_objects:=$(addsuffix .o,$(basename $(arch_sources))) |
53 | arch_objects:=$(addsuffix .o,$(basename $(arch_sources))) |
- | 54 | genarch_objects:=$(addsuffix .o,$(basename $(genarch_sources))) |
|
53 | objects:=$(addsuffix .o,$(basename $(sources))) |
55 | objects:=$(addsuffix .o,$(basename $(sources))) |
54 | 56 | ||
55 | .PHONY : all config depend build clean dist-clean boot |
57 | .PHONY : all config depend build clean dist-clean boot |
56 | 58 | ||
57 | all: dist-clean config depend build |
59 | all: dist-clean config depend build |
58 | 60 | ||
59 | -include Makefile.depend |
61 | -include Makefile.depend |
60 | 62 | ||
61 | config: |
63 | config: |
62 | find src/ include/ -name arch -type l -exec rm \{\} \; |
64 | find src/ include/ -name arch -type l -exec rm \{\} \; |
- | 65 | find src/ include/ -name genarch -type l -exec rm \{\} \; |
|
63 | ln -s ../arch/$(ARCH)/src/ src/arch |
66 | ln -s ../arch/$(ARCH)/src/ src/arch |
64 | ln -s ../arch/$(ARCH)/include/ include/arch |
67 | ln -s ../arch/$(ARCH)/include/ include/arch |
- | 68 | ln -s ../genarch/src/ src/genarch |
|
- | 69 | ln -s ../genarch/include/ include/genarch |
|
65 | 70 | ||
66 | depend: |
71 | depend: |
67 | $(CC) $(CFLAGS) -M $(arch_sources) $(sources) >Makefile.depend |
72 | $(CC) $(CFLAGS) -M $(arch_sources) $(genarch_sources) $(sources) >Makefile.depend |
68 | 73 | ||
69 | build: kernel.bin boot |
74 | build: kernel.bin boot |
70 | 75 | ||
71 | clean: |
76 | clean: |
72 | find src/ arch/$(ARCH)/src/ test/ -name '*.o' -exec rm \{\} \; |
77 | find src/ arch/$(ARCH)/src/ genarch/src/ test/ -name '*.o' -exec rm \{\} \; |
73 | -rm *.bin kernel.map kernel.map.pre kernel.objdump src/debug/real_map.bin |
78 | -rm *.bin kernel.map kernel.map.pre kernel.objdump src/debug/real_map.bin |
74 | $(MAKE) -C arch/$(ARCH)/boot/ clean |
79 | $(MAKE) -C arch/$(ARCH)/boot/ clean |
75 | 80 | ||
76 | dist-clean: |
81 | dist-clean: |
77 | find src/ include/ -name arch -type l -exec rm \{\} \; |
82 | find src/ include/ -name arch -type l -exec rm \{\} \; |
- | 83 | find src/ include/ -name genarch -type l -exec rm \{\} \; |
|
78 | -rm Makefile.depend |
84 | -rm Makefile.depend |
79 | -$(MAKE) clean |
85 | -$(MAKE) clean |
80 | 86 | ||
81 | src/debug/real_map.bin: $(arch_objects) $(objects) $(test_objects) arch/$(ARCH)/_link.ld |
87 | src/debug/real_map.bin: $(arch_objects) $(genarch_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 |
88 | $(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 |
89 | $(LD) -T arch/$(ARCH)/_link.ld $(LFLAGS) $(arch_objects) $(genarch_objects) $(objects) $(test_objects) src/debug/empty_map.o -o $@ -Map kernel.map.pre |
84 | $(OBJDUMP) -t $(arch_objects) $(objects) $(test_objects) > kernel.objdump |
90 | $(OBJDUMP) -t $(arch_objects) $(genarch_objects) $(objects) $(test_objects) > kernel.objdump |
85 | tools/genmap.py kernel.map.pre kernel.objdump src/debug/real_map.bin |
91 | tools/genmap.py kernel.map.pre kernel.objdump src/debug/real_map.bin |
86 | 92 | ||
87 | src/debug/real_map.o: src/debug/real_map.bin |
93 | src/debug/real_map.o: src/debug/real_map.bin |
88 | $(OBJCOPY) -I binary -O $(BFD_NAME) -B $(BFD_ARCH) --prefix-sections=symtab $< $@ |
94 | $(OBJCOPY) -I binary -O $(BFD_NAME) -B $(BFD_ARCH) --prefix-sections=symtab $< $@ |
89 | 95 | ||
90 | 96 | ||
91 | kernel.bin: $(arch_objects) $(objects) $(test_objects) arch/$(ARCH)/_link.ld src/debug/real_map.o |
97 | kernel.bin: $(arch_objects) $(genarch_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 |
98 | $(LD) -T arch/$(ARCH)/_link.ld $(LFLAGS) $(arch_objects) $(genarch_objects) $(objects) $(test_objects) src/debug/real_map.o -o $@ -Map kernel.map |
93 | 99 | ||
94 | %.o: %.S |
100 | %.o: %.S |
95 | $(CC) $(ASFLAGS) $(CFLAGS) -c $< -o $@ |
101 | $(CC) $(ASFLAGS) $(CFLAGS) -c $< -o $@ |
96 | 102 | ||
97 | %.o: %.s |
103 | %.o: %.s |