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 ### Enable/disable debugging, disabled by default
35 ### ==========================================================================
40 ### ==========================================================================
41 ### Run built-in benchmark for pgo-builds with: 32MB hash 1 thread 10 depth
42 ### These settings are generally fast, but may be changed experimentally
43 ### ==========================================================================
44 PGOBENCH = ./$(EXE) bench 32 1 10 default depth
47 ### General compiler settings. Do not change
48 GCCFLAGS += -g -Wall -fno-exceptions -fno-rtti -fno-strict-aliasing
49 ICCFLAGS += -g -Wall -fno-exceptions -fno-rtti -fno-strict-aliasing -wd383,869,981,10187,10188,11505,11503
52 ### General linker settings. Do not change
56 ### Object files. Do not change
57 OBJS = application.o bitboard.o pawns.o material.o endgame.o evaluate.o main.o \
58 misc.o move.o movegen.o history.o movepick.o search.o piece.o \
59 position.o direction.o tt.o value.o uci.o ucioption.o \
60 mersenne.o book.o bitbase.o san.o benchmark.o
63 ### General rules. Do not change
69 @echo "Makefile options:"
71 @echo "make > Default: Compiler = g++"
72 @echo "make icc > Compiler = icpc"
73 @echo "make icc-profile > Compiler = icpc + automatic pgo-build"
74 @echo "make osx-ppc32 > PPC-Mac OS X 32 bit. Compiler = g++"
75 @echo "make osx-ppc64 > PPC-Mac OS X 64 bit. Compiler = g++"
76 @echo "make osx-x86 > x86-Mac OS X 32 bit. Compiler = g++"
77 @echo "make osx-x86_64 > x86-Mac OS X 64 bit. Compiler = g++"
78 @echo "make clean > Clean up"
84 $(RM) *.o .depend *~ $(EXE)
87 ### Possible targets. You may add your own ones here
91 CXXFLAGS="$(GCCFLAGS)" \
97 CXXFLAGS="$(ICCFLAGS)" \
103 CXXFLAGS="$(ICCFLAGS)" \
104 CXXFLAGS+='-prof-gen=srcpos -prof_dir ./profdir' \
110 CXXFLAGS="$(ICCFLAGS)" \
111 CXXFLAGS+='-prof_use -prof_dir ./profdir' \
118 $(MAKE) icc-profile-make
120 @echo "Running benchmark for pgo-build ..."
121 @$(PGOBENCH) > /dev/null
122 @echo "Benchmark finished. Build final executable now ..."
125 $(MAKE) icc-profile-use
126 @rm -rf profdir bench.txt
131 CXXFLAGS="$(GCCFLAGS)" \
132 CXXFLAGS+='-arch ppc' \
133 LDFLAGS+='-arch ppc' \
139 CXXFLAGS="$(GCCFLAGS)" \
140 CXXFLAGS+='-arch ppc64' \
141 LDFLAGS+='-arch ppc64' \
147 CXXFLAGS="$(GCCFLAGS)" \
148 CXXFLAGS+='-arch i386' \
149 LDFLAGS+='-arch i386' \
155 CXXFLAGS="$(GCCFLAGS)" \
156 CXXFLAGS+='-arch x86_64' \
157 LDFLAGS+='-arch x86_64' \
161 ### Compilation. Do not change
163 $(CXX) $(LDFLAGS) -o $@ $(OBJS)
166 ### Dependencies. Do not change
168 $(CXX) -MM $(OBJS:.o=.cpp) > $@