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 ### Run built-in benchmark for pgo-builds with: 32MB hash 1 thread 10 depth
44 ### These settings are generally fast, but may be changed experimentally
45 ### ==========================================================================
46 PGOBENCH = ./$(EXE) bench 32 1 10 default depth
49 ### General compiler settings. Do not change
50 GCCFLAGS += -g -Wall -fno-exceptions -fno-rtti -fno-strict-aliasing
51 ICCFLAGS += -g -Wall -fno-exceptions -fno-rtti -fno-strict-aliasing -wd383,869,981,10187,10188,11505,11503
52 ICCFLAGS-OSX += -g -Wall -fno-exceptions -fno-rtti -fno-strict-aliasing -wd383,869,981,10187,10188,11505,11503
55 ### General linker settings. Do not change
59 ### Object files. Do not change
60 OBJS = application.o bitboard.o pawns.o material.o endgame.o evaluate.o main.o \
61 misc.o move.o movegen.o history.o movepick.o search.o piece.o \
62 position.o direction.o tt.o value.o uci.o ucioption.o \
63 mersenne.o book.o bitbase.o san.o benchmark.o
66 ### General rules. Do not change
72 @echo "Makefile options:"
74 @echo "make > Default: Compiler = g++"
75 @echo "make icc > Compiler = icpc"
76 @echo "make icc-profile > Compiler = icpc + automatic pgo-build"
77 @echo "make osx-ppc32 > PPC-Mac OS X 32 bit. Compiler = g++"
78 @echo "make osx-ppc64 > PPC-Mac OS X 64 bit. Compiler = g++"
79 @echo "make osx-x86 > x86-Mac OS X 32 bit. Compiler = g++"
80 @echo "make osx-x86_64 > x86-Mac OS X 64 bit. Compiler = g++"
81 @echo "make osx-icc32 > x86-Mac OS X 32 bit. Compiler = icpc"
82 @echo "make osx-icc64 > x86-Mac OS X 64 bit. Compiler = icpc"
83 @echo "make osx-icc32-profile > OSX 32 bit. Compiler = icpc + automatic pgo-build"
84 @echo "make osx-icc64-profile > OSX 64 bit. Compiler = icpc + automatic pgo-build"
85 @echo "make strip > Strip executable"
86 @echo "make clean > Clean up"
92 $(RM) *.o .depend *~ $(EXE)
95 ### Possible targets. You may add your own ones here
99 CXXFLAGS="$(GCCFLAGS)" \
105 CXXFLAGS="$(ICCFLAGS)" \
111 CXXFLAGS="$(ICCFLAGS)" \
112 CXXFLAGS+='-prof-gen=srcpos -prof_dir ./profdir' \
118 CXXFLAGS="$(ICCFLAGS)" \
119 CXXFLAGS+='-prof_use -prof_dir ./profdir' \
126 $(MAKE) icc-profile-make
128 @echo "Running benchmark for pgo-build ..."
129 @$(PGOBENCH) > /dev/null
130 @echo "Benchmark finished. Build final executable now ..."
133 $(MAKE) icc-profile-use
134 @rm -rf profdir bench.txt
139 CXXFLAGS="$(GCCFLAGS)" \
140 CXXFLAGS+='-arch ppc' \
141 LDFLAGS+='-arch ppc' \
147 CXXFLAGS="$(GCCFLAGS)" \
148 CXXFLAGS+='-arch ppc64' \
149 LDFLAGS+='-arch ppc64' \
155 CXXFLAGS="$(GCCFLAGS)" \
156 CXXFLAGS+='-arch i386' \
157 LDFLAGS+='-arch i386' \
163 CXXFLAGS="$(GCCFLAGS)" \
164 CXXFLAGS+='-arch x86_64' \
165 LDFLAGS+='-arch x86_64' \
171 CXXFLAGS="$(ICCFLAGS-OSX)" \
172 CXXFLAGS+='-arch i386' \
173 LDFLAGS+='-arch i386' \
179 CXXFLAGS="$(ICCFLAGS-OSX)" \
180 CXXFLAGS+='-arch x86_64' \
181 LDFLAGS+='-arch x86_64' \
184 osx-icc32-profile-make:
187 CXXFLAGS="$(ICCFLAGS-OSX)" \
188 CXXFLAGS+='-arch i386' \
189 CXXFLAGS+='-prof_gen -prof_dir ./profdir' \
190 LDFLAGS+='-arch i386' \
193 osx-icc32-profile-use:
196 CXXFLAGS="$(ICCFLAGS-OSX)" \
197 CXXFLAGS+='-arch i386' \
198 CXXFLAGS+='-prof_use -prof_dir ./profdir' \
199 LDFLAGS+='-arch i386' \
206 $(MAKE) osx-icc32-profile-make
208 @echo "Running benchmark for pgo-build ..."
209 @$(PGOBENCH) > /dev/null
210 @echo "Benchmark finished. Build final executable now ..."
213 $(MAKE) osx-icc32-profile-use
214 @rm -rf profdir bench.txt
216 osx-icc64-profile-make:
219 CXXFLAGS="$(ICCFLAGS-OSX)" \
220 CXXFLAGS+='-arch x86_64' \
221 CXXFLAGS+='-prof_gen -prof_dir ./profdir' \
222 LDFLAGS+='-arch x86_64' \
225 osx-icc64-profile-use:
228 CXXFLAGS="$(ICCFLAGS-OSX)" \
229 CXXFLAGS+='-arch x86_64' \
230 CXXFLAGS+='-prof_use -prof_dir ./profdir' \
231 LDFLAGS+='-arch x86_64' \
238 $(MAKE) osx-icc64-profile-make
240 @echo "Running benchmark for pgo-build ..."
241 @$(PGOBENCH) > /dev/null
242 @echo "Benchmark finished. Build final executable now ..."
245 $(MAKE) osx-icc64-profile-use
246 @rm -rf profdir bench.txt
254 ### Compilation. Do not change
256 $(CXX) $(LDFLAGS) -o $@ $(OBJS)
259 ### Dependencies. Do not change
261 $(CXX) -msse -MM $(OBJS:.o=.cpp) > $@