-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathMakefile
90 lines (73 loc) · 2.96 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
default:
$(MAKE) CC=gcc CXX=g++ \
CXXFLAGS='$(CXXFLAGS) -Wall -Wextra -pipe -O3 -g -ffast-math -march=native -fopenmp -flto -std=c++11 -DNDEBUG -D_CONSOLE' \
LDFLAGS='$(LDFLAGS) -fopenmp -flto -g' \
leela
macgcc:
$(MAKE) CC=gcc-7 CXX=g++-7 \
CXXFLAGS='$(CXXFLAGS) -Wall -Wextra -pipe -O3 -g -flax-vector-conversions -Wno-deprecated-declarations -ffast-math -march=native -fopenmp -std=c++11 -DNDEBUG -D_CONSOLE' \
LDFLAGS='$(LDFLAGS) -fopenmp -g' \
leela
gcc32b:
$(MAKE) CC=gcc CXX=g++ \
CXXFLAGS='$(CXXFLAGS) -Wall -pipe -O2 -g -m32 -std=c++11 -DNDEBUG -D_CONSOLE' \
LDFLAGS='$(LDFLAGS) -m32' \
leela
debug:
$(MAKE) CC=gcc CXX=g++ \
CXXFLAGS='$(CXXFLAGS) -Wall -Wextra -pipe -O0 -g -fopenmp -std=c++11 -D_CONSOLE' \
LDFLAGS='$(LDFLAGS) -fopenmp -g' \
leela
clang:
$(MAKE) CC=clang-5.0 CXX=clang++-5.0 \
CXXFLAGS='$(CXXFLAGS) -Wall -Wextra -O3 -ffast-math -flto -mtune=generic -std=c++11 -D_CONSOLE -DNDEBUG' \
LDFLAGS='$(LDFLAGS) -flto -fuse-linker-plugin' \
leela
asan:
$(MAKE) CC=clang-5.0 CXX=clang++-5.0 \
CXXFLAGS='$(CXXFLAGS) -Wall -Wextra -fsanitize=address -fno-omit-frame-pointer -O2 -g -fopenmp -std=c++11 -D_CONSOLE -DNDEBUG' \
LDFLAGS='$(LDFLAGS) -g -fsanitize=address -fopenmp' \
leela
ubsan:
$(MAKE) CC=clang-5.0 CXX=clang++-5.0 \
CXXFLAGS='$(CXXFLAGS) -Wall -Wextra -fsanitize=undefined -fno-omit-frame-pointer -O2 -g -fopenmp -std=c++11 -D_CONSOLE -DNDEBUG' \
LDFLAGS='$(LDFLAGS) -g -fsanitize=undefined -fopenmp' \
leela
LIBS = -lboost_program_options
#DYNAMIC_LIBS += -lboost_system -lboost_filesystem -lcaffe-nv -lprotobuf -lglog
#LIBS += -lopenblas
DYNAMIC_LIBS += -lpthread
DYNAMIC_LIBS += -lOpenCL
#LIBS += -framework Accelerate
#LIBS += -framework OpenCL
#DYNAMIC_LIBS += -lmkl_rt
CAFFE_BASE = /usr/local
CAFFE_INC = $(CAFFE_BASE)/include
CAFFE_LIB = $(CAFFE_BASE)/lib
CXXFLAGS += -I$(CAFFE_INC) -I/usr/local/cuda/include
#CXXFLAGS += -I/opt/intel/mkl/include
CXXFLAGS += -I/opt/OpenBLAS/include
#CXXFLAGS += -I/System/Library/Frameworks/Accelerate.framework/Versions/Current/Headers
LDFLAGS += -L$(CAFFE_LIB)
#LDFLAGS += -L/opt/intel/mkl/lib/intel64/
LDFLAGS += -L/opt/OpenBLAS/lib
CXXFLAGS += -I.
CPPFLAGS += -MD -MP
sources = Network.cpp AttribScores.cpp FullBoard.cpp KoState.cpp Playout.cpp \
TimeControl.cpp UCTSearch.cpp Attributes.cpp Book.cpp \
GameState.cpp Leela.cpp PNNode.cpp SGFParser.cpp Timing.cpp \
Utils.cpp FastBoard.cpp Matcher.cpp PNSearch.cpp \
SGFTree.cpp TTable.cpp Zobrist.cpp FastState.cpp GTP.cpp \
MCOTable.cpp Random.cpp SMP.cpp UCTNode.cpp NN.cpp NN128.cpp \
NNValue.cpp OpenCL.cpp MCPolicy.cpp
objects = $(sources:.cpp=.o)
deps = $(sources:%.cpp=%.d)
-include $(deps)
%.o: %.cpp
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
leela: $(objects)
$(CXX) $(LDFLAGS) -o $@ $^ -static-libgcc -static-libstdc++ -Wl,-Bstatic $(LIBS) -Wl,-Bdynamic $(DYNAMIC_LIBS)
# $(CXX) $(LDFLAGS) -o $@ $^ $(LIBS) $(DYNAMIC_LIBS)
clean:
-$(RM) leela $(objects) $(deps)
.PHONY: clean default gcc32b debug llvm