kern/Makefile

40 lines
735 B
Makefile
Raw Normal View History

### Copyright (c) 2025 Freya Murphy <freya@freyacat.org>
2025-03-25 17:36:52 -04:00
.PHONY: build fmt clean qemu
2025-03-25 17:41:18 -04:00
.SILENT:
2025-03-25 17:36:52 -04:00
2025-03-26 23:55:20 -04:00
UNAME := $(shell uname)
QEMU = qemu-system-x86_64
2025-04-03 14:39:21 -04:00
QEMUOPTS = -cdrom bin/os.iso \
2025-03-27 14:50:33 -04:00
-no-reboot \
2025-03-25 18:00:51 -04:00
-serial mon:stdio \
-m 4G \
-name kern
2025-03-25 17:36:52 -04:00
2025-04-03 14:39:21 -04:00
qemu: bin/os.iso
2025-03-25 18:00:51 -04:00
$(QEMU) $(QEMUOPTS)
2025-03-25 17:36:52 -04:00
2025-04-03 14:39:21 -04:00
qemu-gdb: bin/os.iso
2025-03-25 18:00:51 -04:00
$(QEMU) $(QEMUOPTS) -S -gdb tcp::1337
gdb:
gdb -q -n -x util/gdbinit
2025-03-25 17:36:52 -04:00
clean:
2025-03-25 17:41:18 -04:00
rm -fr .zig-cache
rm -fr bin
build:
zig build
2025-03-25 17:36:52 -04:00
2025-04-03 14:39:21 -04:00
bin/os.iso: build
mkdir -p bin/iso/boot/grub
cp grub.cfg bin/iso/boot/grub
cp bin/kernel bin/iso/boot
2025-04-03 21:24:27 -04:00
grub-mkrescue -o bin/os.iso bin/iso 2>/dev/null
2025-04-03 14:39:21 -04:00
fmt:
clang-format -i $(shell find -type f -name "*.[ch]")
2025-03-27 14:35:29 -04:00
sed -i 's/[ \t]*$$//' $(shell find -type f -name "*.[chS]" -or -name "*.ld")