# Copyright (C) 2004-2007 Tord Romstad

# This file is part of Glaurung.
#
# Glaurung is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

# Glaurung is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with Glaurung; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

CC = g++

#CFLAGS = -O3 -g -funroll-loops -fomit-frame-pointer -fstrict-aliasing -fno-exceptions -fno-rtti -Wall 
CFLAGS = -O3 -g -DNDEBUG -funroll-loops -fomit-frame-pointer -fstrict-aliasing -fno-exceptions -fno-rtti -ftree-vectorize -Wall 
#CFLAGS = -O3 -DNDEBUG -funroll-loops -fomit-frame-pointer -fstrict-aliasing -fno-exceptions -fno-rtti -Wall -arch ppc
#CFLAGS = -O3 -DNDEBUG -funroll-loops -fomit-frame-pointer -fstrict-aliasing -fno-exceptions -fno-rtti -Wall -mtune=G5 -mcpu=G5 -mpowerpc64 -fast

DEFINES =
LDFLAGS = 

OBJ = .o/bitboard.o \
	.o/color.o \
        .o/pawns.o \
	.o/material.o \
	.o/endgame.o \
	.o/evaluate.o \
	.o/main.o \
	.o/misc.o \
	.o/move.o \
	.o/movegen.o \
	.o/history.o \
	.o/movepick.o \
	.o/search.o \
	.o/piece.o \
	.o/position.o \
	.o/square.o \
	.o/direction.o \
	.o/tt.o \
	.o/value.o \
	.o/uci.o \
	.o/ucioption.o \
	.o/mersenne.o \
	.o/book.o \
	.o/bitbase.o \
	.o/test.o

glaurung: .o $(OBJ)
	$(CC) $(CFLAGS) $(DEFINES) $(LDFLAGS) $(OBJ) -o glaurung -lm -lpthread

.o/%.o: Makefile %.cpp
	$(CC) $(CFLAGS) $(DEFINES) -c $*.cpp -o .o/$*.o

.o:
	mkdir .o

clean:
	rm -rf .o glaurung
