-
Notifications
You must be signed in to change notification settings - Fork 110
/
Makefile
54 lines (38 loc) · 1.38 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
include Makefile.config
LIBRARY_SOURCES=$(wildcard library/*.c)
LIBRARY_HEADERS=$(wildcard library/*.h)
USER_SOURCES=$(wildcard user/*.c)
USER_PROGRAMS=$(USER_SOURCES:c=exe)
KERNEL_SOURCES=$(wildcard kernel/*.[chS])
WORDS=/usr/share/dict/words
.PHONY: build-kernel build-library build-userspace build-cdrom-image
all: build-cdrom-image
build-kernel: kernel/basekernel.img
build-library: library/baselib.a
build-userspace: $(USER_PROGRAMS)
build-cdrom-image: basekernel.iso
kernel/basekernel.img: $(KERNEL_SOURCES) $(LIBRARY_HEADERS)
cd kernel && make
library/baselib.a: $(LIBRARY_SOURCES) $(LIBRARY_HEADERS)
cd library && make
$(USER_PROGRAMS): $(USER_SOURCES) library/baselib.a $(LIBRARY_HEADERS)
cd user && make
image: kernel/basekernel.img $(USER_PROGRAMS)
rm -rf image
mkdir image image/boot image/bin image/data
cp kernel/basekernel.img image/boot
cp $(USER_PROGRAMS) image/bin
if [ -f ${WORDS} ]; then head -2000 ${WORDS} > image/data/words; fi
basekernel.iso: image
${ISOGEN} -input-charset utf-8 -iso-level 2 -J -R -o $@ -b boot/basekernel.img image
disk.img:
qemu-img create disk.img 10M
run: basekernel.iso disk.img
qemu-system-i386 -cdrom basekernel.iso -hda disk.img
debug: basekernel.iso disk.img
qemu-system-i386 -cdrom basekernel.iso -hda disk.img -s -S &
clean:
rm -rf basekernel.iso image disk.img
cd kernel && make clean
cd library && make clean
cd user && make clean