source: mainline/Makefile@ c9ed176

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since c9ed176 was c9ed176, checked in by Jakub Jermar <jakub@…>, 20 years ago

Move kernel build files one level up the directory tree.
Fix paths in your testing environment!

  • Property mode set to 100644
File size: 2.8 KB
Line 
1include Makefile.config
2include arch/$(ARCH)/Makefile.inc
3
4sources=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 \
12 src/mm/heap.c \
13 src/mm/frame.c \
14 src/mm/page.c \
15 src/mm/tlb.c \
16 src/mm/vm.c \
17 src/lib/func.c \
18 src/lib/list.c \
19 src/lib/memstr.c \
20 src/lib/sort.c \
21 src/debug/print.c \
22 src/debug/symtab.c \
23 src/time/clock.c \
24 src/time/timeout.c \
25 src/time/delay.c \
26 src/preempt/preemption.c \
27 src/synch/spinlock.c \
28 src/synch/condvar.c \
29 src/synch/rwlock.c \
30 src/synch/mutex.c \
31 src/synch/semaphore.c \
32 src/synch/waitq.c \
33 src/smp/ipi.c \
34 src/fb/font-8x16.c
35
36# CFLAGS options same for all targets
37CFLAGS+=-nostdinc -Iinclude/ -Werror-implicit-function-declaration -Wmissing-prototypes -Werror
38
39ifdef DEBUG_SPINLOCK
40CFLAGS+=-D$(DEBUG_SPINLOCK)
41endif
42
43ifdef USERSPACE
44CFLAGS+=-D$(USERSPACE)
45endif
46
47ifdef TEST
48test_objects:=$(addsuffix .o,$(basename test/$(TEST_DIR)/$(TEST_FILE)))
49CFLAGS+=-D$(TEST)
50endif
51arch_objects:=$(addsuffix .o,$(basename $(arch_sources)))
52objects:=$(addsuffix .o,$(basename $(sources)))
53
54.PHONY : all config depend build clean dist-clean boot
55
56all: dist-clean config depend build
57
58-include Makefile.depend
59
60config:
61 find src/ include/ -name arch -type l -exec rm \{\} \;
62 ln -s ../arch/$(ARCH)/src/ src/arch
63 ln -s ../arch/$(ARCH)/include/ include/arch
64
65depend:
66 $(CC) $(CFLAGS) -M $(arch_sources) $(sources) >Makefile.depend
67
68build: kernel.bin boot
69
70clean:
71 find src/ arch/$(ARCH)/src/ test/ -name '*.o' -exec rm \{\} \;
72 -rm *.bin kernel.map kernel.map.pre kernel.objdump src/debug/real_map.bin
73 $(MAKE) -C arch/$(ARCH)/boot/ clean
74
75dist-clean:
76 find src/ include/ -name arch -type l -exec rm \{\} \;
77 -rm Makefile.depend
78 -$(MAKE) clean
79
80src/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 src/debug/empty_map.o
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
84 tools/genmap.py kernel.map.pre kernel.objdump src/debug/real_map.bin
85
86src/debug/real_map.o: src/debug/real_map.bin
87 $(OBJCOPY) -I binary -O $(BFD_NAME) -B $(BFD_ARCH) --prefix-sections=symtab $< $@
88
89
90kernel.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) src/debug/real_map.o -o $@ -Map kernel.map
92
93%.o: %.S
94 $(CC) $(ASFLAGS) $(CFLAGS) -c $< -o $@
95
96%.o: %.s
97 $(AS) $(ASFLAGS) $< -o $@
98
99%.o: %.c
100 $(CC) $(CFLAGS) -c $< -o $@
101
102KS=`cat kernel.bin | wc -c`
103
104boot:
105 $(MAKE) -C arch/$(ARCH)/boot build KERNEL_SIZE=$(KS)
Note: See TracBrowser for help on using the repository browser.