Subversion Repositories HelenOS-historic

Rev

Rev 59 | Rev 111 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 jermar 1
include Makefile.config
2
include ../arch/$(ARCH)/Makefile.inc
3
 
4
sources=cpu/cpu.c \
5
	main/main.c \
6
	main/kinit.c \
7
	main/uinit.c \
8
	proc/scheduler.c \
9
	proc/thread.c \
10
	proc/task.c \
11
	mm/heap.c \
12
	mm/frame.c \
13
	mm/page.c \
14
	mm/tlb.c \
15
	mm/vm.c \
16
	lib/func.c \
17
	lib/list.c \
59 jermar 18
	lib/memstr.c \
1 jermar 19
	debug/print.c \
20
	time/clock.c \
21
	time/timeout.c \
22
	time/delay.c \
23
	synch/spinlock.c \
24
	synch/condvar.c \
25
	synch/rwlock.c \
26
	synch/mutex.c \
27
	synch/semaphore.c \
10 jermar 28
	synch/waitq.c \
29
	smp/ipi.c
1 jermar 30
 
31
ifdef DEBUG_SPINLOCK
32
CFLAGS+=-D$(DEBUG_SPINLOCK)
33
endif
34
 
34 jermar 35
ifdef USERSPACE
36
CFLAGS+=-D$(USERSPACE)
37
endif
38
 
1 jermar 39
ifdef TEST
40
test_objects:=$(addsuffix .o,$(basename ../test/$(TEST_DIR)/$(TEST_FILE)))
41
CFLAGS+=-D$(TEST)
42
endif
43
arch_objects:=$(addsuffix .o,$(basename $(arch_sources)))
44
objects:=$(addsuffix .o,$(basename $(sources)))
45
 
46
.PHONY : all config depend build clean dist-clean boot
47
 
48
all: dist-clean config depend build
49
 
50
-include Makefile.depend
51
 
52
config:
53
	find . ../include -name arch -type l -exec rm \{\} \;
54
	ln -s ../arch/$(ARCH)/src arch
55
	ln -s ../arch/$(ARCH)/include ../include/arch
56
 
57
depend:
58
	$(CC) $(CPPFLAGS) -M $(arch_sources) $(sources) >Makefile.depend
59
 
60
build: kernel.bin boot
61
 
62
clean:
63
	find . ../arch/$(ARCH)/src ../test -name '*.o' -exec rm \{\} \;
64
	-rm *.bin kernel.map
65
	$(MAKE) -C ../arch/$(ARCH)/boot clean
66
 
67
dist-clean:
68
	find . ../include -name arch -type l -exec rm \{\} \;
69
	-rm Makefile.depend
70
	-$(MAKE) clean
71
 
72
kernel.bin: $(arch_objects) $(objects) $(test_objects)
73
	$(LD) $(LFLAGS) $(arch_objects) $(objects) $(test_objects) -o $@ >kernel.map
74
 
75
%.s: %.S
76
	$(CC) $(CPPFLAGS) -E $< >$@
77
 
78
%.o: %.s
76 jermar 79
	$(AS) $(ASFLAGS) $< -o $@
1 jermar 80
 
81
%.o: %.c
82
	$(CC) $(CFLAGS) -c $< -o $@
83
 
84
KS=`cat kernel.bin | wc -c`
85
 
86
boot:
87
	$(MAKE) -C ../arch/$(ARCH)/boot build KERNEL_SIZE=$(KS)