]> git.sesse.net Git - stockfish/blob - src/Makefile
Add TT prefetching support
[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
30 ICCFLAGS = -fast
31
32
33 ### ==========================================================================
34 ### Enable/disable debugging, disabled by default
35 ### ==========================================================================
36 GCCFLAGS += -DNDEBUG
37 ICCFLAGS += -DNDEBUG
38
39
40 ### ==========================================================================
41 ### Run built-in benchmark for pgo-builds with:  32MB hash  1 thread  10 depth
42 ### These settings are generally fast, but may be changed experimentally
43 ### ==========================================================================
44 PGOBENCH = ./$(EXE) bench 32 1 10 default depth
45
46
47 ### General compiler settings. Do not change
48 GCCFLAGS += -g -Wall -fno-exceptions -fno-rtti -fno-strict-aliasing
49 ICCFLAGS += -g -Wall -fno-exceptions -fno-rtti -fno-strict-aliasing -wd383,869,981,10187,10188,11505,11503
50
51
52 ### General linker settings. Do not change
53 LDFLAGS  = -lpthread
54
55
56 ### Object files. Do not change
57 OBJS = application.o bitboard.o pawns.o material.o endgame.o evaluate.o main.o \
58         misc.o move.o movegen.o history.o movepick.o search.o piece.o \
59         position.o direction.o tt.o value.o uci.o ucioption.o \
60         mersenne.o book.o bitbase.o san.o benchmark.o
61
62
63 ### General rules. Do not change
64 default:
65         $(MAKE) gcc
66
67 help:
68         @echo ""
69         @echo "Makefile options:"
70         @echo ""
71         @echo "make                >  Default: Compiler = g++"
72         @echo "make icc            >  Compiler = icpc"
73         @echo "make icc-profile    >  Compiler = icpc + automatic pgo-build"
74         @echo "make osx-ppc32      >  PPC-Mac OS X 32 bit. Compiler = g++"
75         @echo "make osx-ppc64      >  PPC-Mac OS X 64 bit. Compiler = g++"
76         @echo "make osx-x86        >  x86-Mac OS X 32 bit. Compiler = g++"
77         @echo "make osx-x86_64     >  x86-Mac OS X 64 bit. Compiler = g++"
78         @echo "make strip          >  Strip executable"
79         @echo "make clean          >  Clean up"
80         @echo ""
81
82 all: $(EXE) .depend
83
84 clean:
85         $(RM) *.o .depend *~ $(EXE)
86
87
88 ### Possible targets. You may add your own ones here
89 gcc:
90         $(MAKE) \
91         CXX='g++' \
92         CXXFLAGS="$(GCCFLAGS)" \
93         all
94
95 icc:
96         $(MAKE) \
97         CXX='icpc' \
98         CXXFLAGS="$(ICCFLAGS)" \
99         all
100
101 icc-profile-make:
102         $(MAKE) \
103         CXX='icpc' \
104         CXXFLAGS="$(ICCFLAGS)" \
105         CXXFLAGS+='-prof-gen=srcpos -prof_dir ./profdir' \
106         all
107
108 icc-profile-use:
109         $(MAKE) \
110         CXX='icpc' \
111         CXXFLAGS="$(ICCFLAGS)" \
112         CXXFLAGS+='-prof_use -prof_dir ./profdir' \
113         all
114
115 icc-profile:
116         @rm -rf profdir
117         @mkdir profdir
118         @touch *.cpp *.h
119         $(MAKE) icc-profile-make
120         @echo ""
121         @echo "Running benchmark for pgo-build ..."
122         @$(PGOBENCH) > /dev/null
123         @echo "Benchmark finished. Build final executable now ..."
124         @echo ""
125         @touch *.cpp *.h
126         $(MAKE) icc-profile-use
127         @rm -rf profdir bench.txt
128
129 osx-ppc32:
130         $(MAKE) \
131         CXX='g++' \
132         CXXFLAGS="$(GCCFLAGS)" \
133         CXXFLAGS+='-arch ppc' \
134         LDFLAGS+='-arch ppc' \
135         all
136
137 osx-ppc64:
138         $(MAKE) \
139         CXX='g++' \
140         CXXFLAGS="$(GCCFLAGS)" \
141         CXXFLAGS+='-arch ppc64' \
142         LDFLAGS+='-arch ppc64' \
143         all
144
145 osx-x86:
146         $(MAKE) \
147         CXX='g++' \
148         CXXFLAGS="$(GCCFLAGS)" \
149         CXXFLAGS+='-arch i386' \
150         LDFLAGS+='-arch i386' \
151         all
152
153 osx-x86_64:
154         $(MAKE) \
155         CXX='g++' \
156         CXXFLAGS="$(GCCFLAGS)" \
157         CXXFLAGS+='-arch x86_64' \
158         LDFLAGS+='-arch x86_64' \
159         all
160
161 strip:
162         strip $(EXE)
163
164
165 ### Compilation. Do not change
166 $(EXE): $(OBJS)
167         $(CXX) $(LDFLAGS) -o $@ $(OBJS)
168
169
170 ### Dependencies. Do not change
171 .depend:
172         $(CXX) -MM $(OBJS:.o=.cpp) > $@
173
174 include .depend