]> git.sesse.net Git - stockfish/blob - src/Makefile
If near beta generate checks at -OnePly
[stockfish] / src / Makefile
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
4
5 # This file is part of Stockfish.
6 #
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.
11 #
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.
16 #
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/>.
19
20
21 ### Executable name. Do not change
22 EXE = stockfish
23
24
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 ### ==========================================================================
29 GCCFLAGS = -O3 -msse
30 ICCFLAGS = -fast -msse
31 ICCFLAGS-OSX = -fast -mdynamic-no-pic
32
33
34 ### ==========================================================================
35 ### Enable/disable debugging, disabled by default
36 ### ==========================================================================
37 GCCFLAGS += -DNDEBUG
38 ICCFLAGS += -DNDEBUG
39 ICCFLAGS-OSX += -DNDEBUG
40
41
42 ### ==========================================================================
43 ### Remove below comments to compile for a big-endian machine
44 ### ==========================================================================
45 #GCCFLAGS += -DBIGENDIAN
46 #ICCFLAGS += -DBIGENDIAN
47 #ICCFLAGS-OSX += -DBIGENDIAN
48
49
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
55
56
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
61
62
63 ### General linker settings. Do not change
64 LDFLAGS  = -lpthread
65
66
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
72
73
74 ### General rules. Do not change
75 default:
76         $(MAKE) gcc
77
78 help:
79         @echo ""
80         @echo "Makefile options:"
81         @echo ""
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 icc-profile-popcnt >  Compiler = icpc + automatic pgo-build + popcnt-support"
86         @echo "make osx-ppc32      >  PPC-Mac OS X 32 bit. Compiler = g++"
87         @echo "make osx-ppc64      >  PPC-Mac OS X 64 bit. Compiler = g++"
88         @echo "make osx-x86        >  x86-Mac OS X 32 bit. Compiler = g++"
89         @echo "make osx-x86_64     >  x86-Mac OS X 64 bit. Compiler = g++"
90         @echo "make osx-icc32      >  x86-Mac OS X 32 bit. Compiler = icpc"
91         @echo "make osx-icc64      >  x86-Mac OS X 64 bit. Compiler = icpc"
92         @echo "make osx-icc32-profile > OSX 32 bit. Compiler = icpc + automatic pgo-build"
93         @echo "make osx-icc64-profile > OSX 64 bit. Compiler = icpc + automatic pgo-build"
94         @echo "make strip          >  Strip executable"
95         @echo "make clean          >  Clean up"
96         @echo ""
97
98 all: $(EXE) .depend
99
100 clean:
101         $(RM) *.o .depend *~ $(EXE)
102
103
104 ### Possible targets. You may add your own ones here
105 gcc:
106         $(MAKE) \
107         CXX='g++' \
108         CXXFLAGS="$(GCCFLAGS)" \
109         all
110
111 icc:
112         $(MAKE) \
113         CXX='icpc' \
114         CXXFLAGS="$(ICCFLAGS)" \
115         all
116
117 icc-profile-make:
118         $(MAKE) \
119         CXX='icpc' \
120         CXXFLAGS="$(ICCFLAGS)" \
121         CXXFLAGS+='-prof-gen=srcpos -prof_dir ./profdir' \
122         all
123
124 icc-profile-use:
125         $(MAKE) \
126         CXX='icpc' \
127         CXXFLAGS="$(ICCFLAGS)" \
128         CXXFLAGS+='-prof_use -prof_dir ./profdir' \
129         all
130
131 icc-profile:
132         @rm -rf profdir
133         @mkdir profdir
134         @touch *.cpp *.h
135         $(MAKE) icc-profile-make
136         @echo ""
137         @echo "Running benchmark for pgo-build ..."
138         @$(PGOBENCH) > /dev/null
139         @echo "Benchmark finished. Build final executable now ..."
140         @echo ""
141         @touch *.cpp *.h
142         $(MAKE) icc-profile-use
143         @rm -rf profdir bench.txt
144
145 icc-profile-make-with-popcnt:
146         $(MAKE) \
147         CXX='icpc' \
148         CXXFLAGS="$(ICCFLAGS) -DUSE_POPCNT" \
149         CXXFLAGS+='-prof-gen=srcpos -prof_dir ./profdir' \
150         all
151
152 icc-profile-use-with-popcnt:
153         $(MAKE) \
154         CXX='icpc' \
155         CXXFLAGS="$(ICCFLAGS) -DUSE_POPCNT" \
156         CXXFLAGS+='-prof_use -prof_dir ./profdir' \
157         all
158
159 icc-profile-popcnt:
160         @rm -rf profdir
161         @mkdir profdir
162         @touch *.cpp *.h
163         $(MAKE) icc-profile-make
164         @echo ""
165         @echo "Running benchmark for pgo-build (popcnt disabled)..."
166         @$(PGOBENCH) > /dev/null
167         @touch *.cpp *.h
168         $(MAKE) icc-profile-make-with-popcnt
169         @echo ""
170         @echo "Running benchmark for pgo-build (popcnt enabled)..."
171         @$(PGOBENCH) > /dev/null
172         @echo "Benchmarks finished. Build final executable now ..."
173         @echo ""
174         @touch *.cpp *.h
175         $(MAKE) icc-profile-use-with-popcnt
176         @rm -rf profdir bench.txt
177
178
179 osx-ppc32:
180         $(MAKE) \
181         CXX='g++' \
182         CXXFLAGS="$(GCCFLAGS)" \
183         CXXFLAGS+='-arch ppc' \
184         LDFLAGS+='-arch ppc' \
185         all
186
187 osx-ppc64:
188         $(MAKE) \
189         CXX='g++' \
190         CXXFLAGS="$(GCCFLAGS)" \
191         CXXFLAGS+='-arch ppc64' \
192         LDFLAGS+='-arch ppc64' \
193         all
194
195 osx-x86:
196         $(MAKE) \
197         CXX='g++' \
198         CXXFLAGS="$(GCCFLAGS)" \
199         CXXFLAGS+='-arch i386' \
200         LDFLAGS+='-arch i386' \
201         all
202
203 osx-x86_64:
204         $(MAKE) \
205         CXX='g++' \
206         CXXFLAGS="$(GCCFLAGS)" \
207         CXXFLAGS+='-arch x86_64' \
208         LDFLAGS+='-arch x86_64' \
209         all
210         
211 osx-icc32:
212         $(MAKE) \
213         CXX='icpc' \
214         CXXFLAGS="$(ICCFLAGS-OSX)" \
215         CXXFLAGS+='-arch i386' \
216         LDFLAGS+='-arch i386' \
217         all
218
219 osx-icc64:
220         $(MAKE) \
221         CXX='icpc' \
222         CXXFLAGS="$(ICCFLAGS-OSX)" \
223         CXXFLAGS+='-arch x86_64' \
224         LDFLAGS+='-arch x86_64' \
225         all
226
227 osx-icc32-profile-make:
228         $(MAKE) \
229         CXX='icpc' \
230         CXXFLAGS="$(ICCFLAGS-OSX)" \
231         CXXFLAGS+='-arch i386' \
232         CXXFLAGS+='-prof_gen -prof_dir ./profdir' \
233         LDFLAGS+='-arch i386' \
234         all
235
236 osx-icc32-profile-use:
237         $(MAKE) \
238         CXX='icpc' \
239         CXXFLAGS="$(ICCFLAGS-OSX)" \
240         CXXFLAGS+='-arch i386' \
241         CXXFLAGS+='-prof_use -prof_dir ./profdir' \
242         LDFLAGS+='-arch i386' \
243         all
244
245 osx-icc32-profile:
246         @rm -rf profdir
247         @mkdir profdir
248         @touch *.cpp *.h
249         $(MAKE) osx-icc32-profile-make
250         @echo ""
251         @echo "Running benchmark for pgo-build ..."
252         @$(PGOBENCH) > /dev/null
253         @echo "Benchmark finished. Build final executable now ..."
254         @echo ""
255         @touch *.cpp *.h
256         $(MAKE) osx-icc32-profile-use
257         @rm -rf profdir bench.txt
258
259 osx-icc64-profile-make:
260         $(MAKE) \
261         CXX='icpc' \
262         CXXFLAGS="$(ICCFLAGS-OSX)" \
263         CXXFLAGS+='-arch x86_64' \
264         CXXFLAGS+='-prof_gen -prof_dir ./profdir' \
265         LDFLAGS+='-arch x86_64' \
266         all
267
268 osx-icc64-profile-use:
269         $(MAKE) \
270         CXX='icpc' \
271         CXXFLAGS="$(ICCFLAGS-OSX)" \
272         CXXFLAGS+='-arch x86_64' \
273         CXXFLAGS+='-prof_use -prof_dir ./profdir' \
274         LDFLAGS+='-arch x86_64' \
275         all
276
277 osx-icc64-profile:
278         @rm -rf profdir
279         @mkdir profdir
280         @touch *.cpp *.h
281         $(MAKE) osx-icc64-profile-make
282         @echo ""
283         @echo "Running benchmark for pgo-build ..."
284         @$(PGOBENCH) > /dev/null
285         @echo "Benchmark finished. Build final executable now ..."
286         @echo ""
287         @touch *.cpp *.h
288         $(MAKE) osx-icc64-profile-use
289         @rm -rf profdir bench.txt
290
291
292
293 strip:
294         strip $(EXE)
295
296
297 ### Compilation. Do not change
298 $(EXE): $(OBJS)
299         $(CXX) $(LDFLAGS) -o $@ $(OBJS)
300
301
302 ### Dependencies. Do not change
303 .depend:
304         $(CXX) -msse -MM $(OBJS:.o=.cpp) > $@
305
306 include .depend