-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
27 lines (19 loc) · 705 Bytes
/
Copy pathmakefile
File metadata and controls
27 lines (19 loc) · 705 Bytes
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
kernel := kernel.bin
linker_script := linker.ld
assembly_source_files := $(wildcard *.asm)
assembly_object_files := $(patsubst %.asm, build/%.o, $(assembly_source_files))
.PHONY: all clean kernel qemu qemu-gdb
all: $(kernel)
clean:
- @rm -fr build *.o $(kernel)
- @rm -f serial.log
qemu: $(kernel)
qemu-system-x86_64 -vga std -s -serial file:serial.log -kernel $(kernel)
qemu-gdb: $(kernel)
qemu-system-x86_64 -vga std -s -serial file:serial.log -S -kernel $(kernel)
$(kernel): $(assembly_object_files) $(linker_script)
ld -m elf_i386 -n -T $(linker_script) -o $(kernel) $(assembly_object_files)
#compile assembly files
build/%.o: %.asm
@mkdir -p $(shell dirname $@)
nasm -f elf32 $< -o $@