Merge branch 'master' of git+ssh://repo.or.cz/srv/git/pachi
[pachi/json.git] / Makefile
blobd3cc37587039e150ba7a30c6925a0272aa610d55
1 #### CONFIGURATION
3 # PROFILING=1
5 PREFIX=/usr/local
6 BINDIR=$(PREFIX)/bin
8 # -ffast-math breaks us
9 CUSTOM_CFLAGS=-Wall -ggdb3 -O3 -std=gnu99 -frename-registers -pthread -Wsign-compare -D_GNU_SOURCE
10 ifdef MAC
11 SYS_CFLAGS=-DNO_THREAD_LOCAL
12 LDFLAGS=-lm -pthread -ldl -rdynamic
13 else
14 SYS_CFLAGS=-march=native
15 LDFLAGS=-lm -pthread -lrt -ldl -rdynamic
16 endif
18 # Profiling:
19 ifdef PROFILING
20 LDFLAGS+=-pg
21 CUSTOM_CFLAGS+=-pg -fno-inline
22 else
23 # Whee, an extra register!
24 CUSTOM_CFLAGS+=-fomit-frame-pointer
25 endif
27 LD=ld
28 AR=ar
30 ### CONFIGURATION END
32 ifndef INSTALL
33 INSTALL=/usr/bin/install
34 endif
36 export
37 unexport INCLUDES
38 INCLUDES=-I.
41 OBJS=board.o gtp.o move.o ownermap.o pattern3.o pattern.o patternsp.o playout.o probdist.o random.o stone.o tactics.o timeinfo.o network.o
42 SUBDIRS=random replay patternscan joseki montecarlo uct uct/policy playout t-unit distributed
44 all: all-recursive zzgo
46 LOCALLIBS=random/random.a replay/replay.a patternscan/patternscan.a joseki/joseki.a montecarlo/montecarlo.a uct/uct.a uct/policy/uctpolicy.a playout/playout.a t-unit/test.a distributed/distributed.a
47 zzgo: $(OBJS) zzgo.o $(LOCALLIBS)
48 $(call cmd,link)
50 .PHONY: zzgo-profiled
51 zzgo-profiled:
52 @make clean all XLDFLAGS=-fprofile-generate XCFLAGS="-fprofile-generate -fomit-frame-pointer -frename-registers"
53 ./zzgo -t =5000 no_book <genmove19.gtp
54 @make clean all clean-profiled XLDFLAGS=-fprofile-use XCFLAGS="-fprofile-use -fomit-frame-pointer -frename-registers"
56 # install-recursive?
57 install:
58 $(INSTALL) ./zzgo $(DESTDIR)$(BINDIR)
61 clean: clean-recursive
62 rm -f zzgo *.o
64 clean-profiled: clean-profiled-recursive
65 rm -f *.gcda *.gcno
67 -include Makefile.lib