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!)
15 # To compile 64-bit version in msys2 with mingw64, uncomment the
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.)
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.
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.
40 # Enable performance profiling using gprof. Note that this also disables
41 # inlining, which allows more fine-grained profile, but may also distort
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.
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.
61 # Generic compiler options. You probably do not really want to twiddle
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
72 WIN_HAVE_NO_REGEX_SUPPORT
=1
79 SYS_LIBS?
=-lm
-lws2_32
81 ifdef WIN_HAVE_NO_REGEX_SUPPORT
82 SYS_CFLAGS
+= -DHAVE_NO_REGEX_SUPPORT
89 SYS_CFLAGS?
=-DNO_THREAD_LOCAL
90 SYS_LDFLAGS?
=-pthread
-rdynamic
93 SYS_CFLAGS?
=-march
=native
94 SYS_LDFLAGS?
=-pthread
-rdynamic
95 SYS_LIBS?
=-lm
-lrt
-ldl
100 SYS_LDFLAGS
+=-L
$(CAFFE_LIB
)
104 CUSTOM_CFLAGS
+=-DDCNN
105 CUSTOM_CXXFLAGS
+=-DDCNN
106 SYS_LIBS
:=-lcaffe
-lboost_system
-lstdc
++ $(SYS_LIBS
)
109 ifdef DOUBLE_FLOATING
110 CUSTOM_CFLAGS
+=-DDOUBLE_FLOATING
113 ifeq ($(PROFILING
), gprof
)
115 CUSTOM_CFLAGS
+=-pg
-fno-inline
117 # Whee, an extra register!
118 CUSTOM_CFLAGS
+=-fomit-frame-pointer
119 ifeq ($(PROFILING
), perftools
)
133 INSTALL
=/usr
/bin
/install
141 OBJS
=board.o board_undo.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
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 tactics
/tactics.a t-unit
/test.a distributed
/distributed.a
150 $(LOCALLIBS
): all-recursive
152 pachi
: $(OBJS
) pachi.o
$(LOCALLIBS
)
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
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"
165 $(INSTALL
) .
/pachi
$(DESTDIR
)$(BINDIR
)
168 clean: clean-recursive
171 clean-profiled
: clean-profiled-recursive
174 -include Makefile.lib