Subversion Repositories HelenOS-historic

Rev

Rev 314 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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