-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
120 lines (98 loc) · 3.78 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
include Makefile.config
ENABLE_GDBINFO_AOBA ?= 0
ifeq ($(ENABLE_GDBINFO_AOBA), 1)
CXXFLAGS += -g
LDFLAGS += -g
endif
ENABLE_ASSERT_AOBA ?= 0
ifeq ($(ENABLE_ASSERT_AOBA), 1)
CPPFLAGS += -DDEBUG
else
CPPFLAGS += -DNDEBUG
endif
USE_OpenCL_AOBA ?= 0
ifeq ($(USE_OpenCL_AOBA), 1)
CPPFLAGS += -DUSE_OPENCL_AOBA
TARGETS += bin/ocldevs
LIB_OpenCL := -lOpenCL
CPPFLAGS += -I$(OpenCL_INC_AOBA)
endif
USE_CPUBLAS_AOBA ?= None
ifeq ($(USE_CPUBLAS_AOBA), IntelMKL)
CPPFLAGS += -DUSE_MKL
CXXFLAGS += -fopenmp
LDFLAGS += -fopenmp
LIB_BLAS := -lmkl_rt
ifdef IntelMKL_INC_AOBA
CPPFLAGS += -I$(IntelMKL_INC_AOBA)
endif
ifdef IntelMKL_LIB_AOBA
LDFLAGS += -L$(IntelMKL_LIB_AOBA)
LDFLAGS += -Wl,-rpath,$(IntelMKL_LIB_AOBA)
endif
else ifeq ($(USE_CPUBLAS_AOBA), OpenBLAS)
CPPFLAGS += -DUSE_OPENBLAS
CXXFLAGS += -fopenmp
LDFLAGS += -fopenmp
LIB_BLAS := -lopenblas
ifdef OpenBLAS_INC_AOBA
CPPFLAGS += -I$(OpenBLAS_INC_AOBA)
endif
ifdef OpenBLAS_LIB_AOBA
LDFLAGS += -L$(OpenBLAS_LIB_AOBA)
LDFLAGS += -Wl,-rpath,$(OpenBLAS_LIB_AOBA)
endif
endif
USE_POLICY2187 ?= 0
ifeq ($(USE_POLICY2187), 1)
CPPFLAGS += -DUSE_POLICY2187
endif
CXXFLAGS += -std=c++11 -Wextra -Ofast -march=native -mtune=native
CPPFLAGS += -MD -MP -Isrc/common -DUSE_SSE4
LDFLAGS += -llzma -lpthread -lrt
TARGETS := $(addprefix bin/, aobaz autousi server playshogi crc64 extract net-test gencode ocldevs)
AUTOUSI_BASES := $(addprefix src/autousi/, autousi client play) $(addprefix src/common/, iobase option jqueue xzi err shogibase osi child nnet nnet-cpu nnet-ocl nnet-srv opencli)
SERVER_BASES := $(addprefix src/server/, server listen datakeep logging) $(addprefix src/common/, iobase xzi jqueue err option shogibase osi)
GENCODE_BASES := src/gencode/gencode
PLAYSHOGI_BASES := src/playshogi/playshogi $(addprefix src/common/, option err iobase xzi shogibase osi child nnet nnet-cpu nnet-ocl nnet-srv opencli)
CRC64_BASES := src/crc64/crc64 $(addprefix src/common/, xzi err iobase osi)
EXTRACT_BASES := src/extract/extract $(addprefix src/common/, xzi err iobase osi)
OCLDEVS_BASES := src/ocldevs/ocldevs src/common/err src/common/opencli
NET_TEST_BASES := src/net-test/net-test $(addprefix src/common/, nnet nnet-cpu nnet-ocl jqueue err iobase shogibase xzi osi option opencli)
BASES := $(AUTOUSI_BASES) $(SERVER_BASES) $(GENCODE_BASES) $(PLAYSHOGI_BASES) $(CRC64_BASES) $(EXTRACT_BASES) $(OCLDEVS_BASES) $(NET_TEST_BASES)
OBJS := $(addsuffix .o, $(BASES))
INC_OUT := $(addprefix src/common/, tbl_zkey.inc tbl_board.inc tbl_sq.inc tbl_bmap.inc)
all: $(TARGETS)
bin/aobaz: src/usi-engine/aobaz
cp $^ $@
bin/autousi: $(addsuffix .o, $(AUTOUSI_BASES))
$(CXX) -o $@ $^ $(LDFLAGS) $(LIB_BLAS) $(LIB_OpenCL)
bin/server: $(addsuffix .o, $(SERVER_BASES))
$(CXX) -o $@ $^ $(LDFLAGS)
bin/gencode: $(addsuffix .o, $(GENCODE_BASES))
$(CXX) -o $@ $^ $(LDFLAGS)
./bin/gencode
bin/playshogi: $(addsuffix .o, $(PLAYSHOGI_BASES))
$(CXX) -o $@ $^ $(LDFLAGS) $(LIB_BLAS) $(LIB_OpenCL)
bin/crc64: $(addsuffix .o, $(CRC64_BASES))
$(CXX) -o $@ $^ $(LDFLAGS)
bin/extract: $(addsuffix .o, $(EXTRACT_BASES))
$(CXX) -o $@ $^ $(LDFLAGS)
bin/ocldevs: $(addsuffix .o, $(OCLDEVS_BASES))
$(CXX) -o $@ $^ $(LDFLAGS) $(LIB_OpenCL)
bin/net-test: $(addsuffix .o, $(NET_TEST_BASES))
$(CXX) -o $@ $^ $(LDFLAGS) $(LIB_BLAS) $(LIB_OpenCL)
.cpp.o:
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<
clean:
-$(RM) $(TARGETS) $(OBJS) $(OBJS:.o=.d) $(INC_OUT) Makefile~ build_vs.bat~
cd src/usi-engine; $(MAKE) clean
src/usi-engine/aobaz: FORCE bin/gencode
cd src/usi-engine; $(MAKE)
$(addsuffix .cpp, $(AUTOUSI_BASES)) : bin/gencode
$(addsuffix .cpp, $(SERVER_BASES)) : bin/gencode
$(addsuffix .cpp, $(PLAYSHOGI_BASES)) : bin/gencode
$(addsuffix .cpp, $(NET_TEST_BASES)) : bin/gencode
-include $(OBJS:.o=.d)
FORCE:
.PHONY: all clean FORCE