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 ### ==========================================================================
30 ICCFLAGS = -fast -msse
31 ICCFLAGS-OSX = -fast -mdynamic-no-pic
34 ### ==========================================================================
35 ### Enable/disable debugging, disabled by default
36 ### ==========================================================================
39 ICCFLAGS-OSX += -DNDEBUG
42 ### ==========================================================================
43 ### Enable/disable compile for a big-endian CPU, disabled by default
44 ### ==========================================================================
45 GCCFLAGS += -DNBIGENDIAN
46 ICCFLAGS += -DNBIGENDIAN
47 ICCFLAGS-OSX += -DNBIGENDIAN
50 ### ==========================================================================
51 ### Run built-in benchmark for pgo-builds with: 32MB hash 1 thread 10 depth
52 ### These settings are generally fast, but may be changed experimentally
53 ### ==========================================================================
54 PGOBENCH = ./$(EXE) bench 32 1 10 default depth
57 ### General compiler settings. Do not change
58 GCCFLAGS += -g -Wall -fno-exceptions -fno-rtti
59 ICCFLAGS += -g -Wall -fno-exceptions -fno-rtti -wd383,869,981,10187,10188,11505,11503
60 ICCFLAGS-OSX += -g -Wall -fno-exceptions -fno-rtti -wd383,869,981,10187,10188,11505,11503
63 ### General linker settings. Do not change
67 ### Object files. Do not change
68 OBJS = application.o bitboard.o pawns.o material.o endgame.o evaluate.o main.o \
69 misc.o move.o movegen.o history.o movepick.o search.o piece.o \
70 position.o direction.o tt.o value.o uci.o ucioption.o \
71 mersenne.o book.o bitbase.o san.o benchmark.o
74 ### General rules. Do not change
80 @echo "Makefile options:"
82 @echo "make > Default: Compiler = g++"
83 @echo "make icc > Compiler = icpc"
84 @echo "make icc-profile > Compiler = icpc + automatic pgo-build"
85 @echo "make osx-ppc32 > PPC-Mac OS X 32 bit. Compiler = g++"
86 @echo "make osx-ppc64 > PPC-Mac OS X 64 bit. Compiler = g++"
87 @echo "make osx-x86 > x86-Mac OS X 32 bit. Compiler = g++"
88 @echo "make osx-x86_64 > x86-Mac OS X 64 bit. Compiler = g++"
89 @echo "make osx-icc32 > x86-Mac OS X 32 bit. Compiler = icpc"
90 @echo "make osx-icc64 > x86-Mac OS X 64 bit. Compiler = icpc"
91 @echo "make osx-icc32-profile > OSX 32 bit. Compiler = icpc + automatic pgo-build"
92 @echo "make osx-icc64-profile > OSX 64 bit. Compiler = icpc + automatic pgo-build"
93 @echo "make strip > Strip executable"
94 @echo "make clean > Clean up"
100 $(RM) *.o .depend *~ $(EXE)
103 ### Possible targets. You may add your own ones here
107 CXXFLAGS="$(GCCFLAGS)" \
113 CXXFLAGS="$(ICCFLAGS)" \
119 CXXFLAGS="$(ICCFLAGS)" \
120 CXXFLAGS+='-prof-gen=srcpos -prof_dir ./profdir' \
126 CXXFLAGS="$(ICCFLAGS)" \
127 CXXFLAGS+='-prof_use -prof_dir ./profdir' \
134 $(MAKE) icc-profile-make
136 @echo "Running benchmark for pgo-build ..."
137 @$(PGOBENCH) > /dev/null
138 @echo "Benchmark finished. Build final executable now ..."
141 $(MAKE) icc-profile-use
142 @rm -rf profdir bench.txt
147 CXXFLAGS="$(GCCFLAGS)" \
148 CXXFLAGS+='-arch ppc' \
149 LDFLAGS+='-arch ppc' \
155 CXXFLAGS="$(GCCFLAGS)" \
156 CXXFLAGS+='-arch ppc64' \
157 LDFLAGS+='-arch ppc64' \
163 CXXFLAGS="$(GCCFLAGS)" \
164 CXXFLAGS+='-arch i386' \
165 LDFLAGS+='-arch i386' \
171 CXXFLAGS="$(GCCFLAGS)" \
172 CXXFLAGS+='-arch x86_64' \
173 LDFLAGS+='-arch x86_64' \
179 CXXFLAGS="$(ICCFLAGS-OSX)" \
180 CXXFLAGS+='-arch i386' \
181 LDFLAGS+='-arch i386' \
187 CXXFLAGS="$(ICCFLAGS-OSX)" \
188 CXXFLAGS+='-arch x86_64' \
189 LDFLAGS+='-arch x86_64' \
192 osx-icc32-profile-make:
195 CXXFLAGS="$(ICCFLAGS-OSX)" \
196 CXXFLAGS+='-arch i386' \
197 CXXFLAGS+='-prof_gen -prof_dir ./profdir' \
198 LDFLAGS+='-arch i386' \
201 osx-icc32-profile-use:
204 CXXFLAGS="$(ICCFLAGS-OSX)" \
205 CXXFLAGS+='-arch i386' \
206 CXXFLAGS+='-prof_use -prof_dir ./profdir' \
207 LDFLAGS+='-arch i386' \
214 $(MAKE) osx-icc32-profile-make
216 @echo "Running benchmark for pgo-build ..."
217 @$(PGOBENCH) > /dev/null
218 @echo "Benchmark finished. Build final executable now ..."
221 $(MAKE) osx-icc32-profile-use
222 @rm -rf profdir bench.txt
224 osx-icc64-profile-make:
227 CXXFLAGS="$(ICCFLAGS-OSX)" \
228 CXXFLAGS+='-arch x86_64' \
229 CXXFLAGS+='-prof_gen -prof_dir ./profdir' \
230 LDFLAGS+='-arch x86_64' \
233 osx-icc64-profile-use:
236 CXXFLAGS="$(ICCFLAGS-OSX)" \
237 CXXFLAGS+='-arch x86_64' \
238 CXXFLAGS+='-prof_use -prof_dir ./profdir' \
239 LDFLAGS+='-arch x86_64' \
246 $(MAKE) osx-icc64-profile-make
248 @echo "Running benchmark for pgo-build ..."
249 @$(PGOBENCH) > /dev/null
250 @echo "Benchmark finished. Build final executable now ..."
253 $(MAKE) osx-icc64-profile-use
254 @rm -rf profdir bench.txt
262 ### Compilation. Do not change
264 $(CXX) $(LDFLAGS) -o $@ $(OBJS)
267 ### Dependencies. Do not change
269 $(CXX) -msse -MM $(OBJS:.o=.cpp) > $@