More notes on the possible min/max method.
[pachi/pachi-r6144.git] / Makefile
blobaafc7636707306dfb6991824dfd9d2560a6814b8
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=1
8 # Do you compile on MacOS/X instead of Linux? Please note that the
9 # performance may not be optimal.
10 # (XXX: We are looking for volunteers contributing support for other
11 # targets, like mingw/Windows.)
13 # MAC=1
15 # By default, Pachi uses low-precision numbers within the game tree to
16 # conserve memory. This can become an issue with playout counts >1M,
17 # e.g. with extremely long thinking times or massive parallelization;
18 # 24 bits of floating_t mantissa become insufficient then.
20 # DOUBLE=1
22 # Enable performance profiling using gprof. Note that this also disables
23 # inlining, which allows more fine-grained profile, but may also distort
24 # it somewhat.
26 # PROFILING=1
29 # Target directories when running `make install`. Note that this is NOT
30 # quite supported yet - Pachi will work fine, but will always look for
31 # extra data files (such as pattern, joseki or fuseki database) only
32 # in the current directory, bundled database files will not be installed
33 # in a system directory or loaded from there.
34 PREFIX=/usr/local
35 BINDIR=$(PREFIX)/bin
37 # Generic compiler options. You probably do not really want to twiddle
38 # any of this.
39 # (N.B. -ffast-math breaks us; -fomit-frame-pointer is added below
40 # unless PROFILING=1.)
41 CUSTOM_CFLAGS=-Wall -ggdb3 -O3 -std=gnu99 -frename-registers -pthread -Wsign-compare -D_GNU_SOURCE
43 ### CONFIGURATION END
46 ifdef MAC
47 SYS_CFLAGS=-DNO_THREAD_LOCAL
48 LDFLAGS=-lm -pthread -ldl -rdynamic
49 else
50 SYS_CFLAGS=-march=native
51 LDFLAGS=-lm -pthread -lrt -ldl -rdynamic
52 endif
54 ifdef DOUBLE
55 CUSTOM_CFLAGS+=-DDOUBLE
56 endif
58 ifdef PROFILING
59 LDFLAGS+=-pg
60 CUSTOM_CFLAGS+=-pg -fno-inline
61 else
62 # Whee, an extra register!
63 CUSTOM_CFLAGS+=-fomit-frame-pointer
64 endif
66 ifndef LD
67 LD=ld
68 endif
70 ifndef AR
71 AR=ar
72 endif
74 ifndef INSTALL
75 INSTALL=/usr/bin/install
76 endif
78 export
79 unexport INCLUDES
80 INCLUDES=-I.
83 OBJS=board.o gtp.o move.o ownermap.o pattern3.o playout.o probdist.o random.o stone.o timeinfo.o network.o fbook.o
84 SUBDIRS=random replay joseki montecarlo uct uct/policy playout tactics t-unit distributed
86 all: all-recursive pachi
88 LOCALLIBS=random/random.a replay/replay.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
89 $(LOCALLIBS): all-recursive
91 pachi: $(OBJS) pachi.o $(LOCALLIBS)
92 $(call cmd,link)
94 # Use runtime gcc profiling for extra optimization. This used to be a large
95 # bonus but nowadays, it's rarely worth the trouble.
96 .PHONY: pachi-profiled
97 pachi-profiled:
98 @make clean all XLDFLAGS=-fprofile-generate XCFLAGS="-fprofile-generate -fomit-frame-pointer -frename-registers"
99 ./pachi -t =5000 no_tbook <tools/genmove19.gtp
100 @make clean all clean-profiled XLDFLAGS=-fprofile-use XCFLAGS="-fprofile-use -fomit-frame-pointer -frename-registers"
102 # install-recursive?
103 install:
104 $(INSTALL) ./pachi $(DESTDIR)$(BINDIR)
107 clean: clean-recursive
108 rm -f pachi *.o
110 clean-profiled: clean-profiled-recursive
111 rm -f *.gcda *.gcno
113 -include Makefile.lib