-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
188 lines (162 loc) · 5.27 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
CMAKE:=cmake
MKDIR:=mkdir
LN:=ln
FIND:=find
COV:=gcov
PROF:=gprof
PROJ_ROOT:=$(shell pwd)
SUNFISH_EXPT:=sunfish_expt
SUNFISH_TEST:=sunfish_test
SUNFISH_BM:=sunfish_bm
SUNFISH_LN:=sunfish_ln
SUNFISH_CSA:=sunfish_csa
SUNFISH_USI:=sunfish_usi
SUNFISH_TOOLS:=sunfish_tools
SUNFISH_DEV:=sunfish_dev
BUILD_DIR:=$(PROJ_ROOT)/out/build
PROFOUT:=$(PROJ_ROOT)/out/profile.txt
TESTRESULT:=$(PROJ_ROOT)/out/test_result.xml
COVOUT:=$(PROJ_ROOT)/out/coverage.txt
KIFU_PROF1:=$(PROJ_ROOT)/kifu/prof1
KIFU_PROF5:=$(PROJ_ROOT)/kifu/prof5
KIFU_PROBLEM:=$(PROJ_ROOT)/kifu/problem
GEN_COV:=$(PROJ_ROOT)/tools/gen_cov_report.py
GROUP_PROF:=$(PROJ_ROOT)/tools/group_prof.pl
HAS_COV:=$(shell which $(COV))
help:
@echo 'usage:'
@echo ' make all'
@echo ' make expt'
@echo ' make solve'
@echo ' make prof'
@echo ' make prof1'
@echo ' make test'
@echo ' make bm'
@echo ' make ln'
@echo ' make ln-mat'
@echo ' make ln-mat-only'
@echo ' make csa'
@echo ' make csa-debug'
@echo ' make usi'
@echo ' make usi-debug'
@echo ' make tools'
@echo ' make dev'
@echo ' make clean'
.PHONY: all
all: test expt bm ln csa usi tools dev
.PHONY: expt
expt:
$(MKDIR) -p $(BUILD_DIR)/$@ 2> /dev/null
cd $(BUILD_DIR)/$@ && $(CMAKE) -D CMAKE_BUILD_TYPE=Release $(PROJ_ROOT)/src/expt
cd $(BUILD_DIR)/$@ && $(MAKE)
$(LN) -s -f $(BUILD_DIR)/$@/$(SUNFISH_EXPT) $(SUNFISH_EXPT)
.PHONY: solve
solve:
$(MAKE) expt
./$(SUNFISH_EXPT) --solve $(KIFU_PROBLEM) --time 1 --depth 18
.PHONY: expt-prof
expt-prof:
$(MKDIR) -p $(BUILD_DIR)/$@ 2> /dev/null
cd $(BUILD_DIR)/$@ && $(CMAKE) -D CMAKE_BUILD_TYPE=Release -D PROFILE=ON $(PROJ_ROOT)/src/expt
cd $(BUILD_DIR)/$@ && $(MAKE)
$(LN) -s -f $(BUILD_DIR)/$@/$(SUNFISH_EXPT) $(SUNFISH_EXPT)
.PHONY: prof
prof:
$(MAKE) expt-prof
./$(SUNFISH_EXPT) --solve $(KIFU_PROF5) -ni --time 5 --depth 18
$(SHELL) -c '$(PROF) ./$(SUNFISH_EXPT) > $(PROFOUT)'
@echo
$(SHELL) -c '$(GROUP_PROF) < $(PROFOUT)'
@echo
@echo "Please see the details in $(PROFOUT)."
.PHONY: prof1
prof1:
$(MAKE) expt-prof
./$(SUNFISH_EXPT) --solve $(KIFU_PROF1) -ni --time 5 --depth 18
$(SHELL) -c '$(PROF) ./$(SUNFISH_EXPT) > $(PROFOUT)'
@echo
$(SHELL) -c '$(GROUP_PROF) < $(PROFOUT)'
@echo
@echo "Please see the details in $(PROFOUT)."
.PHONY: test
test:
$(MKDIR) -p $(BUILD_DIR)/$@ 2> /dev/null
cd $(BUILD_DIR)/$@ && $(CMAKE) -D CMAKE_BUILD_TYPE=Debug $(PROJ_ROOT)/src/test
cd $(BUILD_DIR)/$@ && $(MAKE)
$(LN) -s -f $(BUILD_DIR)/$@/$(SUNFISH_TEST) $(SUNFISH_TEST)
$(FIND) $(BUILD_DIR)/$@ -name '*.gcda' | xargs $(RM)
$(SHELL) -c './$(SUNFISH_TEST) --out $(TESTRESULT)'
ifneq ($(HAS_COV),)
cd $(BUILD_DIR)/$@ && $(SHELL) -c '$(GEN_COV) -s $(PROJ_ROOT)/src -e test > $(COVOUT)'
endif
.PHONY: bm
bm:
$(MKDIR) -p $(BUILD_DIR)/$@ 2> /dev/null
cd $(BUILD_DIR)/$@ && $(CMAKE) -D CMAKE_BUILD_TYPE=Release $(PROJ_ROOT)/src/benchmark
cd $(BUILD_DIR)/$@ && $(MAKE)
$(LN) -s -f $(BUILD_DIR)/$@/$(SUNFISH_BM) $(SUNFISH_BM)
.PHONY: ln
ln:
$(MKDIR) -p $(BUILD_DIR)/$@ 2> /dev/null
cd $(BUILD_DIR)/$@ && $(CMAKE) -D CMAKE_BUILD_TYPE=Release -D LEARNING=ON $(PROJ_ROOT)/src/learn
cd $(BUILD_DIR)/$@ && $(MAKE)
$(LN) -s -f $(BUILD_DIR)/$@/$(SUNFISH_LN) $(SUNFISH_LN)
.PHONY: ln-mat
ln-mat:
$(MKDIR) -p $(BUILD_DIR)/$@ 2> /dev/null
cd $(BUILD_DIR)/$@ && $(CMAKE) -D CMAKE_BUILD_TYPE=Release -D LEARNING=ON -D MATERIAL_LEARNING=ON $(PROJ_ROOT)/src/learn
cd $(BUILD_DIR)/$@ && $(MAKE)
$(LN) -s -f $(BUILD_DIR)/$@/$(SUNFISH_LN) $(SUNFISH_LN)
.PHONY: ln-mat-only
ln-mat-only:
$(MKDIR) -p $(BUILD_DIR)/$@ 2> /dev/null
cd $(BUILD_DIR)/$@ && $(CMAKE) -D CMAKE_BUILD_TYPE=Release -D LEARNING=ON -D MATERIAL_LEARNING_ONLY=ON $(PROJ_ROOT)/src/learn
cd $(BUILD_DIR)/$@ && $(MAKE)
$(LN) -s -f $(BUILD_DIR)/$@/$(SUNFISH_LN) $(SUNFISH_LN)
.PHONY: csa
csa:
$(MKDIR) -p $(BUILD_DIR)/$@ 2> /dev/null
cd $(BUILD_DIR)/$@ && $(CMAKE) -D CMAKE_BUILD_TYPE=Release $(PROJ_ROOT)/src/csa
cd $(BUILD_DIR)/$@ && $(MAKE)
$(LN) -s -f $(BUILD_DIR)/$@/$(SUNFISH_CSA) $(SUNFISH_CSA)
.PHONY: csa-debug
csa-debug:
$(MKDIR) -p $(BUILD_DIR)/$@ 2> /dev/null
cd $(BUILD_DIR)/$@ && $(CMAKE) -D CMAKE_BUILD_TYPE=RelWithDebInfo $(PROJ_ROOT)/src/csa
cd $(BUILD_DIR)/$@ && $(MAKE)
$(LN) -s -f $(BUILD_DIR)/$@/$(SUNFISH_CSA) $(SUNFISH_CSA)
.PHONY: usi
usi:
$(MKDIR) -p $(BUILD_DIR)/$@ 2> /dev/null
cd $(BUILD_DIR)/$@ && $(CMAKE) -D CMAKE_BUILD_TYPE=Release $(PROJ_ROOT)/src/usi
cd $(BUILD_DIR)/$@ && $(MAKE)
$(LN) -s -f $(BUILD_DIR)/$@/$(SUNFISH_USI) $(SUNFISH_USI)
.PHONY: usi-debug
usi-debug:
$(MKDIR) -p $(BUILD_DIR)/$@ 2> /dev/null
cd $(BUILD_DIR)/$@ && $(CMAKE) -D CMAKE_BUILD_TYPE=RelWithDebInfo $(PROJ_ROOT)/src/usi
cd $(BUILD_DIR)/$@ && $(MAKE)
$(LN) -s -f $(BUILD_DIR)/$@/$(SUNFISH_USI) $(SUNFISH_USI)
.PHONY: tools
tools:
$(MKDIR) -p $(BUILD_DIR)/$@ 2> /dev/null
cd $(BUILD_DIR)/$@ && $(CMAKE) -D CMAKE_BUILD_TYPE=Release $(PROJ_ROOT)/src/tools
cd $(BUILD_DIR)/$@ && $(MAKE)
$(LN) -s -f $(BUILD_DIR)/$@/$(SUNFISH_TOOLS) $(SUNFISH_TOOLS)
.PHONY: dev
dev:
$(MKDIR) -p $(BUILD_DIR)/$@ 2> /dev/null
cd $(BUILD_DIR)/$@ && $(CMAKE) -D CMAKE_BUILD_TYPE=RelWithDebInfo $(PROJ_ROOT)/src/dev
cd $(BUILD_DIR)/$@ && $(MAKE)
$(LN) -s -f $(BUILD_DIR)/$@/$(SUNFISH_DEV) $(SUNFISH_DEV)
.PHONY: clean
clean:
$(RM) -r $(BUILD_DIR)
$(RM) $(SUNFISH_EXPT) \
$(SUNFISH_TEST) \
$(SUNFISH_BM) \
$(SUNFISH_LN) \
$(SUNFISH_CSA) \
$(SUNFISH_USI) \
$(SUNFISH_TOOLS) \
$(SUNFISH_DEV)