-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
28 lines (21 loc) · 696 Bytes
/
Makefile
File metadata and controls
28 lines (21 loc) · 696 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
28
.PHONY: run debug-run clean
run: clean xieu.iso
qemu-system-x86_64 -cdrom xieu.iso
debug-run: clean xieu.iso
qemu-system-x86_64 -cdrom xieu.iso \
-M accel=tcg,smm=off -d int -no-shutdown -s -S
xieu.iso: build/kernel.bin
mkdir -p iso-root/boot/grub
cp build/kernel.bin iso-root/boot/kernel.bin
cp grub.cfg iso-root/boot/grub/grub.cfg
grub2-mkrescue -o $@ iso-root
build/kernel.bin: build/boot.o build/main.o
gcc -T linker.ld -o $@ -ffreestanding -O2 -nostdlib $^ -lgcc
build/boot.o: src/boot.S
@mkdir -p build
as $< -o $@
build/main.o: src/main.c
@mkdir -p build
gcc -c $< -o $@ -std=gnu99 -ffreestanding -O2 -Wall -Wextra
clean:
rm -rf *.o kernel.bin xieu.iso iso-root build