-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
40 lines (30 loc) · 1.14 KB
/
Makefile
File metadata and controls
40 lines (30 loc) · 1.14 KB
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
SOURCES = $(wildcard kernel/*.c kernel/*/*.c interrupts/*.c drivers/*.c drivers/*/*.c)
HEADERS = $(wildcard kernel/*.h kernel/*/*.c interrupts/*.h drivers/*.h drivers/*/*.h)
OBJ = ${SOURCES:.c=.o interrupts/interrupts.o}
CC = /usr/local/i386_elf_gcc/bin/i386-elf-gcc
GDB = /usr/local/i386_elf_gcc/bin/i386-elf-gdb
CFLAGS = -g
nardinos.bin: bootstrap.bin kernel.bin
cat $^ > nardinos.bin
kernel.bin: kernel/kernel_entry_point.o ${OBJ}
i386-elf-ld -o $@ -Ttext 0x1000 $^ --oformat binary
kernel.elf: kernel/kernel_entry_point.o ${OBJ}
i386-elf-ld -o $@ -Ttext 0x1000 $^
run: nardinos.bin
qemu-system-i386 -fda nardinos.bin
# Open the connection to qemu and load our kernel-object file with symbols
debug: nardinos.bin kernel.elf
qemu-system-i386 -s -fda nardinos.bin &
${GDB} -ex "target remote localhost:1234" -ex "symbol-file kernel.elf"
# Generic rules for wildcards
# To make an object, always compile from its .c
%.o: %.c ${HEADERS}
${CC} ${CFLAGS} -ffreestanding -c $< -o $@
%.o: %.asm
nasm $< -f elf -o $@
%.bin: %.asm
nasm $< -f bin -o $@
clean:
rm -f *.bin *.dis *.o nardinos.bin *.elf
rm -f `find . -name *.o`
rm -rf kernel/*.o drivers/*.o