hippOS/Makefile

26 lines
710 B
Makefile

CC=i686-elf-gcc
NASM=nasm
.PHONY: iso run clean
%.o: %.c
$(CC) -c $< -o $@ -std=gnu99 -mgeneral-regs-only -ffreestanding -O2 -Wall -Wextra -pedantic -I.
bootstrap.o: bootstrap.asm
$(NASM) -felf32 bootstrap.asm -o bootstrap.o
kernel.bin: bootstrap.o gfx/terminal.o ps2/keyboard.o std/std.o std/kstd.o cpu/idt.o cpu/pic.o cpu/exception.o kernel.o
$(CC) -T linker.ld -o $@ -ffreestanding -O2 -nostdlib -lgcc $^
iso: kernel.bin
mkdir -p isodir/boot/grub
cp kernel.bin isodir/boot/kernel.bin
cp extra/grub.cfg isodir/boot/grub/grub.cfg
grub-mkrescue -o generated-iso.iso isodir
run: iso
qemu-system-i386 -d int -M smm=off -cdrom generated-iso.iso
clean:
rm -rf *.o **/**.o kernel.bin *.iso isodir/