diff options
| author | Ian Moffett <ian@osmora.org> | 2025-11-10 23:19:38 -0500 |
|---|---|---|
| committer | Ian Moffett <ian@osmora.org> | 2025-11-10 23:19:38 -0500 |
| commit | 2b4d74005690b074ffe95f50e9f01fd70cd1e605 (patch) | |
| tree | 2cc959650ac50d5d131f046e23fb4b0a76bc1d72 /Makefile | |
initial commit
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 27 |
1 files changed, 27 insertions, 0 deletions
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 |
