Subversion Repositories HelenOS-historic

Rev

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