]> git.sesse.net Git - stockfish/blob - src/Makefile
Be sure negative see evasions are at the bottom
[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 gcc-popcnt     >  Compiler = g++ + popcnt-support"
84         @echo "make icc            >  Compiler = icpc"
85         @echo "make icc-profile    >  Compiler = icpc + automatic pgo-build"
86         @echo "make icc-profile-popcnt >  Compiler = icpc + automatic pgo-build + popcnt-support"
87         @echo "make osx-ppc32      >  PPC-Mac OS X 32 bit. Compiler = g++"
88         @echo "make osx-ppc64      >  PPC-Mac OS X 64 bit. Compiler = g++"
89         @echo "make osx-x86        >  x86-Mac OS X 32 bit. Compiler = g++"
90         @echo "make osx-x86_64     >  x86-Mac OS X 64 bit. Compiler = g++"
91         @echo "make osx-icc32      >  x86-Mac OS X 32 bit. Compiler = icpc"
92         @echo "make osx-icc64      >  x86-Mac OS X 64 bit. Compiler = icpc"
93         @echo "make osx-icc32-profile > OSX 32 bit. Compiler = icpc + automatic pgo-build"
94         @echo "make osx-icc64-profile > OSX 64 bit. Compiler = icpc + automatic pgo-build"
95         @echo "make strip          >  Strip executable"
96         @echo "make clean          >  Clean up"
97         @echo ""
98
99 all: $(EXE) .depend
100
101 clean:
102         $(RM) *.o .depend *~ $(EXE)
103
104
105 ### Possible targets. You may add your own ones here
106 gcc:
107         $(MAKE) \
108         CXX='g++' \
109         CXXFLAGS="$(GCCFLAGS)" \
110         all
111
112 gcc-popcnt:
113         $(MAKE) \
114         CXX='g++' \
115         CXXFLAGS="$(GCCFLAGS) -DUSE_POPCNT" \
116         all
117
118
119 icc:
120         $(MAKE) \
121         CXX='icpc' \
122         CXXFLAGS="$(ICCFLAGS)" \
123         all
124
125 icc-profile-make:
126         $(MAKE) \
127         CXX='icpc' \
128         CXXFLAGS="$(ICCFLAGS)" \
129         CXXFLAGS+='-prof-gen=srcpos -prof_dir ./profdir' \
130         all
131
132 icc-profile-use:
133         $(MAKE) \
134         CXX='icpc' \
135         CXXFLAGS="$(ICCFLAGS)" \
136         CXXFLAGS+='-prof_use -prof_dir ./profdir' \
137         all
138
139 icc-profile:
140         @rm -rf profdir
141         @mkdir profdir
142         @touch *.cpp *.h
143         $(MAKE) icc-profile-make
144         @echo ""
145         @echo "Running benchmark for pgo-build ..."
146         @$(PGOBENCH) > /dev/null
147         @echo "Benchmark finished. Build final executable now ..."
148         @echo ""
149         @touch *.cpp *.h
150         $(MAKE) icc-profile-use
151         @rm -rf profdir bench.txt
152
153 icc-profile-make-with-popcnt:
154         $(MAKE) \
155         CXX='icpc' \
156         CXXFLAGS="$(ICCFLAGS) -DUSE_POPCNT" \
157         CXXFLAGS+='-prof-gen=srcpos -prof_dir ./profdir' \
158         all
159
160 icc-profile-use-with-popcnt:
161         $(MAKE) \
162         CXX='icpc' \
163         CXXFLAGS="$(ICCFLAGS) -DUSE_POPCNT" \
164         CXXFLAGS+='-prof_use -prof_dir ./profdir' \
165         all
166
167 icc-profile-popcnt:
168         @rm -rf profdir
169         @mkdir profdir
170         @touch *.cpp *.h
171         $(MAKE) icc-profile-make
172         @echo ""
173         @echo "Running benchmark for pgo-build (popcnt disabled)..."
174         @$(PGOBENCH) > /dev/null
175         @touch *.cpp *.h
176         $(MAKE) icc-profile-make-with-popcnt
177         @echo ""
178         @echo "Running benchmark for pgo-build (popcnt enabled)..."
179         @$(PGOBENCH) > /dev/null
180         @echo "Benchmarks finished. Build final executable now ..."
181         @echo ""
182         @touch *.cpp *.h
183         $(MAKE) icc-profile-use-with-popcnt
184         @rm -rf profdir bench.txt
185
186
187 osx-ppc32:
188         $(MAKE) \
189         CXX='g++' \
190         CXXFLAGS="$(GCCFLAGS)" \
191         CXXFLAGS+='-arch ppc' \
192         LDFLAGS+='-arch ppc' \
193         all
194
195 osx-ppc64:
196         $(MAKE) \
197         CXX='g++' \
198         CXXFLAGS="$(GCCFLAGS)" \
199         CXXFLAGS+='-arch ppc64' \
200         LDFLAGS+='-arch ppc64' \
201         all
202
203 osx-x86:
204         $(MAKE) \
205         CXX='g++' \
206         CXXFLAGS="$(GCCFLAGS)" \
207         CXXFLAGS+='-arch i386' \
208         LDFLAGS+='-arch i386' \
209         all
210
211 osx-x86_64:
212         $(MAKE) \
213         CXX='g++' \
214         CXXFLAGS="$(GCCFLAGS)" \
215         CXXFLAGS+='-arch x86_64' \
216         LDFLAGS+='-arch x86_64' \
217         all
218         
219 osx-icc32:
220         $(MAKE) \
221         CXX='icpc' \
222         CXXFLAGS="$(ICCFLAGS-OSX)" \
223         CXXFLAGS+='-arch i386' \
224         LDFLAGS+='-arch i386' \
225         all
226
227 osx-icc64:
228         $(MAKE) \
229         CXX='icpc' \
230         CXXFLAGS="$(ICCFLAGS-OSX)" \
231         CXXFLAGS+='-arch x86_64' \
232         LDFLAGS+='-arch x86_64' \
233         all
234
235 osx-icc32-profile-make:
236         $(MAKE) \
237         CXX='icpc' \
238         CXXFLAGS="$(ICCFLAGS-OSX)" \
239         CXXFLAGS+='-arch i386' \
240         CXXFLAGS+='-prof_gen -prof_dir ./profdir' \
241         LDFLAGS+='-arch i386' \
242         all
243
244 osx-icc32-profile-use:
245         $(MAKE) \
246         CXX='icpc' \
247         CXXFLAGS="$(ICCFLAGS-OSX)" \
248         CXXFLAGS+='-arch i386' \
249         CXXFLAGS+='-prof_use -prof_dir ./profdir' \
250         LDFLAGS+='-arch i386' \
251         all
252
253 osx-icc32-profile:
254         @rm -rf profdir
255         @mkdir profdir
256         @touch *.cpp *.h
257         $(MAKE) osx-icc32-profile-make
258         @echo ""
259         @echo "Running benchmark for pgo-build ..."
260         @$(PGOBENCH) > /dev/null
261         @echo "Benchmark finished. Build final executable now ..."
262         @echo ""
263         @touch *.cpp *.h
264         $(MAKE) osx-icc32-profile-use
265         @rm -rf profdir bench.txt
266
267 osx-icc64-profile-make:
268         $(MAKE) \
269         CXX='icpc' \
270         CXXFLAGS="$(ICCFLAGS-OSX)" \
271         CXXFLAGS+='-arch x86_64' \
272         CXXFLAGS+='-prof_gen -prof_dir ./profdir' \
273         LDFLAGS+='-arch x86_64' \
274         all
275
276 osx-icc64-profile-use:
277         $(MAKE) \
278         CXX='icpc' \
279         CXXFLAGS="$(ICCFLAGS-OSX)" \
280         CXXFLAGS+='-arch x86_64' \
281         CXXFLAGS+='-prof_use -prof_dir ./profdir' \
282         LDFLAGS+='-arch x86_64' \
283         all
284
285 osx-icc64-profile:
286         @rm -rf profdir
287         @mkdir profdir
288         @touch *.cpp *.h
289         $(MAKE) osx-icc64-profile-make
290         @echo ""
291         @echo "Running benchmark for pgo-build ..."
292         @$(PGOBENCH) > /dev/null
293         @echo "Benchmark finished. Build final executable now ..."
294         @echo ""
295         @touch *.cpp *.h
296         $(MAKE) osx-icc64-profile-use
297         @rm -rf profdir bench.txt
298
299
300
301 strip:
302         strip $(EXE)
303
304
305 ### Compilation. Do not change
306 $(EXE): $(OBJS)
307         $(CXX) $(LDFLAGS) -o $@ $(OBJS)
308
309
310 ### Dependencies. Do not change
311 .depend:
312         $(CXX) -msse -MM $(OBJS:.o=.cpp) > $@
313
314 include .depend