kernel_premier/Makefile

53 lines
923 B
Makefile
Raw Permalink Normal View History

2023-10-05 23:28:32 +02:00
OBJECTS = loader.o load_gdt.o gdt.o serial.o framebuffer.o io.o kmain.o
2023-09-12 23:35:30 +02:00
CC = gcc
CFLAGS = -m32 -nostdlib -nostdinc -fno-builtin -fno-stack-protector \
2023-09-13 20:31:19 +02:00
-nostartfiles -nodefaultlibs -Iinclude -Wall -Wextra -Werror -c \
-ansi -pedantic
2023-09-12 23:35:30 +02:00
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 $@
2023-09-13 16:31:15 +02:00
%.o: src/%.c
$(CC) $(CFLAGS) $< -o $@
2023-09-12 23:35:30 +02:00
%.o: %.s
$(AS) $(ASFLAGS) $< -o $@
2023-09-13 16:31:15 +02:00
%.o: src/%.s
$(AS) $(ASFLAGS) $< -o $@
2023-09-12 23:35:30 +02:00
os.iso: kernel.elf
cp kernel.elf iso/boot/kernel.elf
2023-09-13 20:31:19 +02:00
mkisofs -R \
2023-09-12 23:35:30 +02:00
-b boot/grub/stage2_eltorito \
2023-09-13 20:31:19 +02:00
-no-emul-boot \
-boot-load-size 4 \
-A os \
-input-charset UTF-8 \
-quiet \
-boot-info-table \
-o os.iso \
2023-09-12 23:35:30 +02:00
iso
2023-09-14 16:25:39 +02:00
doc:
doxygen Doxyfile
.PHONY: run clean all
2023-09-12 23:35:30 +02:00
run: os.iso
qemu-system-i386 -cdrom $< -serial stdio #-d cpu
clean:
2023-09-14 16:25:39 +02:00
rm -r *.o kernel.elf os.iso doc