Files
KatauOS/Makefile
T
2025-03-19 13:10:41 +03:00

70 lines
1.3 KiB
Makefile

# Define the object files
OBJS = bin/boot.o bin/kernel.o bin/idt.o bin/isr.o bin/screen.o bin/utils.o bin/string.o bin/stdio.o bin/disk.o bin/pic.o
# Define the compiler and assembler
CC = gcc -D__is_katauos
AS = nasm
# Define the compiler flags
CFLAGS = -std=gnu99 -ffreestanding -O0 -Wall -Wextra -m32 -g
ASFLAGS = -f elf32
# Define the linker flags
LDFLAGS = -ffreestanding -O0 -nostdlib -m32 -g
LDSCRIPT = link.ld
# Define the output file
OUTPUT = myos.bin
all: $(OUTPUT)
image:
cp myos.bin grubshit/boot/
grub-mkrescue -o boot.iso grubshit
test:
qemu-system-i386 -drive file=boot.iso,media=disk,format=raw -m 512M -d int
test-bochs:
bochs -f bochsrc
$(OUTPUT): $(OBJS)
$(CC) -T $(LDSCRIPT) -o $@ $(OBJS) $(LDFLAGS)
bin/boot.o: src/boot.asm
$(AS) $(ASFLAGS) $< -o $@
bin/kernel.o: src/kernel.c
$(CC) $(CFLAGS) -c $< -o $@
bin/screen.o: src/screen.c
$(CC) $(CFLAGS) -c $< -o $@
bin/isr.o: src/isr.c
$(CC) $(CFLAGS) -c $< -o $@
bin/idt.o: src/idt.c
$(CC) $(CFLAGS) -c $< -o $@
bin/utils.o: src/utils.c
$(CC) $(CFLAGS) -c $< -o $@
bin/string.o: src/string.c
$(CC) $(CFLAGS) -c $< -o $@
bin/stdio.o: src/stdio.c
$(CC) $(CFLAGS) -c $< -o $@
bin/disk.o: src/disk.c
$(CC) $(CFLAGS) -c $< -o $@
bin/pic.o: src/pic.c
$(CC) $(CFLAGS) -c $< -o $@
clean:
rm -rf bin/
rm -f $(OUTPUT)
rm boot.iso
.PHONY: all clean