
# files

EXE = gambitfruit.exe

OBJS = attack.o board.o book.o eval.o fen.o hash.o list.o main.o material.o \
       move.o move_check.o move_do.o move_evasion.o move_gen.o move_legal.o \
       option.o pawn.o piece.o posix.o protocol.o pst.o pv.o random.o \
       search.o search_full.o see.o sort.o square.o trans.o util.o value.o \
       vector.o

# rules

all: $(EXE) .depend

clean:
	$(RM) *.o .depend gmon.out

# general
CXX      = arm-cegcc-g++
#ARCH 		 = -mcpu=xscale -march=armv5te
ARCH 		 = 
CXXFLAGS = -pipe -DWIN32 -Wcast-align
LDFLAGS  = -lm
CC       = arm-cegcc-gcc -DWIN32 -O3 $(ARCH)

# C++

CXXFLAGS += -fno-exceptions -fno-rtti

# optimisation

CXXFLAGS += -O3 -fstrict-aliasing
CXXFLAGS += -fomit-frame-pointer
# CXXFLAGS += -march=athlon-xp # SELECT ME

# strip

LDFLAGS += -s

# dependencies
ipc.armo: ipc.c
	$(CC) -c -o ipc.armo ipc.c

$(EXE): $(OBJS) ipc.armo
	$(CXX) $(LDFLAGS) -o $@ $(OBJS) ipc.armo
	arm-cegcc-strip $(EXE)

.depend:
	$(CXX) -MM $(OBJS:.o=.cpp) > $@

include .depend

