diff options
| author | Elizabeth Alexander Hunt <me@liz.coffee> | 2026-09-28 21:08:07 -0700 |
|---|---|---|
| committer | Elizabeth Alexander Hunt <me@liz.coffee> | 2026-09-28 21:08:07 -0700 |
| commit | f2899b62b997aafc25666f21ea3a754030a8de71 (patch) | |
| tree | 9503136c7639d8478ff90977870f99046a4524f8 /Makefile | |
| download | helloOS-main.tar.gz helloOS-main.zip | |
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c06ff32 --- /dev/null +++ b/Makefile @@ -0,0 +1,30 @@ +.DEFAULT_GOAL := os.iso +.PHONY: demo + +OBJECTS=entry.o kernel.o +KERNEL_BUILD_FLAGS=-std=c99 -ffreestanding -O0 -Wall -Wextra +OS_BUILD_FLAGS=-ffreestanding -O2 -nostdlib -lgcc + +entry.o: boot.asm + nasm -felf32 boot.asm -o entry.o + +kernel.o: kernel.c + i386-elf-gcc -c kernel.c -o kernel.o $(KERNEL_BUILD_FLAGS) + +os.bin: kernel.o entry.o + i386-elf-gcc -T linker.ld -o os.bin $(OS_BUILD_FLAGS) $(OBJECTS) + +os.iso: os.bin + mkdir -p iso/boot/grub + cp os.bin iso/boot/os.bin + printf "menuentry 'HelloOS' {\n multiboot /boot/os.bin\n set gfxpayload=text\n}" > iso/boot/grub/grub.cfg + grub-mkrescue -o os.iso iso + +demo: + qemu-system-i386 demo/os.iso + +run: os.iso + qemu-system-i386 os.iso + +clean: + rm -rf iso os.iso *.o *.bin |
