]> git.sesse.net Git - stockfish/blob - src/Makefile
Update piece list iteration also in evaluate_pieces()
[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 ### Run built-in benchmark for pgo-builds with:  32MB hash  1 thread  10 depth
44 ### These settings are generally fast, but may be changed experimentally
45 ### ==========================================================================
46 PGOBENCH = ./$(EXE) bench 32 1 10 default depth
47
48
49 ### General compiler settings. Do not change
50 GCCFLAGS += -g -Wall -fno-exceptions -fno-rtti -fno-strict-aliasing
51 ICCFLAGS += -g -Wall -fno-exceptions -fno-rtti -fno-strict-aliasing -wd383,869,981,10187,10188,11505,11503
52 ICCFLAGS-OSX += -g -Wall -fno-exceptions -fno-rtti -fno-strict-aliasing -wd383,869,981,10187,10188,11505,11503
53
54
55 ### General linker settings. Do not change
56 LDFLAGS  = -lpthread
57
58
59 ### Object files. Do not change
60 OBJS = application.o bitboard.o pawns.o material.o endgame.o evaluate.o main.o \
61         misc.o move.o movegen.o history.o movepick.o search.o piece.o \
62         position.o direction.o tt.o value.o uci.o ucioption.o \
63         mersenne.o book.o bitbase.o san.o benchmark.o
64
65
66 ### General rules. Do not change
67 default:
68         $(MAKE) gcc
69
70 help:
71         @echo ""
72         @echo "Makefile options:"
73         @echo ""
74         @echo "make                >  Default: Compiler = g++"
75         @echo "make icc            >  Compiler = icpc"
76         @echo "make icc-profile    >  Compiler = icpc + automatic pgo-build"
77         @echo "make osx-ppc32      >  PPC-Mac OS X 32 bit. Compiler = g++"
78         @echo "make osx-ppc64      >  PPC-Mac OS X 64 bit. Compiler = g++"
79         @echo "make osx-x86        >  x86-Mac OS X 32 bit. Compiler = g++"
80         @echo "make osx-x86_64     >  x86-Mac OS X 64 bit. Compiler = g++"
81         @echo "make osx-icc32      >  x86-Mac OS X 32 bit. Compiler = icpc"
82         @echo "make osx-icc64      >  x86-Mac OS X 64 bit. Compiler = icpc"
83         @echo "make osx-icc32-profile > OSX 32 bit. Compiler = icpc + automatic pgo-build"
84         @echo "make osx-icc64-profile > OSX 64 bit. Compiler = icpc + automatic pgo-build"
85         @echo "make strip          >  Strip executable"
86         @echo "make clean          >  Clean up"
87         @echo ""
88
89 all: $(EXE) .depend
90
91 clean:
92         $(RM) *.o .depend *~ $(EXE)
93
94
95 ### Possible targets. You may add your own ones here
96 gcc:
97         $(MAKE) \
98         CXX='g++' \
99         CXXFLAGS="$(GCCFLAGS)" \
100         all
101
102 icc:
103         $(MAKE) \
104         CXX='icpc' \
105         CXXFLAGS="$(ICCFLAGS)" \
106         all
107
108 icc-profile-make:
109         $(MAKE) \
110         CXX='icpc' \
111         CXXFLAGS="$(ICCFLAGS)" \
112         CXXFLAGS+='-prof-gen=srcpos -prof_dir ./profdir' \
113         all
114
115 icc-profile-use:
116         $(MAKE) \
117         CXX='icpc' \
118         CXXFLAGS="$(ICCFLAGS)" \
119         CXXFLAGS+='-prof_use -prof_dir ./profdir' \
120         all
121
122 icc-profile:
123         @rm -rf profdir
124         @mkdir profdir
125         @touch *.cpp *.h
126         $(MAKE) icc-profile-make
127         @echo ""
128         @echo "Running benchmark for pgo-build ..."
129         @$(PGOBENCH) > /dev/null
130         @echo "Benchmark finished. Build final executable now ..."
131         @echo ""
132         @touch *.cpp *.h
133         $(MAKE) icc-profile-use
134         @rm -rf profdir bench.txt
135
136 osx-ppc32:
137         $(MAKE) \
138         CXX='g++' \
139         CXXFLAGS="$(GCCFLAGS)" \
140         CXXFLAGS+='-arch ppc' \
141         LDFLAGS+='-arch ppc' \
142         all
143
144 osx-ppc64:
145         $(MAKE) \
146         CXX='g++' \
147         CXXFLAGS="$(GCCFLAGS)" \
148         CXXFLAGS+='-arch ppc64' \
149         LDFLAGS+='-arch ppc64' \
150         all
151
152 osx-x86:
153         $(MAKE) \
154         CXX='g++' \
155         CXXFLAGS="$(GCCFLAGS)" \
156         CXXFLAGS+='-arch i386' \
157         LDFLAGS+='-arch i386' \
158         all
159
160 osx-x86_64:
161         $(MAKE) \
162         CXX='g++' \
163         CXXFLAGS="$(GCCFLAGS)" \
164         CXXFLAGS+='-arch x86_64' \
165         LDFLAGS+='-arch x86_64' \
166         all
167         
168 osx-icc32:
169         $(MAKE) \
170         CXX='icpc' \
171         CXXFLAGS="$(ICCFLAGS-OSX)" \
172         CXXFLAGS+='-arch i386' \
173         LDFLAGS+='-arch i386' \
174         all
175
176 osx-icc64:
177         $(MAKE) \
178         CXX='icpc' \
179         CXXFLAGS="$(ICCFLAGS-OSX)" \
180         CXXFLAGS+='-arch x86_64' \
181         LDFLAGS+='-arch x86_64' \
182         all
183
184 osx-icc32-profile-make:
185         $(MAKE) \
186         CXX='icpc' \
187         CXXFLAGS="$(ICCFLAGS-OSX)" \
188         CXXFLAGS+='-arch i386' \
189         CXXFLAGS+='-prof_gen -prof_dir ./profdir' \
190         LDFLAGS+='-arch i386' \
191         all
192
193 osx-icc32-profile-use:
194         $(MAKE) \
195         CXX='icpc' \
196         CXXFLAGS="$(ICCFLAGS-OSX)" \
197         CXXFLAGS+='-arch i386' \
198         CXXFLAGS+='-prof_use -prof_dir ./profdir' \
199         LDFLAGS+='-arch i386' \
200         all
201
202 osx-icc32-profile:
203         @rm -rf profdir
204         @mkdir profdir
205         @touch *.cpp *.h
206         $(MAKE) osx-icc32-profile-make
207         @echo ""
208         @echo "Running benchmark for pgo-build ..."
209         @$(PGOBENCH) > /dev/null
210         @echo "Benchmark finished. Build final executable now ..."
211         @echo ""
212         @touch *.cpp *.h
213         $(MAKE) osx-icc32-profile-use
214         @rm -rf profdir bench.txt
215
216 osx-icc64-profile-make:
217         $(MAKE) \
218         CXX='icpc' \
219         CXXFLAGS="$(ICCFLAGS-OSX)" \
220         CXXFLAGS+='-arch x86_64' \
221         CXXFLAGS+='-prof_gen -prof_dir ./profdir' \
222         LDFLAGS+='-arch x86_64' \
223         all
224
225 osx-icc64-profile-use:
226         $(MAKE) \
227         CXX='icpc' \
228         CXXFLAGS="$(ICCFLAGS-OSX)" \
229         CXXFLAGS+='-arch x86_64' \
230         CXXFLAGS+='-prof_use -prof_dir ./profdir' \
231         LDFLAGS+='-arch x86_64' \
232         all
233
234 osx-icc64-profile:
235         @rm -rf profdir
236         @mkdir profdir
237         @touch *.cpp *.h
238         $(MAKE) osx-icc64-profile-make
239         @echo ""
240         @echo "Running benchmark for pgo-build ..."
241         @$(PGOBENCH) > /dev/null
242         @echo "Benchmark finished. Build final executable now ..."
243         @echo ""
244         @touch *.cpp *.h
245         $(MAKE) osx-icc64-profile-use
246         @rm -rf profdir bench.txt
247
248
249
250 strip:
251         strip $(EXE)
252
253
254 ### Compilation. Do not change
255 $(EXE): $(OBJS)
256         $(CXX) $(LDFLAGS) -o $@ $(OBJS)
257
258
259 ### Dependencies. Do not change
260 .depend:
261         $(CXX) -msse -MM $(OBJS:.o=.cpp) > $@
262
263 include .depend