Subversion Repositories HelenOS-historic

Rev

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

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