Subversion Repositories HelenOS-historic

Rev

Rev 289 | Rev 314 | 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
 
35
ifdef DEBUG_SPINLOCK
36
CFLAGS+=-D$(DEBUG_SPINLOCK)
37
endif
38
 
34 jermar 39
ifdef USERSPACE
40
CFLAGS+=-D$(USERSPACE)
41
endif
42
 
1 jermar 43
ifdef TEST
44
test_objects:=$(addsuffix .o,$(basename ../test/$(TEST_DIR)/$(TEST_FILE)))
45
CFLAGS+=-D$(TEST)
46
endif
47
arch_objects:=$(addsuffix .o,$(basename $(arch_sources)))
48
objects:=$(addsuffix .o,$(basename $(sources)))
49
 
50
.PHONY : all config depend build clean dist-clean boot
51
 
52
all: dist-clean config depend build
53
 
54
-include Makefile.depend
55
 
56
config:
57
	find . ../include -name arch -type l -exec rm \{\} \;
58
	ln -s ../arch/$(ARCH)/src arch
59
	ln -s ../arch/$(ARCH)/include ../include/arch
60
 
61
depend:
62
	$(CC) $(CPPFLAGS) -M $(arch_sources) $(sources) >Makefile.depend
63
 
64
build: kernel.bin boot
65
 
66
clean:
67
	find . ../arch/$(ARCH)/src ../test -name '*.o' -exec rm \{\} \;
293 palkovsky 68
	-rm *.bin kernel.map kernel.map.pre kernel.objdump debug/real_map.bin
1 jermar 69
	$(MAKE) -C ../arch/$(ARCH)/boot clean
70
 
71
dist-clean:
72
	find . ../include -name arch -type l -exec rm \{\} \;
73
	-rm Makefile.depend
74
	-$(MAKE) clean
75
 
293 palkovsky 76
debug/real_map.bin: $(arch_objects) $(objects) $(test_objects) ../arch/$(ARCH)/_link.ld 
268 palkovsky 77
	$(OBJCOPY) -I binary -O $(BFD_NAME) -B $(BFD_ARCH) --prefix-sections=symtab Makefile debug/empty_map.o
289 palkovsky 78
	$(LD) -T ../arch/$(ARCH)/_link.ld $(LFLAGS) $(arch_objects) $(objects) $(test_objects) debug/empty_map.o -o $@ -Map kernel.map.pre
293 palkovsky 79
	$(OBJDUMP) -t $(arch_objects) $(objects) $(test_objects) > kernel.objdump
80
	../tools/genmap.py kernel.map.pre kernel.objdump debug/real_map.bin 
81
 
82
debug/real_map.o: debug/real_map.bin
83
	$(OBJCOPY) -I binary -O $(BFD_NAME) -B $(BFD_ARCH) --prefix-sections=symtab $< $@
84
 
85
 
86
kernel.bin: $(arch_objects) $(objects) $(test_objects) ../arch/$(ARCH)/_link.ld debug/real_map.o
289 palkovsky 87
	$(LD) -T ../arch/$(ARCH)/_link.ld $(LFLAGS) $(arch_objects) $(objects) $(test_objects) debug/real_map.o -o $@ -Map kernel.map
1 jermar 88
 
89
%.s: %.S
90
	$(CC) $(CPPFLAGS) -E $< >$@
91
 
92
%.o: %.s
76 jermar 93
	$(AS) $(ASFLAGS) $< -o $@
1 jermar 94
 
95
%.o: %.c
96
	$(CC) $(CFLAGS) -c $< -o $@
97
 
98
KS=`cat kernel.bin | wc -c`
99
 
100
boot:
101
	$(MAKE) -C ../arch/$(ARCH)/boot build KERNEL_SIZE=$(KS)