selfatari_cousin(): fixed invalid can_countercapture() calls
[pachi.git] / Makefile
blobb9361d8535388c58f433f33b955e2370994b1173
1 #### CONFIGURATION
3 # Uncomment one of the options below to change the way Pachi is built.
4 # Alternatively, you can pass the option to make itself, like:
5 # make MAC=1 DOUBLE_FLOATING=1
8 # Do you compile on Windows instead of Linux? Please note that the
9 # performance may not be optimal.
10 # (XXX: For now, only the mingw target is supported on Windows.
11 # Patches for others are welcome!)
13 # WIN=1
15 # To compile 64-bit version in msys2 with mingw64, uncomment the
16 # following line
17 # MSYS2_64=1
19 # Do you compile on MacOS/X instead of Linux? Please note that the
20 # performance may not be optimal.
21 # (XXX: We are looking for volunteers contributing support for other
22 # targets, like mingw/Windows.)
24 # MAC=1
26 # Compile Pachi with dcnn support ?
27 # You'll need to install Boost and Caffe libraries.
28 # If Caffe is in a custom directory you can set it here.
30 #DCNN=1
31 #CAFFE_LIB=/usr/local/lib
33 # By default, Pachi uses low-precision numbers within the game tree to
34 # conserve memory. This can become an issue with playout counts >1M,
35 # e.g. with extremely long thinking times or massive parallelization;
36 # 24 bits of floating_t mantissa become insufficient then.
38 # DOUBLE_FLOATING=1
40 # Enable performance profiling using gprof. Note that this also disables
41 # inlining, which allows more fine-grained profile, but may also distort
42 # it somewhat.
44 # PROFILING=gprof
46 # Enable performance profiling using google-perftools. This is much
47 # more accurate, fine-grained and nicer than gprof and does not change
48 # the way the actual binary is compiled and runs.
50 # PROFILING=perftools
53 # Target directories when running `make install`. Note that this is NOT
54 # quite supported yet - Pachi will work fine, but will always look for
55 # extra data files (such as pattern, joseki or fuseki database) only
56 # in the current directory, bundled database files will not be installed
57 # in a system directory or loaded from there.
58 PREFIX=/usr/local
59 BINDIR=$(PREFIX)/bin
61 # Generic compiler options. You probably do not really want to twiddle
62 # any of this.
63 # (N.B. -ffast-math breaks us; -fomit-frame-pointer is added below
64 # unless PROFILING=gprof.)
65 CUSTOM_CFLAGS?=-Wall -ggdb3 -O3 -std=gnu99 -frename-registers -pthread -Wsign-compare -D_GNU_SOURCE
66 CUSTOM_CXXFLAGS?=-Wall -ggdb3 -O3
68 ### CONFIGURATION END
70 ifdef MSYS2_64
71 WIN=1
72 WIN_HAVE_NO_REGEX_SUPPORT=1
73 DOUBLE_FLOATING=1
74 endif
76 ifdef WIN
77 SYS_CFLAGS?=
78 SYS_LDFLAGS?=-pthread
79 SYS_LIBS?=-lm -lws2_32
81 ifdef WIN_HAVE_NO_REGEX_SUPPORT
82 SYS_CFLAGS += -DHAVE_NO_REGEX_SUPPORT
83 else
84 SYS_LIBS += -lregex
85 endif
87 else
88 ifdef MAC
89 SYS_CFLAGS?=-DNO_THREAD_LOCAL
90 SYS_LDFLAGS?=-pthread -rdynamic
91 SYS_LIBS?=-lm -ldl
92 else
93 SYS_CFLAGS?=-march=native
94 SYS_LDFLAGS?=-pthread -rdynamic
95 SYS_LIBS?=-lm -lrt -ldl
96 endif
97 endif
99 ifdef CAFFE_LIB
100 SYS_LDFLAGS+=-L$(CAFFE_LIB)
101 endif
103 ifdef DCNN
104 CUSTOM_CFLAGS+=-DDCNN
105 CUSTOM_CXXFLAGS+=-DDCNN
106 SYS_LIBS:=-lcaffe -lboost_system -lstdc++ $(SYS_LIBS)
107 endif
109 ifdef DOUBLE_FLOATING
110 CUSTOM_CFLAGS+=-DDOUBLE_FLOATING
111 endif
113 ifeq ($(PROFILING), gprof)
114 CUSTOM_LDFLAGS+=-pg
115 CUSTOM_CFLAGS+=-pg -fno-inline
116 else
117 # Whee, an extra register!
118 CUSTOM_CFLAGS+=-fomit-frame-pointer
119 ifeq ($(PROFILING), perftools)
120 SYS_LIBS+=-lprofiler
121 endif
122 endif
124 ifndef LD
125 LD=ld
126 endif
128 ifndef AR
129 AR=ar
130 endif
132 ifndef INSTALL
133 INSTALL=/usr/bin/install
134 endif
136 export
137 unexport INCLUDES
138 INCLUDES=-I.
141 OBJS=board.o gtp.o move.o ownermap.o pattern3.o pattern.o patternsp.o patternprob.o playout.o probdist.o random.o stone.o timeinfo.o network.o fbook.o chat.o
142 ifdef DCNN
143 OBJS+=dcnn.o
144 endif
145 SUBDIRS=random replay patternscan patternplay joseki montecarlo uct uct/policy playout tactics t-unit distributed
147 all: all-recursive pachi
149 LOCALLIBS=random/random.a replay/replay.a patternscan/patternscan.a patternplay/patternplay.a joseki/joseki.a montecarlo/montecarlo.a uct/uct.a uct/policy/uctpolicy.a playout/playout.a t-unit/test.a tactics/tactics.a distributed/distributed.a
150 $(LOCALLIBS): all-recursive
152 pachi: $(OBJS) pachi.o $(LOCALLIBS)
153 $(call cmd,link)
155 # Use runtime gcc profiling for extra optimization. This used to be a large
156 # bonus but nowadays, it's rarely worth the trouble.
157 .PHONY: pachi-profiled
158 pachi-profiled:
159 @make clean all XLDFLAGS=-fprofile-generate XCFLAGS="-fprofile-generate -fomit-frame-pointer -frename-registers"
160 ./pachi -t =5000 no_tbook <tools/genmove19.gtp
161 @make clean all clean-profiled XLDFLAGS=-fprofile-use XCFLAGS="-fprofile-use -fomit-frame-pointer -frename-registers"
163 # install-recursive?
164 install:
165 $(INSTALL) ./pachi $(DESTDIR)$(BINDIR)
168 clean: clean-recursive
169 rm -f pachi *.o
171 clean-profiled: clean-profiled-recursive
172 rm -f *.gcda *.gcno
174 -include Makefile.lib