kernel_premier/Makefile
2023-10-05 23:28:32 +02:00

52 lines
923 B
Makefile

OBJECTS = loader.o load_gdt.o gdt.o serial.o framebuffer.o io.o kmain.o
CC = gcc
CFLAGS = -m32 -nostdlib -nostdinc -fno-builtin -fno-stack-protector \
-nostartfiles -nodefaultlibs -Iinclude -Wall -Wextra -Werror -c \
-ansi -pedantic
LDFLAGS = -T link.ld -melf_i386
AS = nasm
ASFLAGS = -f elf
all: kernel.elf
kernel.elf: $(OBJECTS)
ld $(LDFLAGS) $^ -o $@
%.o: %.c
$(CC) $(CFLAGS) $< -o $@
%.o: src/%.c
$(CC) $(CFLAGS) $< -o $@
%.o: %.s
$(AS) $(ASFLAGS) $< -o $@
%.o: src/%.s
$(AS) $(ASFLAGS) $< -o $@
os.iso: kernel.elf
cp kernel.elf iso/boot/kernel.elf
mkisofs -R \
-b boot/grub/stage2_eltorito \
-no-emul-boot \
-boot-load-size 4 \
-A os \
-input-charset UTF-8 \
-quiet \
-boot-info-table \
-o os.iso \
iso
doc:
doxygen Doxyfile
.PHONY: run clean all
run: os.iso
qemu-system-i386 -cdrom $< -serial stdio #-d cpu
clean:
rm -r *.o kernel.elf os.iso doc