Subversion Repositories HelenOS-historic

Rev

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

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