]> git.sesse.net Git - stockfish/blob - src/Makefile
Preserve options order when printed
[stockfish] / src / Makefile
1 # Glaurung, a UCI chess playing engine.
2 # Copyright (C) 2004-2007 Tord Romstad
3
4 # This file is part of Glaurung.
5 #
6 # Glaurung is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # Glaurung is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
19
20 ###
21 ### Files
22 ###
23
24 EXE = glaurung
25
26 OBJS = bitboard.o color.o pawns.o material.o endgame.o evaluate.o main.o \
27         misc.o move.o movegen.o history.o movepick.o search.o piece.o \
28         position.o square.o direction.o tt.o value.o uci.o ucioption.o \
29         mersenne.o book.o bitbase.o san.o benchmark.o
30
31
32 ###
33 ### Rules
34 ###
35
36 all: $(EXE) .depend
37
38 clean: 
39         $(RM) *.o .depend glaurung
40
41
42 ###
43 ### Compiler:
44 ###
45
46 CXX = g++
47 # CXX = g++-4.2
48 # CXX = icpc
49
50
51 ###
52 ### Dependencies
53 ###
54
55 $(EXE): $(OBJS)
56         $(CXX) $(LDFLAGS) -o $@ $(OBJS)
57
58 .depend:
59         $(CXX) -MM $(OBJS:.o=.cpp) > $@
60
61 include .depend
62
63
64 ###
65 ### Compiler and linker switches
66 ###
67
68 # Enable/disable debugging:
69
70 CXXFLAGS += -DNDEBUG
71
72
73 # Compile with full warnings, and symbol names
74
75 CXXFLAGS += -Wall -g
76
77
78 # General optimization flags.  Note that -O2 might be faster than -O3 on some
79 # systems; this requires testing.
80
81 CXXFLAGS += -O3 -fno-exceptions -fomit-frame-pointer -fno-rtti -fstrict-aliasing
82
83
84 # Compiler optimization flags for the Intel C++ compiler in Mac OS X:
85
86 # CXXFLAGS += -mdynamic-no-pic -no-prec-div -ipo -static -xP
87
88
89 # Profiler guided optimization with the Intel C++ compiler.  To use it, first
90 # create the directory ./profdata if it does not already exist, and delete its
91 # contents if it does exist.  Then compile with -prof_gen, and run the 
92 # resulting binary for a while (for instance, do ./glaurung bench 128 1, and
93 # wait 15 minutes for the benchmark to complete).  Then do a 'make clean', and 
94 # recompile with -prof_use.
95
96 # CXXFLAGS += -prof_gen -prof_dir ./profdata
97 # CXXFLAGS += -prof_use -prof_dir ./profdata
98
99
100 # Profiler guided optimization with GCC.  I've never been able to make this 
101 # work.
102
103 # CXXFLAGS += -fprofile-generate
104 # LDFLAGS += -fprofile-generate
105 # CXXFLAGS += -fprofile-use
106 # CXXFLAGS += -fprofile-use
107
108
109 # General linker flags
110
111 LDFLAGS += -lm -lpthread
112
113
114 # Compiler switches for generating binaries for various CPUs in Mac OS X.
115 # Note that 'arch ppc' and 'arch ppc64' only works with g++, and not with
116 # the intel compiler.
117
118 # CXXFLAGS += -arch ppc
119 # CXXFLAGS += -arch ppc64
120 # CXXFLAGS += -arch i386
121 # CXXFLAGS += -arch x86_64
122 # LDFLAGS += -arch ppc
123 # LDFLAGS += -arch ppc64
124 # LDFLAGS += -arch i386
125 # LDFLAGS += -arch x86_64
126
127
128 # Backwards compatibility with Mac OS X 10.4 when compiling under 10.5 with 
129 # GCC 4.0.  I haven't found a way to make it work with GCC 4.2.
130
131 # CXXFLAGS += -isysroot /Developer/SDKs/MacOSX10.4u.sdk
132 # CXXFLAGS += -mmacosx-version-min=10.4
133 # LDFLAGS += -isysroot /Developer/SDKs/MacOSX10.4u.sdk
134 # LDFLAGS += -Wl,-syslibroot /Developer/SDKs/MacOSX10.4u.sdk
135 # LDFLAGS += -mmacosx-version-min=10.4
136
137
138 # Backwards compatibility with Mac OS X 10.4 when compiling with ICC.  Doesn't
139 # work yet. :-(
140
141 # CXXFLAGS += -DMAC_OS_X_VERSION_MIN_REQUIRED=1040
142 # CXXFLAGS += -DMAC_OS_X_VERSION_MAX_ALLOWED=1040
143 # CXXFLAGS += -D__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__=1040
144 # CXXFLAGS += -F/Developer/SDKs/MacOSX10.4u.sdk/
145 # LDFLAGS += -Wl,-syslibroot -Wl,/Developer/SDKs/MacOSX10.4u.sdk