Subversion Repositories HelenOS

Rev

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

Rev 171 Rev 179
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
	debug/print.c \
19
	debug/print.c \
20
	time/clock.c \
20
	time/clock.c \
21
	time/timeout.c \
21
	time/timeout.c \
22
	time/delay.c \
22
	time/delay.c \
23
	preempt/preemption.c \
23
	preempt/preemption.c \
24
	synch/spinlock.c \
24
	synch/spinlock.c \
25
	synch/condvar.c \
25
	synch/condvar.c \
26
	synch/rwlock.c \
26
	synch/rwlock.c \
27
	synch/mutex.c \
27
	synch/mutex.c \
28
	synch/semaphore.c \
28
	synch/semaphore.c \
29
	synch/waitq.c \
29
	synch/waitq.c \
30
	smp/ipi.c
30
	smp/ipi.c \
-
 
31
	fb/font-8x16.c
31
 
32
 
32
ifdef DEBUG_SPINLOCK
33
ifdef DEBUG_SPINLOCK
33
CFLAGS+=-D$(DEBUG_SPINLOCK)
34
CFLAGS+=-D$(DEBUG_SPINLOCK)
34
endif
35
endif
35
 
36
 
36
ifdef USERSPACE
37
ifdef USERSPACE
37
CFLAGS+=-D$(USERSPACE)
38
CFLAGS+=-D$(USERSPACE)
38
endif
39
endif
39
 
40
 
40
ifdef TEST
41
ifdef TEST
41
test_objects:=$(addsuffix .o,$(basename ../test/$(TEST_DIR)/$(TEST_FILE)))
42
test_objects:=$(addsuffix .o,$(basename ../test/$(TEST_DIR)/$(TEST_FILE)))
42
CFLAGS+=-D$(TEST)
43
CFLAGS+=-D$(TEST)
43
endif
44
endif
44
arch_objects:=$(addsuffix .o,$(basename $(arch_sources)))
45
arch_objects:=$(addsuffix .o,$(basename $(arch_sources)))
45
objects:=$(addsuffix .o,$(basename $(sources)))
46
objects:=$(addsuffix .o,$(basename $(sources)))
46
 
47
 
47
.PHONY : all config depend build clean dist-clean boot
48
.PHONY : all config depend build clean dist-clean boot
48
 
49
 
49
all: dist-clean config depend build
50
all: dist-clean config depend build
50
 
51
 
51
-include Makefile.depend
52
-include Makefile.depend
52
 
53
 
53
config:
54
config:
54
	find . ../include -name arch -type l -exec rm \{\} \;
55
	find . ../include -name arch -type l -exec rm \{\} \;
55
	ln -s ../arch/$(ARCH)/src arch
56
	ln -s ../arch/$(ARCH)/src arch
56
	ln -s ../arch/$(ARCH)/include ../include/arch
57
	ln -s ../arch/$(ARCH)/include ../include/arch
57
 
58
 
58
depend:
59
depend:
59
	$(CC) $(CPPFLAGS) -M $(arch_sources) $(sources) >Makefile.depend
60
	$(CC) $(CPPFLAGS) -M $(arch_sources) $(sources) >Makefile.depend
60
 
61
 
61
build: kernel.bin boot
62
build: kernel.bin boot
62
 
63
 
63
clean:
64
clean:
64
	find . ../arch/$(ARCH)/src ../test -name '*.o' -exec rm \{\} \;
65
	find . ../arch/$(ARCH)/src ../test -name '*.o' -exec rm \{\} \;
65
	-rm *.bin kernel.map
66
	-rm *.bin kernel.map
66
	$(MAKE) -C ../arch/$(ARCH)/boot clean
67
	$(MAKE) -C ../arch/$(ARCH)/boot clean
67
 
68
 
68
dist-clean:
69
dist-clean:
69
	find . ../include -name arch -type l -exec rm \{\} \;
70
	find . ../include -name arch -type l -exec rm \{\} \;
70
	-rm Makefile.depend
71
	-rm Makefile.depend
71
	-$(MAKE) clean
72
	-$(MAKE) clean
72
 
73
 
73
kernel.bin: $(arch_objects) $(objects) $(test_objects)
74
kernel.bin: $(arch_objects) $(objects) $(test_objects)
74
	$(LD) $(LFLAGS) $(arch_objects) $(objects) $(test_objects) -o $@ -Map kernel.map
75
	$(LD) $(LFLAGS) $(arch_objects) $(objects) $(test_objects) -o $@ -Map kernel.map
75
 
76
 
76
%.s: %.S
77
%.s: %.S
77
	$(CC) $(CPPFLAGS) -E $< >$@
78
	$(CC) $(CPPFLAGS) -E $< >$@
78
 
79
 
79
%.o: %.s
80
%.o: %.s
80
	$(AS) $(ASFLAGS) $< -o $@
81
	$(AS) $(ASFLAGS) $< -o $@
81
 
82
 
82
%.o: %.c
83
%.o: %.c
83
	$(CC) $(CFLAGS) -c $< -o $@
84
	$(CC) $(CFLAGS) -c $< -o $@
84
 
85
 
85
KS=`cat kernel.bin | wc -c`
86
KS=`cat kernel.bin | wc -c`
86
 
87
 
87
boot:
88
boot:
88
	$(MAKE) -C ../arch/$(ARCH)/boot build KERNEL_SIZE=$(KS)
89
	$(MAKE) -C ../arch/$(ARCH)/boot build KERNEL_SIZE=$(KS)
89
 
90