]> git.sesse.net Git - stockfish/blob - src/Makefile
There is no need to special case KNNK ending
[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 clean          >  Clean up"
79         @echo ""
80
81 all: $(EXE) .depend
82
83 clean:
84         $(RM) *.o .depend *~ $(EXE)
85
86
87 ### Possible targets. You may add your own ones here
88 gcc:
89         $(MAKE) \
90         CXX='g++' \
91         CXXFLAGS="$(GCCFLAGS)" \
92         all
93
94 icc:
95         $(MAKE) \
96         CXX='icpc' \
97         CXXFLAGS="$(ICCFLAGS)" \
98         all
99
100 icc-profile-make:
101         $(MAKE) \
102         CXX='icpc' \
103         CXXFLAGS="$(ICCFLAGS)" \
104         CXXFLAGS+='-prof-gen=srcpos -prof_dir ./profdir' \
105         all
106
107 icc-profile-use:
108         $(MAKE) \
109         CXX='icpc' \
110         CXXFLAGS="$(ICCFLAGS)" \
111         CXXFLAGS+='-prof_use -prof_dir ./profdir' \
112         all
113
114 icc-profile:
115         @rm -rf profdir
116         @mkdir profdir
117         @touch *.cpp *.h
118         $(MAKE) icc-profile-make
119         @echo ""
120         @echo "Running benchmark for pgo-build ..."
121         @$(PGOBENCH) > /dev/null
122         @echo "Benchmark finished. Build final executable now ..."
123         @echo ""
124         @touch *.cpp *.h
125         $(MAKE) icc-profile-use
126         @rm -rf profdir bench.txt
127
128 osx-ppc32:
129         $(MAKE) \
130         CXX='g++' \
131         CXXFLAGS="$(GCCFLAGS)" \
132         CXXFLAGS+='-arch ppc' \
133         LDFLAGS+='-arch ppc' \
134         all
135
136 osx-ppc64:
137         $(MAKE) \
138         CXX='g++' \
139         CXXFLAGS="$(GCCFLAGS)" \
140         CXXFLAGS+='-arch ppc64' \
141         LDFLAGS+='-arch ppc64' \
142         all
143
144 osx-x86:
145         $(MAKE) \
146         CXX='g++' \
147         CXXFLAGS="$(GCCFLAGS)" \
148         CXXFLAGS+='-arch i386' \
149         LDFLAGS+='-arch i386' \
150         all
151
152 osx-x86_64:
153         $(MAKE) \
154         CXX='g++' \
155         CXXFLAGS="$(GCCFLAGS)" \
156         CXXFLAGS+='-arch x86_64' \
157         LDFLAGS+='-arch x86_64' \
158         all
159
160
161 ### Compilation. Do not change
162 $(EXE): $(OBJS)
163         $(CXX) $(LDFLAGS) -o $@ $(OBJS)
164
165
166 ### Dependencies. Do not change
167 .depend:
168         $(CXX) -MM $(OBJS:.o=.cpp) > $@
169
170 include .depend