OBJ=kernel
CC=gcc -w

all: $(OBJ) 

kernel: kernel.o util.o gdt.o pic.o interrupt.o int.o idt.o video.o system.o keyboard.o shell.o strutil.o interrupt_kb.o  commandes.o

	ld --oformat binary -Ttext 1000 $^ -o $@

int.o: int.asm
	nasm -f elf $^ -o $@

kernel.o: kernel.cpp
	g++ -nostdlib -fno-builtin -fno-rtti -fno-exceptions -nostdinc -O2 -c kernel.cpp

video.o: video.cpp
	g++ -nostdlib -fno-builtin -fno-rtti -fno-exceptions -nostdinc -O2 -c video.cpp

keyboard.o: keyboard.cpp
	g++ -nostdlib -fno-builtin -fno-rtti -fno-exceptions -nostdinc -O2 -c keyboard.cpp

system.o: system.cpp
	g++ -nostdlib -fno-builtin -fno-rtti -fno-exceptions -nostdinc -O2 -c system.cpp

shell.o: shell.cpp
	g++ -nostdlib -fno-builtin -fno-rtti -fno-exceptions -nostdinc -O2 -c shell.cpp

strutil.o: strutil.cpp
	g++ -nostdlib -fno-builtin -fno-rtti -fno-exceptions -nostdinc -O2 -c strutil.cpp

commandes.o: commandes.cpp
	g++ -nostdlib -fno-builtin -fno-rtti -fno-exceptions -nostdinc -O2 -c commandes.cpp

.o: .c 
	$(CC) -c $^

clean:
	rm -f $(OBJ) *.o
