-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
47 lines (31 loc) · 834 Bytes
/
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
GCC = i686-elf-gcc
ASM = nasm
LD = i686-elf-ld
INCLUDE = include
CFLAGS = -ffreestanding -O2 -Wall -Wextra -I include/
LDFLAGS = -ffreestanding -O2 -nostdlib
C_SOURCES = ${wildcard *.c */*.c */*/*.c */*/*/*.c}
H_SOURCES = ${wildcard *.h */*.h */*/*.h */*/*/*.h}
ASM_SOURCES = ${wildcard *.asm */*.asm */*/*.asm */*/*/*.asm}
OBJ = ${C_SOURCES:.c=.o} ${ASM_SOURCES:.asm=.o}
TOOLS = tools
BUILD = build
.PHONY: all
%.o: %.asm
nasm -f elf32 $< -o $@
%.o: %.c
${GCC} ${CFLAGS} -c -g $< -o $@
kernel.elf: linker.ld ${OBJ}
${GCC} -T linker.ld -o ${BUILD}/$@ ${LDFLAGS} ${OBJ}
update_disk: kernel.elf
bash ./update_disk.sh
run: update_disk
qemu-system-i386 -hda disk.img
all: run FORCE
FORCE: ;
makedisk:
bash ./makedisk.sh
debug: FORCE
bash ./debug.sh
clean:
rm -rf *.o */*.o */*/*.o */*/*/*.o build/*