Subversion Repositories HelenOS

Rev

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

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