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