source: mainline/src/Makefile@ 54ca3523

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

For each architecture, add function/macro FADDR that calculates absolute address of a function referenced by void (* f)(void).
IA-32 and MIPS gcc's use direct addressing (f == FADDR(f)) while IA-64 gcc uses indirect addressing (f != FADDR(f)).

Tweaks in IA-64 Makefile.inc to declare constant gp and main Makefile to consider ASFLAGS when compiling .s targets.

  • Property mode set to 100644
File size: 1.7 KB
Line 
1include Makefile.config
2include ../arch/$(ARCH)/Makefile.inc
3
4sources=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 \
18 lib/memstr.c \
19 debug/print.c \
20 time/clock.c \
21 time/timeout.c \
22 time/delay.c \
23 synch/spinlock.c \
24 synch/condvar.c \
25 synch/rwlock.c \
26 synch/mutex.c \
27 synch/semaphore.c \
28 synch/waitq.c \
29 smp/ipi.c
30
31ifdef DEBUG_SPINLOCK
32CFLAGS+=-D$(DEBUG_SPINLOCK)
33endif
34
35ifdef USERSPACE
36CFLAGS+=-D$(USERSPACE)
37endif
38
39ifdef TEST
40test_objects:=$(addsuffix .o,$(basename ../test/$(TEST_DIR)/$(TEST_FILE)))
41CFLAGS+=-D$(TEST)
42endif
43arch_objects:=$(addsuffix .o,$(basename $(arch_sources)))
44objects:=$(addsuffix .o,$(basename $(sources)))
45
46.PHONY : all config depend build clean dist-clean boot
47
48all: dist-clean config depend build
49
50-include Makefile.depend
51
52config:
53 find . ../include -name arch -type l -exec rm \{\} \;
54 ln -s ../arch/$(ARCH)/src arch
55 ln -s ../arch/$(ARCH)/include ../include/arch
56
57depend:
58 $(CC) $(CPPFLAGS) -M $(arch_sources) $(sources) >Makefile.depend
59
60build: kernel.bin boot
61
62clean:
63 find . ../arch/$(ARCH)/src ../test -name '*.o' -exec rm \{\} \;
64 -rm *.bin kernel.map
65 $(MAKE) -C ../arch/$(ARCH)/boot clean
66
67dist-clean:
68 find . ../include -name arch -type l -exec rm \{\} \;
69 -rm Makefile.depend
70 -$(MAKE) clean
71
72kernel.bin: $(arch_objects) $(objects) $(test_objects)
73 $(LD) $(LFLAGS) $(arch_objects) $(objects) $(test_objects) -o $@ >kernel.map
74
75%.s: %.S
76 $(CC) $(CPPFLAGS) -E $< >$@
77
78%.o: %.s
79 $(AS) $(ASFLAGS) $< -o $@
80
81%.o: %.c
82 $(CC) $(CFLAGS) -c $< -o $@
83
84KS=`cat kernel.bin | wc -c`
85
86boot:
87 $(MAKE) -C ../arch/$(ARCH)/boot build KERNEL_SIZE=$(KS)
Note: See TracBrowser for help on using the repository browser.