# 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 # Define the compiler and assembler CC = gcc AS = nasm # Define the compiler flags CFLAGS = -std=gnu99 -ffreestanding -O2 -Wall -Wextra -m32 ASFLAGS = -f elf32 # Define the linker flags LDFLAGS = -ffreestanding -O2 -nostdlib -m32 LDSCRIPT = link.ld # Define the output file OUTPUT = myos.bin all: $(OUTPUT) $(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 $@ clean: rm -rf bin/ rm -f $(OUTPUT) .PHONY: all clean