Thread managers: Raise spawned/joined worker prints debug level to reduce noise at...
[pachi.git] / Makefile
blob5e0fe183aa5b88d35e1c70e8697e2c4c999579e1
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 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 # Do you compile on MacOS/X instead of Linux? Please note that the
16 # performance may not be optimal.
17 # (XXX: We are looking for volunteers contributing support for other
18 # targets, like mingw/Windows.)
20 # MAC=1
22 # By default, Pachi uses low-precision numbers within the game tree to
23 # conserve memory. This can become an issue with playout counts >1M,
24 # e.g. with extremely long thinking times or massive parallelization;
25 # 24 bits of floating_t mantissa become insufficient then.
27 # DOUBLE=1
29 # Enable performance profiling using gprof. Note that this also disables
30 # inlining, which allows more fine-grained profile, but may also distort
31 # it somewhat.
33 # PROFILING=gprof
35 # Enable performance profiling using google-perftools. This is much
36 # more accurate, fine-grained and nicer than gprof and does not change
37 # the way the actual binary is compiled and runs.
39 # PROFILING=perftools
42 # Target directories when running `make install`. Note that this is NOT
43 # quite supported yet - Pachi will work fine, but will always look for
44 # extra data files (such as pattern, joseki or fuseki database) only
45 # in the current directory, bundled database files will not be installed
46 # in a system directory or loaded from there.
47 PREFIX=/usr/local
48 BINDIR=$(PREFIX)/bin
50 # Generic compiler options. You probably do not really want to twiddle
51 # any of this.
52 # (N.B. -ffast-math breaks us; -fomit-frame-pointer is added below
53 # unless PROFILING=gprof.)
54 CUSTOM_CFLAGS=-Wall -ggdb3 -O3 -std=gnu99 -frename-registers -pthread -Wsign-compare -D_GNU_SOURCE
56 ### CONFIGURATION END
59 ifdef WIN
60 SYS_CFLAGS=
61 LDFLAGS=-pthread
62 LIBS=-lm -lws2_32 -lregex
63 else
64 ifdef MAC
65 SYS_CFLAGS=-DNO_THREAD_LOCAL
66 LDFLAGS=-pthread -rdynamic
67 LIBS=-lm -ldl
68 else
69 SYS_CFLAGS=-march=native
70 LDFLAGS=-pthread -rdynamic
71 LIBS=-lm -lrt -ldl
72 endif
73 endif
75 ifdef DOUBLE
76 CUSTOM_CFLAGS+=-DDOUBLE
77 endif
79 ifeq ($(PROFILING), gprof)
80 LDFLAGS+=-pg
81 CUSTOM_CFLAGS+=-pg -fno-inline
82 else
83 # Whee, an extra register!
84 CUSTOM_CFLAGS+=-fomit-frame-pointer
85 ifeq ($(PROFILING), perftools)
86 LIBS+=-lprofiler
87 endif
88 endif
90 ifndef LD
91 LD=ld
92 endif
94 ifndef AR
95 AR=ar
96 endif
98 ifndef INSTALL
99 INSTALL=/usr/bin/install
100 endif
102 export
103 unexport INCLUDES
104 INCLUDES=-I.
107 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
108 SUBDIRS=random replay patternscan patternplay joseki montecarlo uct uct/policy playout tactics t-unit distributed
110 all: all-recursive pachi
112 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
113 $(LOCALLIBS): all-recursive
115 pachi: $(OBJS) pachi.o $(LOCALLIBS)
116 $(call cmd,link)
118 # Use runtime gcc profiling for extra optimization. This used to be a large
119 # bonus but nowadays, it's rarely worth the trouble.
120 .PHONY: pachi-profiled
121 pachi-profiled:
122 @make clean all XLDFLAGS=-fprofile-generate XCFLAGS="-fprofile-generate -fomit-frame-pointer -frename-registers"
123 ./pachi -t =5000 no_tbook <tools/genmove19.gtp
124 @make clean all clean-profiled XLDFLAGS=-fprofile-use XCFLAGS="-fprofile-use -fomit-frame-pointer -frename-registers"
126 # install-recursive?
127 install:
128 $(INSTALL) ./pachi $(DESTDIR)$(BINDIR)
131 clean: clean-recursive
132 rm -f pachi *.o
134 clean-profiled: clean-profiled-recursive
135 rm -f *.gcda *.gcno
137 -include Makefile.lib