]> git.sesse.net Git - stockfish/blob - src/Makefile
Score enum should be at least 32 bits
[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 ### NOTE: Some versions of gcc miscompile value.h with -O2 or -O3, this is the
30 ### safe setup, try changing to -O3 or -O2 and verify it works for you.
31 ### ==========================================================================
32 GCCFLAGS = -O1 -msse
33 ICCFLAGS = -fast -msse
34 ICCFLAGS-OSX = -fast -mdynamic-no-pic
35
36
37 ### ==========================================================================
38 ### Enable/disable debugging, disabled by default
39 ### ==========================================================================
40 GCCFLAGS += -DNDEBUG
41 ICCFLAGS += -DNDEBUG
42 ICCFLAGS-OSX += -DNDEBUG
43
44
45 ### ==========================================================================
46 ### Remove below comments to compile for a big-endian machine
47 ### ==========================================================================
48 #GCCFLAGS += -DBIGENDIAN
49 #ICCFLAGS += -DBIGENDIAN
50 #ICCFLAGS-OSX += -DBIGENDIAN
51
52
53 ### ==========================================================================
54 ### Run built-in benchmark for pgo-builds with:  32MB hash  1 thread  10 depth
55 ### These settings are generally fast, but may be changed experimentally
56 ### ==========================================================================
57 PGOBENCH = ./$(EXE) bench 32 1 10 default depth
58
59
60 ### General compiler settings. Do not change
61 GCCFLAGS += -g -Wall -fno-exceptions -fno-rtti
62 ICCFLAGS += -g -Wall -fno-exceptions -fno-rtti -wd383,869,981,10187,10188,11505,11503
63 ICCFLAGS-OSX += -g -Wall -fno-exceptions -fno-rtti -wd383,869,981,10187,10188,11505,11503
64
65
66 ### General linker settings. Do not change
67 LDFLAGS  = -lpthread
68
69
70 ### Object files. Do not change
71 OBJS = application.o bitboard.o pawns.o material.o endgame.o evaluate.o main.o \
72         misc.o move.o movegen.o history.o movepick.o search.o piece.o \
73         position.o direction.o tt.o value.o uci.o ucioption.o \
74         mersenne.o book.o bitbase.o san.o benchmark.o
75
76
77 ### General rules. Do not change
78 default:
79         $(MAKE) gcc
80
81 help:
82         @echo ""
83         @echo "Makefile options:"
84         @echo ""
85         @echo "make                >  Default: Compiler = g++"
86         @echo "make icc            >  Compiler = icpc"
87         @echo "make icc-profile    >  Compiler = icpc + automatic pgo-build"
88         @echo "make icc-profile-popcnt >  Compiler = icpc + automatic pgo-build + popcnt-support"
89         @echo "make osx-ppc32      >  PPC-Mac OS X 32 bit. Compiler = g++"
90         @echo "make osx-ppc64      >  PPC-Mac OS X 64 bit. Compiler = g++"
91         @echo "make osx-x86        >  x86-Mac OS X 32 bit. Compiler = g++"
92         @echo "make osx-x86_64     >  x86-Mac OS X 64 bit. Compiler = g++"
93         @echo "make osx-icc32      >  x86-Mac OS X 32 bit. Compiler = icpc"
94         @echo "make osx-icc64      >  x86-Mac OS X 64 bit. Compiler = icpc"
95         @echo "make osx-icc32-profile > OSX 32 bit. Compiler = icpc + automatic pgo-build"
96         @echo "make osx-icc64-profile > OSX 64 bit. Compiler = icpc + automatic pgo-build"
97         @echo "make strip          >  Strip executable"
98         @echo "make clean          >  Clean up"
99         @echo ""
100
101 all: $(EXE) .depend
102
103 clean:
104         $(RM) *.o .depend *~ $(EXE)
105
106
107 ### Possible targets. You may add your own ones here
108 gcc:
109         $(MAKE) \
110         CXX='g++' \
111         CXXFLAGS="$(GCCFLAGS)" \
112         all
113
114 icc:
115         $(MAKE) \
116         CXX='icpc' \
117         CXXFLAGS="$(ICCFLAGS)" \
118         all
119
120 icc-profile-make:
121         $(MAKE) \
122         CXX='icpc' \
123         CXXFLAGS="$(ICCFLAGS)" \
124         CXXFLAGS+='-prof-gen=srcpos -prof_dir ./profdir' \
125         all
126
127 icc-profile-use:
128         $(MAKE) \
129         CXX='icpc' \
130         CXXFLAGS="$(ICCFLAGS)" \
131         CXXFLAGS+='-prof_use -prof_dir ./profdir' \
132         all
133
134 icc-profile:
135         @rm -rf profdir
136         @mkdir profdir
137         @touch *.cpp *.h
138         $(MAKE) icc-profile-make
139         @echo ""
140         @echo "Running benchmark for pgo-build ..."
141         @$(PGOBENCH) > /dev/null
142         @echo "Benchmark finished. Build final executable now ..."
143         @echo ""
144         @touch *.cpp *.h
145         $(MAKE) icc-profile-use
146         @rm -rf profdir bench.txt
147
148 icc-profile-make-with-popcnt:
149         $(MAKE) \
150         CXX='icpc' \
151         CXXFLAGS="$(ICCFLAGS) -DUSE_POPCNT" \
152         CXXFLAGS+='-prof-gen=srcpos -prof_dir ./profdir' \
153         all
154
155 icc-profile-use-with-popcnt:
156         $(MAKE) \
157         CXX='icpc' \
158         CXXFLAGS="$(ICCFLAGS) -DUSE_POPCNT" \
159         CXXFLAGS+='-prof_use -prof_dir ./profdir' \
160         all
161
162 icc-profile-popcnt:
163         @rm -rf profdir
164         @mkdir profdir
165         @touch *.cpp *.h
166         $(MAKE) icc-profile-make
167         @echo ""
168         @echo "Running benchmark for pgo-build (popcnt disabled)..."
169         @$(PGOBENCH) > /dev/null
170         @touch *.cpp *.h
171         $(MAKE) icc-profile-make-with-popcnt
172         @echo ""
173         @echo "Running benchmark for pgo-build (popcnt enabled)..."
174         @$(PGOBENCH) > /dev/null
175         @echo "Benchmarks finished. Build final executable now ..."
176         @echo ""
177         @touch *.cpp *.h
178         $(MAKE) icc-profile-use-with-popcnt
179         @rm -rf profdir bench.txt
180
181
182 osx-ppc32:
183         $(MAKE) \
184         CXX='g++' \
185         CXXFLAGS="$(GCCFLAGS)" \
186         CXXFLAGS+='-arch ppc' \
187         LDFLAGS+='-arch ppc' \
188         all
189
190 osx-ppc64:
191         $(MAKE) \
192         CXX='g++' \
193         CXXFLAGS="$(GCCFLAGS)" \
194         CXXFLAGS+='-arch ppc64' \
195         LDFLAGS+='-arch ppc64' \
196         all
197
198 osx-x86:
199         $(MAKE) \
200         CXX='g++' \
201         CXXFLAGS="$(GCCFLAGS)" \
202         CXXFLAGS+='-arch i386' \
203         LDFLAGS+='-arch i386' \
204         all
205
206 osx-x86_64:
207         $(MAKE) \
208         CXX='g++' \
209         CXXFLAGS="$(GCCFLAGS)" \
210         CXXFLAGS+='-arch x86_64' \
211         LDFLAGS+='-arch x86_64' \
212         all
213         
214 osx-icc32:
215         $(MAKE) \
216         CXX='icpc' \
217         CXXFLAGS="$(ICCFLAGS-OSX)" \
218         CXXFLAGS+='-arch i386' \
219         LDFLAGS+='-arch i386' \
220         all
221
222 osx-icc64:
223         $(MAKE) \
224         CXX='icpc' \
225         CXXFLAGS="$(ICCFLAGS-OSX)" \
226         CXXFLAGS+='-arch x86_64' \
227         LDFLAGS+='-arch x86_64' \
228         all
229
230 osx-icc32-profile-make:
231         $(MAKE) \
232         CXX='icpc' \
233         CXXFLAGS="$(ICCFLAGS-OSX)" \
234         CXXFLAGS+='-arch i386' \
235         CXXFLAGS+='-prof_gen -prof_dir ./profdir' \
236         LDFLAGS+='-arch i386' \
237         all
238
239 osx-icc32-profile-use:
240         $(MAKE) \
241         CXX='icpc' \
242         CXXFLAGS="$(ICCFLAGS-OSX)" \
243         CXXFLAGS+='-arch i386' \
244         CXXFLAGS+='-prof_use -prof_dir ./profdir' \
245         LDFLAGS+='-arch i386' \
246         all
247
248 osx-icc32-profile:
249         @rm -rf profdir
250         @mkdir profdir
251         @touch *.cpp *.h
252         $(MAKE) osx-icc32-profile-make
253         @echo ""
254         @echo "Running benchmark for pgo-build ..."
255         @$(PGOBENCH) > /dev/null
256         @echo "Benchmark finished. Build final executable now ..."
257         @echo ""
258         @touch *.cpp *.h
259         $(MAKE) osx-icc32-profile-use
260         @rm -rf profdir bench.txt
261
262 osx-icc64-profile-make:
263         $(MAKE) \
264         CXX='icpc' \
265         CXXFLAGS="$(ICCFLAGS-OSX)" \
266         CXXFLAGS+='-arch x86_64' \
267         CXXFLAGS+='-prof_gen -prof_dir ./profdir' \
268         LDFLAGS+='-arch x86_64' \
269         all
270
271 osx-icc64-profile-use:
272         $(MAKE) \
273         CXX='icpc' \
274         CXXFLAGS="$(ICCFLAGS-OSX)" \
275         CXXFLAGS+='-arch x86_64' \
276         CXXFLAGS+='-prof_use -prof_dir ./profdir' \
277         LDFLAGS+='-arch x86_64' \
278         all
279
280 osx-icc64-profile:
281         @rm -rf profdir
282         @mkdir profdir
283         @touch *.cpp *.h
284         $(MAKE) osx-icc64-profile-make
285         @echo ""
286         @echo "Running benchmark for pgo-build ..."
287         @$(PGOBENCH) > /dev/null
288         @echo "Benchmark finished. Build final executable now ..."
289         @echo ""
290         @touch *.cpp *.h
291         $(MAKE) osx-icc64-profile-use
292         @rm -rf profdir bench.txt
293
294
295
296 strip:
297         strip $(EXE)
298
299
300 ### Compilation. Do not change
301 $(EXE): $(OBJS)
302         $(CXX) $(LDFLAGS) -o $@ $(OBJS)
303
304
305 ### Dependencies. Do not change
306 .depend:
307         $(CXX) -msse -MM $(OBJS:.o=.cpp) > $@
308
309 include .depend