# Glaurung, a UCI chess playing engine.
# 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 3 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 this program.  If not, see <http://www.gnu.org/licenses/>.


# Files

EXE = glaurung

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


# Rules

all: $(EXE) .depend

clean: 
	$(RM) *.o .depend glaurung

# Compiling with the Intel C++ compiler:
# CXX = icpc
# CXXFLAGS = -O3 -DNDEBUG -fno-exceptions -fomit-frame-pointer -fno-rtti \
        -fstrict-aliasing -mdynamic-no-pic -no-prec-div -ipo -static -xP

# CXXFLAGS = -O3 -DNDEBUG -fno-exceptions -fomit-frame-pointer -fno-rtti \
	-fstrict-aliasing -mdynamic-no-pic -no-prec-div -static -xP -prof_gen \
	-prof_dir ./profdata
# CXXFLAGS = -O3 -DNDEBUG -fno-exceptions -fomit-frame-pointer -fno-rtti \
	-fstrict-aliasing -mdynamic-no-pic -no-prec-div -ipo -static -xP \
	-prof_use -prof_dir ./profdata


# Compiling with GCC:
CXX = g++
CXXFLAGS = -O3 -DNDEBUG -g -funroll-loops -fomit-frame-pointer \
        -fstrict-aliasing -fno-exceptions -fno-rtti -Wall

# Compiling with GCC, in debug mode:
# CXX = g++
# CXXFLAGS = -O3 -g -funroll-loops -fomit-frame-pointer -fstrict-aliasing \
	-fno-exceptions -fno-rtti -Wall 

# Compiling a PowerPC Mac OS X binary with GCC:
# CXX = g++
# CXXFLAGS = -O3 -DNDEBUG -funroll-loops -fomit-frame-pointer -fstrict-aliasing \
	-fno-exceptions -fno-rtti -Wall -arch ppc

LDFLAGS = -lm -lpthread


# Dependencies

$(EXE): $(OBJS)
	$(CXX) $(LDFLAGS) -o $@ $(OBJS)

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

include .depend
