CPP = g++
CPPFLAGS = -DNDEBUG -Wall -pipe -O3 -fno-exceptions -fomit-frame-pointer -fno-rtti

BIN = GreKo.exe

OBJ = bitboards.o	\
      book.o      \
      commands.o	\
      eval.o		\
      main.o 		\
      moves.o		\
      notation.o  \
      position.o 	\
      search.o		\
      utils.o 		\
      win32.o

LINKOBJ = $(OBJ)

.PHONY:	all clean

all:	$(BIN)

clean:
	rm -f $(OBJ) $(BIN)

$(BIN):	$(OBJ)
	$(CPP) $(LINKOBJ) -o $(BIN)

bitboards.o: bitboards.cpp 
	$(CPP) $(CPPFLAGS) -c bitboards.cpp -o bitboards.o

book.o: book.cpp 
	$(CPP) $(CPPFLAGS) -c book.cpp -o book.o

commands.o: commands.cpp 
	$(CPP) $(CPPFLAGS) -c commands.cpp -o commands.o

eval.o: eval.cpp eval.h
	$(CPP) $(CPPFLAGS) -c eval.cpp -o eval.o

main.o:	main.cpp 
	$(CPP) $(CPPFLAGS) -c main.cpp -o main.o

moves.o: moves.cpp 
	$(CPP) $(CPPFLAGS) -c moves.cpp -o moves.o

notation.o: notation.cpp 
	$(CPP) $(CPPFLAGS) -c notation.cpp -o notation.o

position.o: position.cpp 
	$(CPP) $(CPPFLAGS) -c position.cpp -o position.o

search.o: search.cpp 
	$(CPP) $(CPPFLAGS) -c search.cpp -o search.o

utils.o: utils.cpp
	$(CPP) $(CPPFLAGS) -c utils.cpp -o utils.o

win32.o: win32.cpp
	$(CPP) $(CPPFLAGS) -c win32.cpp -o win32.o -Wno-implicit
