From 2b4d74005690b074ffe95f50e9f01fd70cd1e605 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Mon, 10 Nov 2025 23:19:38 -0500 Subject: initial commit Signed-off-by: Ian Moffett --- Makefile | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..cf4e41d --- /dev/null +++ b/Makefile @@ -0,0 +1,27 @@ +AS = nasm +CC = clang +CFILES = $(shell find src/ -name "*.c") +OFILES = $(CFILES:.c=.o) + +LDFLAGS = -nostdlib -Tlink.ld -no-pie +CFLAGS = -ffreestanding -nostdinc -fno-pic -mno-sse -mno-sse2 \ + -mno-mmx -mno-80387 -fno-stack-protector + +.PHONY: all +all: $(OFILES) stage1.bin stage2.bin + cat stage1.bin stage2.bin >boot.bin + +.PHONY: stage1.bin +stage1.bin: + $(AS) -fbin mbr/stage1.asm -o $@ + +.PHONY: stage2.bin +stage2.bin: + $(CC) $(LDFLAGS) $(OFILES) -o $@ + +%.o: %.c + $(CC) -c $(CFLAGS) $< -o $@ + +.PHONY: test +test: + qemu-system-i386 -hda boot.bin --enable-kvm -- cgit v1.2.3