-
Notifications
You must be signed in to change notification settings - Fork 112
/
Makefile
300 lines (233 loc) · 11.1 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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
rootPath = .
include ${rootPath}/include.mk
modules = api setup caf bar hal reference pipeline preprocessor
# submodules are in multiple pass to handle dependencies cactus2hal being dependent on
# both cactus and sonLib
submodules1 = sonLib cPecan hal matchingAndOrdering pinchesAndCacti abPOA lastz paffy red
submodules2 = cactus2hal
submodules = ${submodules1} ${submodules2}
git_commit ?= $(shell git rev-parse HEAD)
dockstore = quay.io/comparative-genomics-toolkit
name = ${dockstore}/cactus
tag = ${git_commit}
runtime_fullpath = $(realpath runtime)
# FIXME: this is also built by setup.py need to sort this out
versionPy = src/cactus/shared/version.py
CWD = ${PWD}
# these must be absolute, as used in submodules.
export sonLibRootDir = ${CWD}/submodules/sonLib
.PHONY: all all.% clean clean.% selfClean suball suball.% subclean.%
##
# Building. First build submodules, then a pass for libs and a pass for bins
##
all:
${MAKE} suball1
${MAKE} all_libs
${MAKE} all_progs
${MAKE} suball2
# Note: hdf5 from apt doesn't seem to work for static builds. It should be installed
# from source and configured with "--enable-static --disable-shared", then have its
# bin put at the front of PATH
static:
CFLAGS="$${CFLAGS} -static" \
CXXFLAGS="$${CXXFLAGS} -static" \
LIBS="-static" \
KC_OPTIONS="--enable-lzo --enable-static --disable-shared" \
KT_OPTIONS="--without-lua --enable-static --disable-shared" \
${MAKE} all
check-static: static
if [ $(shell ls bin/* | grep -v mash | xargs ldd 2>& 1 | grep "not a dynamic" | wc -l) = $(shell ls bin/* | grep -v mash | wc -l) ] ; then\
echo "ldd verified that all files in bin/ are static";\
else\
echo "ldd found dynamic linked binary in bin/";\
exit 1;\
fi
all_libs:
${MAKE} ${modules:%=all_libs.%}
all_progs: all_libs
${MAKE} ${modules:%=all_progs.%}
all_libs.%:
cd $* && ${MAKE} all_libs
all_progs.%:
cd $* && ${MAKE} all_progs
# special ordering
all_libs.blastLib: all_libs.api
##
# tests, see DEVELOPMENT.md for environment variables controling tests.
##
# Python tests
testModules = \
progressive/outgroupTest.py \
preprocessor/cactus_preprocessorTest.py \
preprocessor/lastzRepeatMasking/cactus_lastzRepeatMaskTest.py \
progressive/multiCactusTreeTest.py
# Unit tests (just collecting everything in bin/ with "test" in the name)
unitTests = \
cactus_barTests \
cactusAPITests \
cactus_halGeneratorTests \
stCafTests \
stPinchesAndCactiTests \
stPipelineTests \
matchingAndOrderingTests \
referenceTests \
cPecanLibTests \
sonLibTests \
#paffyTests \ # This is removed for now
# if running travis or gitlab, we want output to go to stdout/stderr so it can
# be seen in the log file, as opposed to individual files, which are much
# easier to read when running tests in parallel.
ifeq (${TRAVIS}${GITLAB_CI},)
define testErrOut
>& ${testLogDir}/$(basename $(notdir $*)).log
endef
else
testErrOut =
endif
export PATH := ${CWD}/bin:${PATH}
export PYTHONPATH = ${CWD}/submodules/sonLib/src:${CWD}/submodules:${CWD}/src
pytestOpts = --tb=native --durations=0 -rsx
testOutDir = test-output
testLogDir = ${testOutDir}/logs
# parallel tests don't currenty work, not all cases of collission have
# been fixed
.NOTPARALLEL: test test_blast test_nonblast
test: ${testModules:%=%_runtest} ${unitTests:%=%_run_unit_test}
test_blast: ${testModules:%=%_runtest_blast}
test_nonblast: ${testModules:%=%_runtest_nonblast}
hal_test:
cd ${CWD}/submodules/hal && make test
# run one test and save output
%_runtest: ${versionPy}
@mkdir -p ${testLogDir}
${PYTHON} -m pytest ${pytestOpts} src/cactus/$* ${testErrOut}
%_runtest_blast: ${versionPy}
@mkdir -p ${testLogDir}
${PYTHON} -m pytest ${pytestOpts} src/cactus/$* --suite=blast ${testErrOut}
%_runtest_nonblast: ${versionPy}
@mkdir -p ${testLogDir}
${PYTHON} -m pytest ${pytestOpts} src/cactus/$* --suite=nonblast ${testErrOut}
%_run_unit_test:
$*
${versionPy}:
echo "cactus_commit = '${git_commit}'" >$@
${CWD}/test/mammals-truth.maf:
cd ${CWD}/test && wget -q https://raw.githubusercontent.com/UCSantaCruzComputationalGenomicsLab/cactusTestData/master/evolver/mammals/loci1/all.maf -O mammals-truth.maf
${CWD}/test/primates-truth.maf:
cd ${CWD}/test && wget -q https://raw.githubusercontent.com/UCSantaCruzComputationalGenomicsLab/cactusTestData/master/evolver/primates/loci1/all.maf -O primates-truth.maf
evolver_test: all ${CWD}/test/mammals-truth.maf ${CWD}/test/primates-truth.maf
# note: make docker needs to be run beforehand
PYTHONPATH="${CWD}/submodules/" CACTUS_DOCKER_ORG=evolvertestdocker CACTUS_USE_LATEST=1 ${PYTHON} -m pytest ${pytestOpts} test/evolverTest.py
evolver_test_local: all ${CWD}/test/mammals-truth.maf
PYTHONPATH="${CWD}/submodules/" CACTUS_BINARIES_MODE=local CACTUS_DOCKER_MODE=0 ${PYTHON} -m pytest ${pytestOpts} -s test/evolverTest.py::TestCase::testEvolverLocal
evolver_test_prepare_wdl: all ${CWD}/test/mammals-truth.maf
PYTHONPATH="${CWD}/submodules/" CACTUS_BINARIES_MODE=local CACTUS_DOCKER_MODE=0 ${PYTHON} -m pytest ${pytestOpts} -s test/evolverTest.py::TestCase::testEvolverPrepareWDL
evolver_test_prepare_toil: all ${CWD}/test/mammals-truth.maf
PYTHONPATH="${CWD}/submodules/" CACTUS_BINARIES_MODE=local CACTUS_DOCKER_MODE=0 ${PYTHON} -m pytest ${pytestOpts} -s test/evolverTest.py::TestCase::testEvolverPrepareToil
evolver_test_decomposed_local: all ${CWD}/test/mammals-truth.maf
PYTHONPATH="${CWD}/submodules/" CACTUS_BINARIES_MODE=local CACTUS_DOCKER_MODE=0 ${PYTHON} -m pytest ${pytestOpts} -s test/evolverTest.py::TestCase::testEvolverDecomposedLocal
evolver_test_decomposed_docker: all ${CWD}/test/mammals-truth.maf
#note make docker needs to be run beforehand
PYTHONPATH="${CWD}/submodules/" CACTUS_DOCKER_ORG=evolvertestdocker CACTUS_USE_LATEST=1 ${PYTHON} -m pytest ${pytestOpts} -s test/evolverTest.py::TestCase::testEvolverDecomposedDocker
evolver_test_docker: all ${CWD}/test/mammals-truth.maf
PYTHONPATH="${CWD}/submodules/" CACTUS_BINARIES_MODE=local ${PYTHON} -m pytest ${pytestOpts} -s test/evolverTest.py::TestCase::testEvolverDocker
evolver_test_prepare_no_outgroup_docker: all ${CWD}/test/mammals-truth.maf
#note make docker needs to be run beforehand
PYTHONPATH="${CWD}/submodules/" CACTUS_DOCKER_ORG=evolvertestdocker CACTUS_USE_LATEST=1 ${PYTHON} -m pytest ${pytestOpts} -s test/evolverTest.py::TestCase::testEvolverPrepareNoOutgroupDocker
evolver_test_prepare_no_outgroup_local: all ${CWD}/test/mammals-truth.maf
PYTHONPATH="${CWD}/submodules/" CACTUS_BINARIES_MODE=local CACTUS_DOCKER_MODE=0 ${PYTHON} -m pytest ${pytestOpts} -s test/evolverTest.py::TestCase::testEvolverPrepareNoOutgroupLocal
evolver_test_update_node_local: ${CWD}/test/mammals-truth.maf
PYTHONPATH="${CWD}/submodules/" CACTUS_BINARIES_MODE=local CACTUS_DOCKER_MODE=0 ${PYTHON} -m pytest ${pytestOpts} -s test/evolverTest.py::TestCase::testEvolverUpdateNodeLocal
evolver_test_update_branch_local: ${CWD}/test/mammals-truth.maf
PYTHONPATH="${CWD}/submodules/" CACTUS_BINARIES_MODE=local CACTUS_DOCKER_MODE=0 ${PYTHON} -m pytest ${pytestOpts} -s test/evolverTest.py::TestCase::testEvolverUpdateBranchLocal
evolver_test_poa_local: all ${CWD}/test/primates-truth.maf
PYTHONPATH="${CWD}/submodules/" CACTUS_BINARIES_MODE=local CACTUS_DOCKER_MODE=0 ${PYTHON} -m pytest ${pytestOpts} -s test/evolverTest.py::TestCase::testEvolverPOALocal
evolver_test_refmap_local: all ${CWD}/test/primates-truth.maf
PYTHONPATH="${CWD}/submodules/" CACTUS_BINARIES_MODE=local CACTUS_DOCKER_MODE=0 ${PYTHON} -m pytest ${pytestOpts} -s test/evolverTest.py::TestCase::testEvolverRefmapLocal
evolver_test_minigraph_local: all ${CWD}/test/primates-truth.maf
PYTHONPATH="${CWD}/submodules/" CACTUS_BINARIES_MODE=local CACTUS_DOCKER_MODE=0 ${PYTHON} -m pytest ${pytestOpts} -s test/evolverTest.py::TestCase::testEvolverMinigraphLocal
evolver_test_primates_pangenome_local: all ${CWD}/test/primates-truth.maf
PYTHONPATH="${CWD}/submodules/" CACTUS_BINARIES_MODE=local CACTUS_DOCKER_MODE=0 ${PYTHON} -m pytest ${pytestOpts} -s test/evolverTest.py::TestCase::testEvolverPrimatesPangenomeLocal
evolver_test_primates_pangenome_docker: all ${CWD}/test/primates-truth.maf
PYTHONPATH="${CWD}/submodules/" CACTUS_BINARIES_MODE=docker CACTUS_DOCKER_MODE=1 ${PYTHON} -m pytest ${pytestOpts} -s test/evolverTest.py::TestCase::testEvolverPrimatesPangenomeDocker
evolver_test_all_local: evolver_test_local evolver_test_prepare_toil evolver_test_decomposed_local evolver_test_prepare_no_outgroup_local evolver_test_poa_local evolver_test_refmap_local evolver_test_minigraph_local
yeast_test_local:
PYTHONPATH="${CWD}/submodules/" CACTUS_BINARIES_MODE=local CACTUS_DOCKER_MODE=0 ${PYTHON} -m pytest ${pytestOpts} -s test/evolverTest.py::TestCase::testYeastPangenomeLocal
yeast_test_step_by_step_local:
PYTHONPATH="${CWD}/submodules/" CACTUS_BINARIES_MODE=local CACTUS_DOCKER_MODE=0 ${PYTHON} -m pytest ${pytestOpts} -s test/evolverTest.py::TestCase::testYeastPangenomeStepByStepLocal
##
# clean targets
##
selfClean: ${modules:%=clean.%}
rm -rf include lib bin libexec ${versionPy} ${testOutDir} testTCDatabase build
clean.%:
cd $* && ${MAKE} clean
clean: selfClean ${submodules:%=subclean.%}
##
# submodules
##
suball1: ${submodules1:%=suball.%}
suball2: ${submodules2:%=suball.%}
suball.sonLib:
cd submodules/sonLib && PKG_CONFIG_PATH=${CWD}/lib/pkgconfig:${PKG_CONFIG_PATH} ${MAKE}
mkdir -p ${BINDIR} ${LIBDIR} ${INCLDIR}
rm -rf submodules/sonLib/bin/*.dSYM
ln -f submodules/sonLib/bin/[a-zA-Z]* ${BINDIR}
ln -f submodules/sonLib/lib/*.a ${LIBDIR}
suball.pinchesAndCacti: suball.sonLib
cd submodules/pinchesAndCacti && ${MAKE}
suball.matchingAndOrdering: suball.sonLib
cd submodules/matchingAndOrdering && ${MAKE}
suball.cPecan: suball.sonLib
cd submodules/cPecan && ${MAKE}
rm -f ${BINDIR}/cPecanLastz*
suball.cactus2hal: suball.sonLib suball.hal all_libs.api
cd submodules/cactus2hal && ${MAKE}
mkdir -p bin
-ln -f submodules/cactus2hal/bin/* bin/
suball.hal: suball.sonLib
cd submodules/hal && ${MAKE}
mkdir -p bin
-ln -f submodules/hal/bin/* bin/
-ln -f submodules/hal/lib/libHal.a submodules/hal/lib/halLib.a
suball.abPOA:
cd submodules/abPOA && ${MAKE}
ln -f submodules/abPOA/lib/*.a ${LIBDIR}
ln -f submodules/abPOA/include/*.h ${INCLDIR}
rm -fr ${INCLDIR}/simde && cp -r submodules/abPOA/include/simde ${INCLDIR}
suball.lastz:
cd submodules/lastz && ${MAKE}
mkdir -p bin
ln -f submodules/lastz/src/lastz bin
suball.paffy:
cd submodules/paffy && ${MAKE}
rm -rf submodules/paffy/bin/*.dSYM
mkdir -p ${BINDIR} ${LIBDIR} ${INCLDIR}
ln -f submodules/paffy/bin/[a-zA-Z]* ${BINDIR}
ln -f submodules/paffy/lib/*.a ${LIBDIR}
ln -f submodules/paffy/inc/*.h ${INCLDIR}
suball.red:
cd submodules/red && ${MAKE}
ln -f submodules/red/bin/Red ${BINDIR}
subclean.%:
cd submodules/$* && ${MAKE} clean
##
# docker
##
docker: Dockerfile
-docker rmi -f ${name}:latest
docker build --network=host -t ${name}:${tag} . --build-arg CACTUS_COMMIT=${git_commit}
docker tag ${name}:${tag} ${name}:latest
docker tag ${name}:${tag} evolvertestdocker/cactus:latest
# Requires ~/.dockercfg
push: docker
docker push ${name}:${tag}
docker push ${name}:latest
push_only:
docker push ${name}:${tag}
docker push ${name}:latest
binRelease:
./build-tools/makeBinRelease
CACTUS_LEGACY_ARCH=1 ./build-tools/makeBinRelease
srcRelease:
./build-tools/makeSrcRelease