# Programs
CC	= g++
LD	= ld

# Compiler / Linker Flags
CCFLAGS	= -O0 -Wall -fno-builtin -ffreestanding -nostdlib -fno-rtti -fno-exceptions -nostdinc -Wno-long-long -fomit-frame-pointer -I ../include
LDFLAGS	= --oformat=binary -N -emain -Ttext 0x7400

# Rules
%.o:%.cpp
	$(CC) $(CCFLAGS) -c -o $@ $<
%.o:%.s
	$(CC) $(CCFLAGS) -c -o $@ $<

# Defenitions
TARGET	= kernel.bin
OBJECTS	= main.o GDT.o IDT.o Exceptions.o PIC.o PIT.o PortIO.o \
	  Bios.o VGA.o Console.o Debug.o Keyboard.o Speaker.o \
	  Shutdown.o Delay.o DeviceQueue.o Shell.o Time.o \
	  exception.o DMA.o

# Options
all:	$(OBJECTS)
	$(LD) $(LDFLAGS) -o $(TARGET) $(OBJECTS) ../lib/libc.o
	chmod a-x $(TARGET)
clean:
	rm -f $(OBJECTS) $(TARGETS)
