2022-02-22 14:01:39 +02:00
|
|
|
CC=i686-elf-gcc
|
2022-02-24 21:16:28 +02:00
|
|
|
NASM=nasm
|
2022-02-22 14:01:39 +02:00
|
|
|
|
|
|
|
.PHONY: iso run clean
|
|
|
|
|
|
|
|
%.o: %.c
|
2022-02-22 21:20:57 +02:00
|
|
|
$(CC) -c $< -o $@ -std=gnu99 -mgeneral-regs-only -ffreestanding -O2 -Wall -Wextra -pedantic -I.
|
2022-02-22 14:01:39 +02:00
|
|
|
|
2022-02-24 21:16:28 +02:00
|
|
|
bootstrap.o: bootstrap.asm
|
|
|
|
$(NASM) -felf32 bootstrap.asm -o bootstrap.o
|
2022-02-22 14:01:39 +02:00
|
|
|
|
2022-02-24 21:16:28 +02:00
|
|
|
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
|
2022-02-22 21:20:57 +02:00
|
|
|
$(CC) -T linker.ld -o $@ -ffreestanding -O2 -nostdlib -lgcc $^
|
2022-02-22 14:01:39 +02:00
|
|
|
|
|
|
|
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
|
2022-02-24 18:11:09 +02:00
|
|
|
qemu-system-i386 -d int -M smm=off -cdrom generated-iso.iso
|
2022-02-22 14:01:39 +02:00
|
|
|
|
|
|
|
clean:
|
2022-02-24 18:18:31 +02:00
|
|
|
rm -rf *.o **/**.o kernel.bin *.iso isodir/
|
2022-02-22 14:01:39 +02:00
|
|
|
|