AS=nasm
AFLAGS=-f aout
CC=gcc
CFLAGS=-Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -c
CPPFLAGS=-I include
LD=ld
LFLAGS=-Tlink.ld

OBJECTS=main.o system.o screen.o string.o gdt.o idt.o

.PHONY: clean all

all: kernel.bin

%.o: %.c %.h
	$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $?

start.o: start.asm
	$(AS) $(AFLAGS) -o $@ $<

kernel.bin: start.o $(OBJECTS)
	$(LD) $(LFLAGS) -o $@ $?

clean:
	$(RM) -f *.o kernel.bin
