Subversion Repositories HelenOS

Rev

Rev 421 | Rev 452 | 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
376 jermar 2
include arch/$(ARCH)/Makefile.inc
421 jermar 3
include genarch/Makefile.inc
1 jermar 4
 
430 jermar 5
sources=generic/src/cpu/cpu.c \
6
	generic/src/main/main.c \
7
	generic/src/main/kinit.c \
8
	generic/src/main/uinit.c \
9
	generic/src/proc/scheduler.c \
10
	generic/src/proc/thread.c \
11
	generic/src/proc/task.c \
12
	generic/src/proc/the.c \
13
	generic/src/mm/buddy.c \
14
	generic/src/mm/heap.c \
15
	generic/src/mm/frame.c \
16
	generic/src/mm/page.c \
17
	generic/src/mm/tlb.c \
18
	generic/src/mm/vm.c \
19
	generic/src/lib/func.c \
20
	generic/src/lib/list.c \
21
	generic/src/lib/memstr.c \
22
	generic/src/lib/sort.c \
23
	generic/src/debug/print.c \
24
	generic/src/debug/symtab.c \
25
	generic/src/time/clock.c \
26
	generic/src/time/timeout.c \
27
	generic/src/time/delay.c \
28
	generic/src/preempt/preemption.c \
29
	generic/src/synch/spinlock.c \
30
	generic/src/synch/condvar.c \
31
	generic/src/synch/rwlock.c \
32
	generic/src/synch/mutex.c \
33
	generic/src/synch/semaphore.c \
34
	generic/src/synch/waitq.c \
35
	generic/src/smp/ipi.c \
36
	generic/src/fb/font-8x16.c
1 jermar 37
 
326 palkovsky 38
# CFLAGS options same for all targets
430 jermar 39
CFLAGS+=-nostdinc -Igeneric/include/ -Werror-implicit-function-declaration -Wmissing-prototypes -Werror
326 palkovsky 40
 
1 jermar 41
ifdef DEBUG_SPINLOCK
42
CFLAGS+=-D$(DEBUG_SPINLOCK)
43
endif
44
 
34 jermar 45
ifdef USERSPACE
46
CFLAGS+=-D$(USERSPACE)
47
endif
48
 
1 jermar 49
ifdef TEST
376 jermar 50
test_objects:=$(addsuffix .o,$(basename test/$(TEST_DIR)/$(TEST_FILE)))
1 jermar 51
CFLAGS+=-D$(TEST)
52
endif
53
arch_objects:=$(addsuffix .o,$(basename $(arch_sources)))
421 jermar 54
genarch_objects:=$(addsuffix .o,$(basename $(genarch_sources)))
1 jermar 55
objects:=$(addsuffix .o,$(basename $(sources)))
56
 
57
.PHONY : all config depend build clean dist-clean boot
58
 
59
all: dist-clean config depend build
60
 
61
-include Makefile.depend
62
 
63
config:
430 jermar 64
	find generic/src/ generic/include/ -name arch -type l -exec rm \{\} \;
65
	find generic/src/ generic/include/ -name genarch -type l -exec rm \{\} \;	
66
	ln -s ../../arch/$(ARCH)/src/ generic/src/arch
67
	ln -s ../../arch/$(ARCH)/include/ generic/include/arch
68
	ln -s ../../genarch/src/ generic/src/genarch
69
	ln -s ../../genarch/include/ generic/include/genarch
1 jermar 70
 
71
depend:
421 jermar 72
	$(CC) $(CFLAGS) -M $(arch_sources) $(genarch_sources) $(sources) >Makefile.depend
1 jermar 73
 
74
build: kernel.bin boot
75
 
76
clean:
430 jermar 77
	find generic/src/ arch/$(ARCH)/src/ genarch/src/ test/ -name '*.o' -exec rm \{\} \;
78
	-rm *.bin kernel.map kernel.map.pre kernel.objdump generic/src/debug/real_map.bin
376 jermar 79
	$(MAKE) -C arch/$(ARCH)/boot/ clean
1 jermar 80
 
81
dist-clean:
430 jermar 82
	find generic/src/ generic/include/ -name arch -type l -exec rm \{\} \;
83
	find generic/src/ generic/include/ -name genarch -type l -exec rm \{\} \;	
1 jermar 84
	-rm Makefile.depend
85
	-$(MAKE) clean
86
 
430 jermar 87
generic/src/debug/real_map.bin: $(arch_objects) $(genarch_objects) $(objects) $(test_objects) arch/$(ARCH)/_link.ld 
88
	$(OBJCOPY) -I binary -O $(BFD_NAME) -B $(BFD_ARCH) --prefix-sections=symtab Makefile generic/src/debug/empty_map.o
89
	$(LD) -T arch/$(ARCH)/_link.ld $(LFLAGS) $(arch_objects) $(genarch_objects) $(objects) $(test_objects) generic/src/debug/empty_map.o -o $@ -Map kernel.map.pre
421 jermar 90
	$(OBJDUMP) -t $(arch_objects) $(genarch_objects) $(objects) $(test_objects) > kernel.objdump
430 jermar 91
	tools/genmap.py kernel.map.pre kernel.objdump generic/src/debug/real_map.bin 
293 palkovsky 92
 
430 jermar 93
generic/src/debug/real_map.o: generic/src/debug/real_map.bin
293 palkovsky 94
	$(OBJCOPY) -I binary -O $(BFD_NAME) -B $(BFD_ARCH) --prefix-sections=symtab $< $@
95
 
96
 
430 jermar 97
kernel.bin: $(arch_objects) $(genarch_objects) $(objects) $(test_objects) arch/$(ARCH)/_link.ld generic/src/debug/real_map.o
98
	$(LD) -T arch/$(ARCH)/_link.ld $(LFLAGS) $(arch_objects) $(genarch_objects) $(objects) $(test_objects) generic/src/debug/real_map.o -o $@ -Map kernel.map
1 jermar 99
 
314 palkovsky 100
%.o: %.S
101
	$(CC) $(ASFLAGS) $(CFLAGS) -c $< -o $@
1 jermar 102
 
103
%.o: %.s
76 jermar 104
	$(AS) $(ASFLAGS) $< -o $@
1 jermar 105
 
106
%.o: %.c
107
	$(CC) $(CFLAGS) -c $< -o $@
108
 
109
KS=`cat kernel.bin | wc -c`
110
 
111
boot:
376 jermar 112
	$(MAKE) -C arch/$(ARCH)/boot build KERNEL_SIZE=$(KS)