2008-11-02 07:35:32 -07:00
|
|
|
# Stockfish, a UCI chess playing engine derived from Glaurung 2.1
|
2008-08-31 23:59:13 -06:00
|
|
|
# Copyright (C) 2004-2007 Tord Romstad
|
2008-11-02 07:35:32 -07:00
|
|
|
# Copyright (C) 2008 Marco Costalba
|
2008-08-31 23:59:13 -06:00
|
|
|
|
2008-11-02 07:35:32 -07:00
|
|
|
# This file is part of Stockfish.
|
2008-08-31 23:59:13 -06:00
|
|
|
#
|
2008-11-02 07:35:32 -07:00
|
|
|
# Stockfish is free software: you can redistribute it and/or modify
|
2008-08-31 23:59:13 -06:00
|
|
|
# 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.
|
|
|
|
#
|
2008-11-02 07:35:32 -07:00
|
|
|
# Stockfish is distributed in the hope that it will be useful,
|
2008-08-31 23:59:13 -06:00
|
|
|
# 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/>.
|
|
|
|
|
|
|
|
|
2009-08-07 20:30:27 -06:00
|
|
|
### Executable name. Do not change
|
2008-11-02 07:35:32 -07:00
|
|
|
EXE = stockfish
|
2008-08-31 23:59:13 -06:00
|
|
|
|
2010-02-11 22:49:16 -07:00
|
|
|
### Installation dir definitions
|
|
|
|
PREFIX = /usr/local
|
|
|
|
BINDIR = $(PREFIX)/bin
|
|
|
|
|
2009-08-07 20:30:27 -06:00
|
|
|
### ==========================================================================
|
|
|
|
### Compiler speed switches for both GCC and ICC. These settings are generally
|
|
|
|
### fast on a broad range of systems, but may be changed experimentally
|
|
|
|
### ==========================================================================
|
2009-12-27 23:13:12 -07:00
|
|
|
GCCFLAGS = -O3 -msse
|
2009-08-12 01:40:03 -06:00
|
|
|
ICCFLAGS = -fast -msse
|
2009-08-21 02:50:34 -06:00
|
|
|
ICCFLAGS-OSX = -fast -mdynamic-no-pic
|
2008-08-31 23:59:13 -06:00
|
|
|
|
|
|
|
|
2009-08-08 01:12:31 -06:00
|
|
|
### ==========================================================================
|
|
|
|
### Enable/disable debugging, disabled by default
|
|
|
|
### ==========================================================================
|
|
|
|
GCCFLAGS += -DNDEBUG
|
|
|
|
ICCFLAGS += -DNDEBUG
|
2009-08-21 02:50:34 -06:00
|
|
|
ICCFLAGS-OSX += -DNDEBUG
|
2009-08-08 01:12:31 -06:00
|
|
|
|
|
|
|
|
2009-11-05 11:29:26 -07:00
|
|
|
### ==========================================================================
|
2009-11-06 09:33:14 -07:00
|
|
|
### Remove below comments to compile for a big-endian machine
|
2009-11-05 11:29:26 -07:00
|
|
|
### ==========================================================================
|
2009-11-06 09:33:14 -07:00
|
|
|
#GCCFLAGS += -DBIGENDIAN
|
|
|
|
#ICCFLAGS += -DBIGENDIAN
|
|
|
|
#ICCFLAGS-OSX += -DBIGENDIAN
|
2009-11-05 11:29:26 -07:00
|
|
|
|
|
|
|
|
2009-08-07 20:30:27 -06:00
|
|
|
### ==========================================================================
|
|
|
|
### Run built-in benchmark for pgo-builds with: 32MB hash 1 thread 10 depth
|
|
|
|
### These settings are generally fast, but may be changed experimentally
|
|
|
|
### ==========================================================================
|
|
|
|
PGOBENCH = ./$(EXE) bench 32 1 10 default depth
|
2008-08-31 23:59:13 -06:00
|
|
|
|
2009-08-07 20:30:27 -06:00
|
|
|
### General compiler settings. Do not change
|
2009-11-05 11:29:26 -07:00
|
|
|
GCCFLAGS += -g -Wall -fno-exceptions -fno-rtti
|
|
|
|
ICCFLAGS += -g -Wall -fno-exceptions -fno-rtti -wd383,869,981,10187,10188,11505,11503
|
|
|
|
ICCFLAGS-OSX += -g -Wall -fno-exceptions -fno-rtti -wd383,869,981,10187,10188,11505,11503
|
2008-08-31 23:59:13 -06:00
|
|
|
|
|
|
|
|
2009-08-07 20:30:27 -06:00
|
|
|
### General linker settings. Do not change
|
|
|
|
LDFLAGS = -lpthread
|
|
|
|
|
|
|
|
|
|
|
|
### Object files. Do not change
|
|
|
|
OBJS = application.o bitboard.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 direction.o tt.o value.o uci.o ucioption.o \
|
2010-01-27 03:19:56 -07:00
|
|
|
mersenne.o book.o bitbase.o san.o benchmark.o
|
2008-08-31 23:59:13 -06:00
|
|
|
|
|
|
|
|
2009-08-07 20:30:27 -06:00
|
|
|
### General rules. Do not change
|
|
|
|
default:
|
|
|
|
$(MAKE) gcc
|
|
|
|
|
|
|
|
help:
|
|
|
|
@echo ""
|
|
|
|
@echo "Makefile options:"
|
|
|
|
@echo ""
|
|
|
|
@echo "make > Default: Compiler = g++"
|
2010-05-14 10:12:10 -06:00
|
|
|
@echo "make gcc-profile > Compiler = g++ + automatic pgo-build"
|
2010-01-30 11:18:27 -07:00
|
|
|
@echo "make gcc-popcnt > Compiler = g++ + popcnt-support"
|
2009-08-07 20:30:27 -06:00
|
|
|
@echo "make icc > Compiler = icpc"
|
|
|
|
@echo "make icc-profile > Compiler = icpc + automatic pgo-build"
|
2009-11-06 00:59:42 -07:00
|
|
|
@echo "make icc-profile-popcnt > Compiler = icpc + automatic pgo-build + popcnt-support"
|
2009-08-07 20:30:27 -06:00
|
|
|
@echo "make osx-ppc32 > PPC-Mac OS X 32 bit. Compiler = g++"
|
|
|
|
@echo "make osx-ppc64 > PPC-Mac OS X 64 bit. Compiler = g++"
|
|
|
|
@echo "make osx-x86 > x86-Mac OS X 32 bit. Compiler = g++"
|
|
|
|
@echo "make osx-x86_64 > x86-Mac OS X 64 bit. Compiler = g++"
|
2009-08-21 02:50:34 -06:00
|
|
|
@echo "make osx-icc32 > x86-Mac OS X 32 bit. Compiler = icpc"
|
|
|
|
@echo "make osx-icc64 > x86-Mac OS X 64 bit. Compiler = icpc"
|
|
|
|
@echo "make osx-icc32-profile > OSX 32 bit. Compiler = icpc + automatic pgo-build"
|
|
|
|
@echo "make osx-icc64-profile > OSX 64 bit. Compiler = icpc + automatic pgo-build"
|
2010-02-11 22:49:16 -07:00
|
|
|
@echo "make hpux > HP-UX. Compiler = aCC"
|
2009-08-08 10:37:13 -06:00
|
|
|
@echo "make strip > Strip executable"
|
2009-08-07 20:30:27 -06:00
|
|
|
@echo "make clean > Clean up"
|
|
|
|
@echo ""
|
2008-08-31 23:59:13 -06:00
|
|
|
|
2009-08-07 20:30:27 -06:00
|
|
|
all: $(EXE) .depend
|
|
|
|
|
2010-02-11 22:49:16 -07:00
|
|
|
test check: default
|
|
|
|
@$(PGOBENCH)
|
|
|
|
|
2009-08-07 20:30:27 -06:00
|
|
|
clean:
|
2010-02-11 22:49:16 -07:00
|
|
|
$(RM) *.o .depend *~ $(EXE) core bench.txt
|
2009-08-07 20:30:27 -06:00
|
|
|
|
|
|
|
|
|
|
|
### Possible targets. You may add your own ones here
|
|
|
|
gcc:
|
|
|
|
$(MAKE) \
|
|
|
|
CXX='g++' \
|
|
|
|
CXXFLAGS="$(GCCFLAGS)" \
|
|
|
|
all
|
|
|
|
|
2010-05-14 10:12:10 -06:00
|
|
|
gcc-profile-make:
|
|
|
|
$(MAKE) \
|
|
|
|
CXX='g++' \
|
|
|
|
CXXFLAGS="$(GCCFLAGS)" \
|
|
|
|
CXXFLAGS+='-fprofile-generate' \
|
|
|
|
LDFLAGS="$(LDFLAGS)" \
|
|
|
|
LDFLAGS+=" -lgcov" \
|
|
|
|
all
|
|
|
|
|
|
|
|
gcc-profile-use:
|
|
|
|
$(MAKE) \
|
|
|
|
CXX='g++' \
|
|
|
|
CXXFLAGS="$(GCCFLAGS)" \
|
|
|
|
CXXFLAGS+='-fprofile-use' \
|
|
|
|
all
|
|
|
|
|
|
|
|
gcc-profile:
|
|
|
|
@touch *.cpp *.h
|
|
|
|
$(MAKE) gcc-profile-make
|
|
|
|
@echo ""
|
|
|
|
@echo "Running benchmark for pgo-build ..."
|
|
|
|
@$(PGOBENCH) > /dev/null
|
|
|
|
@echo "Benchmark finished. Build final executable now ..."
|
|
|
|
@echo ""
|
|
|
|
@touch *.cpp *.h
|
|
|
|
$(MAKE) gcc-profile-use
|
|
|
|
@rm -rf *.gcda bench.txt
|
|
|
|
|
2010-01-30 11:18:27 -07:00
|
|
|
gcc-popcnt:
|
|
|
|
$(MAKE) \
|
|
|
|
CXX='g++' \
|
|
|
|
CXXFLAGS="$(GCCFLAGS) -DUSE_POPCNT" \
|
|
|
|
all
|
|
|
|
|
2009-08-07 20:30:27 -06:00
|
|
|
icc:
|
|
|
|
$(MAKE) \
|
|
|
|
CXX='icpc' \
|
|
|
|
CXXFLAGS="$(ICCFLAGS)" \
|
|
|
|
all
|
|
|
|
|
|
|
|
icc-profile-make:
|
|
|
|
$(MAKE) \
|
|
|
|
CXX='icpc' \
|
|
|
|
CXXFLAGS="$(ICCFLAGS)" \
|
|
|
|
CXXFLAGS+='-prof-gen=srcpos -prof_dir ./profdir' \
|
|
|
|
all
|
|
|
|
|
|
|
|
icc-profile-use:
|
|
|
|
$(MAKE) \
|
|
|
|
CXX='icpc' \
|
|
|
|
CXXFLAGS="$(ICCFLAGS)" \
|
|
|
|
CXXFLAGS+='-prof_use -prof_dir ./profdir' \
|
|
|
|
all
|
|
|
|
|
|
|
|
icc-profile:
|
|
|
|
@rm -rf profdir
|
|
|
|
@mkdir profdir
|
|
|
|
@touch *.cpp *.h
|
|
|
|
$(MAKE) icc-profile-make
|
|
|
|
@echo ""
|
|
|
|
@echo "Running benchmark for pgo-build ..."
|
|
|
|
@$(PGOBENCH) > /dev/null
|
|
|
|
@echo "Benchmark finished. Build final executable now ..."
|
|
|
|
@echo ""
|
|
|
|
@touch *.cpp *.h
|
|
|
|
$(MAKE) icc-profile-use
|
|
|
|
@rm -rf profdir bench.txt
|
|
|
|
|
2009-11-06 00:59:42 -07:00
|
|
|
icc-profile-make-with-popcnt:
|
|
|
|
$(MAKE) \
|
|
|
|
CXX='icpc' \
|
|
|
|
CXXFLAGS="$(ICCFLAGS) -DUSE_POPCNT" \
|
|
|
|
CXXFLAGS+='-prof-gen=srcpos -prof_dir ./profdir' \
|
|
|
|
all
|
|
|
|
|
|
|
|
icc-profile-use-with-popcnt:
|
|
|
|
$(MAKE) \
|
|
|
|
CXX='icpc' \
|
|
|
|
CXXFLAGS="$(ICCFLAGS) -DUSE_POPCNT" \
|
|
|
|
CXXFLAGS+='-prof_use -prof_dir ./profdir' \
|
|
|
|
all
|
|
|
|
|
|
|
|
icc-profile-popcnt:
|
|
|
|
@rm -rf profdir
|
|
|
|
@mkdir profdir
|
|
|
|
@touch *.cpp *.h
|
|
|
|
$(MAKE) icc-profile-make
|
|
|
|
@echo ""
|
|
|
|
@echo "Running benchmark for pgo-build (popcnt disabled)..."
|
|
|
|
@$(PGOBENCH) > /dev/null
|
|
|
|
@touch *.cpp *.h
|
|
|
|
$(MAKE) icc-profile-make-with-popcnt
|
|
|
|
@echo ""
|
|
|
|
@echo "Running benchmark for pgo-build (popcnt enabled)..."
|
|
|
|
@$(PGOBENCH) > /dev/null
|
|
|
|
@echo "Benchmarks finished. Build final executable now ..."
|
|
|
|
@echo ""
|
|
|
|
@touch *.cpp *.h
|
|
|
|
$(MAKE) icc-profile-use-with-popcnt
|
|
|
|
@rm -rf profdir bench.txt
|
|
|
|
|
|
|
|
|
2009-08-07 20:30:27 -06:00
|
|
|
osx-ppc32:
|
|
|
|
$(MAKE) \
|
|
|
|
CXX='g++' \
|
|
|
|
CXXFLAGS="$(GCCFLAGS)" \
|
|
|
|
CXXFLAGS+='-arch ppc' \
|
2010-04-06 02:19:09 -06:00
|
|
|
CXXFLAGS+='-DBIGENDIAN' \
|
2009-08-07 20:30:27 -06:00
|
|
|
LDFLAGS+='-arch ppc' \
|
|
|
|
all
|
|
|
|
|
|
|
|
osx-ppc64:
|
|
|
|
$(MAKE) \
|
|
|
|
CXX='g++' \
|
|
|
|
CXXFLAGS="$(GCCFLAGS)" \
|
|
|
|
CXXFLAGS+='-arch ppc64' \
|
2010-04-06 02:19:09 -06:00
|
|
|
CXXFLAGS+='-DBIGENDIAN' \
|
2009-08-07 20:30:27 -06:00
|
|
|
LDFLAGS+='-arch ppc64' \
|
|
|
|
all
|
|
|
|
|
|
|
|
osx-x86:
|
|
|
|
$(MAKE) \
|
|
|
|
CXX='g++' \
|
|
|
|
CXXFLAGS="$(GCCFLAGS)" \
|
2010-04-05 13:47:28 -06:00
|
|
|
CXXFLAGS+='-arch i386 -mdynamic-no-pic' \
|
|
|
|
LDFLAGS+='-arch i386 -mdynamic-no-pic' \
|
2009-08-07 20:30:27 -06:00
|
|
|
all
|
|
|
|
|
|
|
|
osx-x86_64:
|
|
|
|
$(MAKE) \
|
|
|
|
CXX='g++' \
|
|
|
|
CXXFLAGS="$(GCCFLAGS)" \
|
2010-04-05 13:47:28 -06:00
|
|
|
CXXFLAGS+='-arch x86_64 -mdynamic-no-pic' \
|
|
|
|
LDFLAGS+='-arch x86_64 -mdynamic-no-pic' \
|
2009-08-07 20:30:27 -06:00
|
|
|
all
|
2010-05-14 10:12:10 -06:00
|
|
|
|
2009-08-21 02:50:34 -06:00
|
|
|
osx-icc32:
|
|
|
|
$(MAKE) \
|
|
|
|
CXX='icpc' \
|
|
|
|
CXXFLAGS="$(ICCFLAGS-OSX)" \
|
|
|
|
CXXFLAGS+='-arch i386' \
|
|
|
|
LDFLAGS+='-arch i386' \
|
|
|
|
all
|
|
|
|
|
|
|
|
osx-icc64:
|
|
|
|
$(MAKE) \
|
|
|
|
CXX='icpc' \
|
|
|
|
CXXFLAGS="$(ICCFLAGS-OSX)" \
|
|
|
|
CXXFLAGS+='-arch x86_64' \
|
|
|
|
LDFLAGS+='-arch x86_64' \
|
|
|
|
all
|
|
|
|
|
|
|
|
osx-icc32-profile-make:
|
|
|
|
$(MAKE) \
|
|
|
|
CXX='icpc' \
|
|
|
|
CXXFLAGS="$(ICCFLAGS-OSX)" \
|
|
|
|
CXXFLAGS+='-arch i386' \
|
|
|
|
CXXFLAGS+='-prof_gen -prof_dir ./profdir' \
|
|
|
|
LDFLAGS+='-arch i386' \
|
|
|
|
all
|
|
|
|
|
|
|
|
osx-icc32-profile-use:
|
|
|
|
$(MAKE) \
|
|
|
|
CXX='icpc' \
|
|
|
|
CXXFLAGS="$(ICCFLAGS-OSX)" \
|
|
|
|
CXXFLAGS+='-arch i386' \
|
|
|
|
CXXFLAGS+='-prof_use -prof_dir ./profdir' \
|
|
|
|
LDFLAGS+='-arch i386' \
|
|
|
|
all
|
|
|
|
|
|
|
|
osx-icc32-profile:
|
|
|
|
@rm -rf profdir
|
|
|
|
@mkdir profdir
|
|
|
|
@touch *.cpp *.h
|
|
|
|
$(MAKE) osx-icc32-profile-make
|
|
|
|
@echo ""
|
|
|
|
@echo "Running benchmark for pgo-build ..."
|
|
|
|
@$(PGOBENCH) > /dev/null
|
|
|
|
@echo "Benchmark finished. Build final executable now ..."
|
|
|
|
@echo ""
|
|
|
|
@touch *.cpp *.h
|
|
|
|
$(MAKE) osx-icc32-profile-use
|
|
|
|
@rm -rf profdir bench.txt
|
|
|
|
|
|
|
|
osx-icc64-profile-make:
|
|
|
|
$(MAKE) \
|
|
|
|
CXX='icpc' \
|
|
|
|
CXXFLAGS="$(ICCFLAGS-OSX)" \
|
|
|
|
CXXFLAGS+='-arch x86_64' \
|
|
|
|
CXXFLAGS+='-prof_gen -prof_dir ./profdir' \
|
|
|
|
LDFLAGS+='-arch x86_64' \
|
|
|
|
all
|
|
|
|
|
|
|
|
osx-icc64-profile-use:
|
|
|
|
$(MAKE) \
|
|
|
|
CXX='icpc' \
|
|
|
|
CXXFLAGS="$(ICCFLAGS-OSX)" \
|
|
|
|
CXXFLAGS+='-arch x86_64' \
|
|
|
|
CXXFLAGS+='-prof_use -prof_dir ./profdir' \
|
|
|
|
LDFLAGS+='-arch x86_64' \
|
|
|
|
all
|
|
|
|
|
|
|
|
osx-icc64-profile:
|
|
|
|
@rm -rf profdir
|
|
|
|
@mkdir profdir
|
|
|
|
@touch *.cpp *.h
|
|
|
|
$(MAKE) osx-icc64-profile-make
|
|
|
|
@echo ""
|
|
|
|
@echo "Running benchmark for pgo-build ..."
|
|
|
|
@$(PGOBENCH) > /dev/null
|
|
|
|
@echo "Benchmark finished. Build final executable now ..."
|
|
|
|
@echo ""
|
|
|
|
@touch *.cpp *.h
|
|
|
|
$(MAKE) osx-icc64-profile-use
|
|
|
|
@rm -rf profdir bench.txt
|
|
|
|
|
2010-02-11 22:49:16 -07:00
|
|
|
hpux:
|
|
|
|
$(MAKE) \
|
|
|
|
CXX='/opt/aCC/bin/aCC -AA +hpxstd98 -DBIGENDIAN -mt +O3 -DNDEBUG' \
|
|
|
|
CXXFLAGS="" \
|
|
|
|
LDFLAGS="" \
|
|
|
|
all
|
2009-08-21 02:50:34 -06:00
|
|
|
|
2009-08-07 20:30:27 -06:00
|
|
|
|
2009-08-08 10:37:13 -06:00
|
|
|
strip:
|
|
|
|
strip $(EXE)
|
|
|
|
|
2009-08-07 20:30:27 -06:00
|
|
|
|
|
|
|
### Compilation. Do not change
|
2008-08-31 23:59:13 -06:00
|
|
|
$(EXE): $(OBJS)
|
2010-05-14 10:12:10 -06:00
|
|
|
$(CXX) -o $@ $(OBJS) $(LDFLAGS)
|
2008-08-31 23:59:13 -06:00
|
|
|
|
2010-02-11 22:49:16 -07:00
|
|
|
### Installation
|
|
|
|
install: default
|
|
|
|
-mkdir -p -m 755 $(BINDIR)
|
|
|
|
-cp $(EXE) $(BINDIR)
|
|
|
|
-strip $(BINDIR)/$(EXE)
|
2009-08-07 20:30:27 -06:00
|
|
|
|
|
|
|
### Dependencies. Do not change
|
2008-08-31 23:59:13 -06:00
|
|
|
.depend:
|
2010-02-11 22:49:16 -07:00
|
|
|
-@$(CXX) -msse -MM $(OBJS:.o=.cpp) > $@ 2> /dev/null
|
2008-08-31 23:59:13 -06:00
|
|
|
|
2010-02-21 07:18:35 -07:00
|
|
|
-include .depend
|