1 # Stockfish, a UCI chess playing engine derived from Glaurung 2.1
2 # Copyright (C) 2004-2007 Tord Romstad
3 # Copyright (C) 2008 Marco Costalba
5 # This file is part of Stockfish.
7 # Stockfish is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # Stockfish is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 ### Executable name. Do not change
25 ### ==========================================================================
26 ### Compiler speed switches for both GCC and ICC. These settings are generally
27 ### fast on a broad range of systems, but may be changed experimentally
28 ### ==========================================================================
33 ### ==========================================================================
34 ### Run built-in benchmark for pgo-builds with: 32MB hash 1 thread 10 depth
35 ### These settings are generally fast, but may be changed experimentally
36 ### ==========================================================================
37 PGOBENCH = ./$(EXE) bench 32 1 10 default depth
40 ### General compiler settings. Do not change
41 GCCFLAGS += -s -Wall -fno-exceptions -fno-rtti -fno-strict-aliasing
42 ICCFLAGS += -s -Wall -fno-exceptions -fno-rtti -fno-strict-aliasing -wd383,869,981,10187,10188,11505,11503
45 ### General linker settings. Do not change
49 ### Object files. Do not change
50 OBJS = application.o bitboard.o pawns.o material.o endgame.o evaluate.o main.o \
51 misc.o move.o movegen.o history.o movepick.o search.o piece.o \
52 position.o direction.o tt.o value.o uci.o ucioption.o \
53 mersenne.o book.o bitbase.o san.o benchmark.o
56 ### General rules. Do not change
62 @echo "Makefile options:"
64 @echo "make > Default: Compiler = g++"
65 @echo "make icc > Compiler = icpc"
66 @echo "make icc-profile > Compiler = icpc + automatic pgo-build"
67 @echo "make osx-ppc32 > PPC-Mac OS X 32 bit. Compiler = g++"
68 @echo "make osx-ppc64 > PPC-Mac OS X 64 bit. Compiler = g++"
69 @echo "make osx-x86 > x86-Mac OS X 32 bit. Compiler = g++"
70 @echo "make osx-x86_64 > x86-Mac OS X 64 bit. Compiler = g++"
71 @echo "make clean > Clean up"
77 $(RM) *.o .depend *~ $(EXE)
80 ### Possible targets. You may add your own ones here
84 CXXFLAGS="$(GCCFLAGS)" \
90 CXXFLAGS="$(ICCFLAGS)" \
96 CXXFLAGS="$(ICCFLAGS)" \
97 CXXFLAGS+='-prof-gen=srcpos -prof_dir ./profdir' \
103 CXXFLAGS="$(ICCFLAGS)" \
104 CXXFLAGS+='-prof_use -prof_dir ./profdir' \
111 $(MAKE) icc-profile-make
113 @echo "Running benchmark for pgo-build ..."
114 @$(PGOBENCH) > /dev/null
115 @echo "Benchmark finished. Build final executable now ..."
118 $(MAKE) icc-profile-use
119 @rm -rf profdir bench.txt
124 CXXFLAGS="$(GCCFLAGS)" \
125 CXXFLAGS+='-arch ppc' \
126 LDFLAGS+='-arch ppc' \
132 CXXFLAGS="$(GCCFLAGS)" \
133 CXXFLAGS+='-arch ppc64' \
134 LDFLAGS+='-arch ppc64' \
140 CXXFLAGS="$(GCCFLAGS)" \
141 CXXFLAGS+='-arch i386' \
142 LDFLAGS+='-arch i386' \
148 CXXFLAGS="$(GCCFLAGS)" \
149 CXXFLAGS+='-arch x86_64' \
150 LDFLAGS+='-arch x86_64' \
154 ### Compilation. Do not change
156 $(CXX) $(LDFLAGS) -o $@ $(OBJS)
159 ### Dependencies. Do not change
161 $(CXX) -MM $(OBJS:.o=.cpp) > $@