# Source, Executable, Includes, Library Defines   
INCL   = 
SRC    = attack.c nsee.c pawn_race.c material.c evaluate.c gen.c\
       move.c squies.c hash.c helper.c history.c full_search.c think.c main.c\
       rand.c runsuite.c book.c data.c debug.c init.c
OBJDIR = ../obj/
OBJ    = $(addprefix $(OBJDIR),$(SRC:.c=.o))
LIBS   = 
EXE    = xpdnt

# Compiler, Linker Defines  -DNDEBUG -ffast-math -Wno-long-long -fexpensive-optimizations -ffast-math -Wno-comment 
# -DNDEBUG -O3 -pipe -fomit-frame-pointer 
CC      = /usr/bin/gcc
CFLAGS  = -DNDEBUG -O3 -pipe -fomit-frame-pointer -Wall 
LIBPATH = -L.
LDFLAGS = -lm -o $(EXE) $(LIBPATH) $(LIBS)
CFDEBUG = -pedantic -Wall -Wno-long-long -g -DDEBUG $(LDFLAGS)
RM      = /bin/rm -f

# Compile and Assemble C Source Files into Object Files
$(OBJDIR)%.o: %.c
	$(CC) $(CFLAGS) -c $< -o $@

# Link all Object Files with external Libraries into Binaries
$(EXE): $(OBJ)
	$(CC) $(LDFLAGS)  $^ $(LIBS) -o ../$@

# Objects depend on these Libraries
$(OBJ): $(INCL)

# Create a gdb/dbx Capable Executable with DEBUG flags turned on
debug: $(OBJ)
	$(CC) $(CFDEBUG) $^ $(LIBS) -o ../$(EXE)

# Clean Up Objects, Exectuables, Dumps out of source directory
.PHONY : clean
clean:
	$(RM) $(OBJ) ../$(EXE) core a.out
