Makefile 8.6 KB
Newer Older
Mikaël Salson's avatar
Mikaël Salson committed
1

2
COVERAGE=
Mathieu Giraud's avatar
Mathieu Giraud committed
3
VIDJIL_ALGO_SRC = algo/
4
VIDJIL_BROWSER_SRC = browser/
Mathieu Giraud's avatar
Mathieu Giraud committed
5 6
VIDJIL_SERVER_SRC = server/

7
ifeq (${COVERAGE},1)
8
	COVERAGE_OPTION=-O0 --coverage
9 10 11 12
else
	COVERAGE_OPTION=
endif

13 14
TEE = python tools/tee.py -v

Mikaël Salson's avatar
Mikaël Salson committed
15
all:
Mikaël Salson's avatar
Mikaël Salson committed
16
	$(MAKE) COVERAGE="$(COVERAGE_OPTION)" -C $(VIDJIL_ALGO_SRC)
Mikaël Salson's avatar
Mikaël Salson committed
17

18
static:
Mikaël Salson's avatar
Mikaël Salson committed
19
	$(MAKE) all LDFLAGS="-static -static-libstdc++"
20

21
test:
22
	$(MAKE) -C algo/tests cleantests
23
	$(TEE) '$(MAKE) COVERAGE="$(COVERAGE)" unit' algo/tests/out-unit.log
Mikaël Salson's avatar
Mikaël Salson committed
24
	$(MAKE) functional
25
	$(TEE) '$(MAKE) test_tools_if_python'        algo/tests/out-tools.log
26 27
	@echo
	@echo "*** All tests passed. Congratulations !"
28
	@echo
29
	$(MAKE) -C algo/tests snapshot
Mikaël Salson's avatar
Mikaël Salson committed
30

31 32 33 34
snapshot_diff:
	$(MAKE) -C algo/tests snapshot_diff


35 36
test_browser: unit_browser functional_browser

37 38
test_server: unit_server

39
test_tools_if_python:
40
	@((python tools/check_python_version.py && $(MAKE) test_tools) || (python tools/check_python_version.py || echo "!!! Bad python version, we skip tools tests..."))
41

42
test_tools:
Mikaël Salson's avatar
Mikaël Salson committed
43
	$(MAKE) -C tools/tests
44

45 46
unit: all
	@echo "*** Launching unit tests..."
Mikaël Salson's avatar
Mikaël Salson committed
47
	$(MAKE) COVERAGE="$(COVERAGE_OPTION)" -C $(VIDJIL_ALGO_SRC)/tests
48
	@echo "*** All unit tests passed"
49

50
functional: all
51 52
	$(TEE) '$(MAKE) should'      algo/tests/out-should-get.log
	$(TEE) '$(MAKE) shouldvdj'   algo/tests/out-should-vdj.log
53

Mikaël Salson's avatar
Mikaël Salson committed
54 55 56
should: all
	@echo
	@echo "*** Launching .should_get tests..."
Mikaël Salson's avatar
Mikaël Salson committed
57
	$(MAKE) COVERAGE="$(COVERAGE_OPTION)" -C $(VIDJIL_ALGO_SRC)/tests should
Mikaël Salson's avatar
Mikaël Salson committed
58 59
	@echo "*** All .should_get tests passed"

60 61
shouldvdj: all
	@echo
62
	$(MAKE) COVERAGE="$(COVERAGE_OPTION)" -C $(VIDJIL_ALGO_SRC)/tests shouldvdj_if_python
63

64
shouldvdj_generate:
65
	@echo
66
	rm -rf data/gen
67
	mkdir -p data/gen
68
	cd germline ; python generate-recombinations.py --random-deletions 8,4:3,1:5,3 --random-insertions 5,4 -e .01
69

70
shouldvdj_generated_kmer: all
71
	@echo
72 73 74 75 76 77
	@echo "*** Launching generated .should-vdj-fa tests (and accepts errors) -- Kmer"
	-cd data/gen ; python ../../algo/tests/should-vdj-to-tap.py -2q *.should-vdj.fa
	@echo "*** Generated .should-vdj.fa tests finished -- Kmer"
	python algo/tests/tap-stats.py data/gen/0-*.2.tap
	python algo/tests/tap-stats.py data/gen/5-*.2.tap

78
shouldvdj_generated_fine: all
79
	@echo
80 81 82 83 84 85
	@echo "*** Launching generated .should-vdj-fa tests (and accepts errors) -- Fine"
	-cd data/gen ; python ../../algo/tests/should-vdj-to-tap.py *.should-vdj.fa
	@echo "*** Generated .should-vdj.fa tests finished -- Fine"
	python algo/tests/tap-stats.py data/gen/0-*.1.tap
	python algo/tests/tap-stats.py data/gen/5-*.1.tap

86
valgrind_unit:
Mikaël Salson's avatar
Mikaël Salson committed
87
	$(MAKE) -C algo/tests valgrind_tests
88 89

valgrind_should:
Mikaël Salson's avatar
Mikaël Salson committed
90
	$(MAKE) -C algo/tests valgrind_should
91

92
unit_browser:
Mikaël Salson's avatar
Mikaël Salson committed
93
	$(MAKE) -C browser/test unit
94 95

functional_browser:
Mikaël Salson's avatar
Mikaël Salson committed
96
	$(MAKE) -C browser/test functional
97 98

headless_browser:
Mikaël Salson's avatar
Mikaël Salson committed
99
	$(MAKE) -C browser/test headless
100

101
unit_server:
Mikaël Salson's avatar
Mikaël Salson committed
102
	$(MAKE) -C server/ unit
103

104 105
### Code coverage

106 107 108
coverage: unit_coverage should_coverage

unit_coverage: clean
Mikaël Salson's avatar
Mikaël Salson committed
109
	$(MAKE) COVERAGE=1 unit
110
should_coverage: clean
Mikaël Salson's avatar
Mikaël Salson committed
111
	$(MAKE) COVERAGE=1 functional
112 113 114 115

### Reports with gcovr

unit_gcovr: unit_coverage
116
	mkdir -p reports
117
	which gcovr > /dev/null && (cd algo;  gcovr -r . -e tests/ --xml > ../reports/unit_coverage.xml) || echo "gcovr is needed to generate a full report"
118
should_gcovr: should_coverage
119
	mkdir -p reports
120
	which gcovr > /dev/null && (cd algo; gcovr -r . -e tests/ --xml > ../reports/should_coverage.xml) || echo "gcovr is needed to generate a full report"
121

122 123 124
### Upload to coveralls.io

unit_coveralls:
125
	coveralls $(COVERALLS_OPTIONS) --exclude release --exclude algo/lib --exclude algo/tests --exclude algo/tools --exclude tests --exclude tools --exclude lib --gcov-options '\-lp'
126
should_coveralls:
127
	coveralls $(COVERALLS_OPTIONS) --exclude release --exclude algo/lib --exclude algo/tests --exclude algo/tools --exclude tests --exclude tools --exclude lib --gcov-options '\-lp' -r algo
128

129 130 131 132 133 134 135 136 137

### cppcheck

cppcheck:
	mkdir -p reports
	cppcheck --enable=all --xml . 2>! reports/cppcheck.xml

###

Mikaël Salson's avatar
Mikaël Salson committed
138
data germline: %:
Mikaël Salson's avatar
Mikaël Salson committed
139
	$(MAKE) -C $@
Mikaël Salson's avatar
Mikaël Salson committed
140 141

clean:
Mikaël Salson's avatar
Mikaël Salson committed
142
	$(MAKE) -C $(VIDJIL_ALGO_SRC) clean
Mikaël Salson's avatar
Mikaël Salson committed
143 144

cleanall: clean
Mikaël Salson's avatar
Mikaël Salson committed
145 146 147 148
	$(MAKE) -C data $^
	$(MAKE) -C germline $^
	$(MAKE) -C $(VIDJIL_ALGO_SRC) cleanall
	$(MAKE) -C server cleanall
Mikaël Salson's avatar
Mikaël Salson committed
149

150
.PHONY: all test should clean cleanall distrib data germline unit_coverage should_coverage coverage
Mikaël Salson's avatar
Mikaël Salson committed
151 152

RELEASE_TAG="notag"
Mathieu Giraud's avatar
Mathieu Giraud committed
153
RELEASE_H = $(VIDJIL_ALGO_SRC)/release.h
154
RELEASE_SOURCE = $(wildcard $(VIDJIL_ALGO_SRC)/*.cpp) $(wildcard $(VIDJIL_ALGO_SRC)/*.h)  $(wildcard $(VIDJIL_ALGO_SRC)/core/*.cpp)  $(wildcard $(VIDJIL_ALGO_SRC)/tests/unit-tests/*.cpp) $(wildcard $(VIDJIL_ALGO_SRC)/core/*.h)  $(wildcard $(VIDJIL_ALGO_SRC)/tests/unit-tests/*.h)  $(wildcard $(VIDJIL_ALGO_SRC)/cgi/*.cpp) $(wildcard $(VIDJIL_ALGO_SRC)/lib/*.cpp) $(wildcard $(VIDJIL_ALGO_SRC)/lib/*.h) $(wildcard $(VIDJIL_ALGO_SRC)/lib/*.hpp) $(wildcard tools/*.py)
155
RELEASE_MAKE = ./Makefile  $(VIDJIL_ALGO_SRC)/Makefile  $(VIDJIL_ALGO_SRC)/core/Makefile $(VIDJIL_ALGO_SRC)/tests/Makefile $(VIDJIL_ALGO_SRC)/lib/Makefile germline/Makefile data/Makefile tools/tests/Makefile doc/Makefile
156
RELEASE_TESTS =  doc/format-analysis.org data/get-sequences $(wildcard data/*.vidjil) $(wildcard data/*.analysis) $(wildcard data/*.data) $(wildcard data/*.fa) $(wildcard data/*.fq)  $(VIDJIL_ALGO_SRC)/tests/should-vdj-to-tap.py $(VIDJIL_ALGO_SRC)/tests/ansi.py $(wildcard $(VIDJIL_ALGO_SRC)/tests/should-vdj-tests/*.should-vdj.fa) $(wildcard $(VIDJIL_ALGO_SRC)/tests/should-vdj-tests/*.should-locus.fa) $(VIDJIL_ALGO_SRC)/tests/should-to-tap.sh $(wildcard $(VIDJIL_ALGO_SRC)/tests/should-get-tests/*.should-get) $(wildcard $(VIDJIL_ALGO_SRC)/tests/bugs/*.fa)  $(wildcard $(VIDJIL_ALGO_SRC)/tests/bugs/*.should_get) $(VIDJIL_ALGO_SRC)/tests/format-json.sh $(wildcard doc/analysis-example.vidjil) $(wildcard tools/tests/*.should_get) tools/tests/should-to-tap.sh tools/diff_json.sh
157
RELEASE_GERMLINES = germline/germline_id germline/get-saved-germline germline/get-germline germline/split-from-imgt.py $(wildcard germline/*.data) $(wildcard germline/*/*.data) germline/revcomp-fasta.py germline/fasta.py
158
RELEASE_HELP = doc/algo.org doc/locus.org doc/dev.org doc/should-vdj.org doc/credits.org doc/CHANGELOG  doc/LICENSE
159
RELEASE_FILES = $(RELEASE_SOURCE) $(RELEASE_TESTS) $(RELEASE_MAKE) $(RELEASE_GERMLINES) $(RELEASE_HELP) data/segmentation.fasta $(wildcard data/*.fa.gz) $(wildcard data/*.label)
Mikaël Salson's avatar
Mikaël Salson committed
160 161 162 163 164 165
RELEASE_ARCHIVE = vidjil-$(RELEASE_TAG).tgz

CURRENT_DIR = vidjil
DIST_DIR=$(CURRENT_DIR)-$(RELEASE_TAG)
RELEASE_FILES_VID = $(RELEASE_FILES)

166 167 168 169 170 171
# Browser
RELEASE_JS = $(VIDJIL_BROWSER_SRC)/js/release.js
RELEASE_BROWSER_ARCHIVE = vidjil-browser-$(RELEASE_TAG).tgz
DIST_BROWSER_DIR=vidjil-browser-$(RELEASE_TAG)
TEST_FILES_BROWSER= Makefile $(VIDJIL_BROWSER_SRC)/test/Makefile $(wildcard $(VIDJIL_BROWSER_SRC)/test/*.rb) $(wildcard $(VIDJIL_BROWSER_SRC)/test/QUnit/*)  $(wildcard $(VIDJIL_BROWSER_SRC)/test/QUnit/testFiles/*.js)
RELEASE_FILES_BROWSER=$(TEST_FILES_BROWSER) $(wildcard $(VIDJIL_BROWSER_SRC)/*.html) $(wildcard $(VIDJIL_BROWSER_SRC)/js/*.js) $(wildcard $(VIDJIL_BROWSER_SRC)/js/lib/*.js) $(wildcard $(VIDJIL_BROWSER_SRC)/css/*.css) 
Mikaël Salson's avatar
Mikaël Salson committed
172

Mikaël Salson's avatar
Mikaël Salson committed
173
# $(MAKE) distrib RELEASE_TAG=2013.04alpha
Mikaël Salson's avatar
Mikaël Salson committed
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
distrib:	
	$(info ==== Release $(RELEASE_TAG) ====)

	# Tag the release
	if test "$(RELEASE_TAG)" != "notag"; then \
		git tag -f release-$(RELEASE_TAG); \
		echo '#define RELEASE_TAG "$(RELEASE_TAG)"' > $(RELEASE_H); \
	fi

	mkdir -p release 
	rm -rf release/$(RELEASE_ARCHIVE) release/$(DIST_DIR)
	mkdir -p release/$(DIST_DIR)
	for file in  $(RELEASE_FILES_VID); do\
		dir=release/$(DIST_DIR)/`dirname "$$file"`;	\
		mkdir -p $$dir;	\
		cp "$$file" $$dir;	\
	done
191
	make -C release/$(DIST_DIR)/doc html || true
192

Mikaël Salson's avatar
Mikaël Salson committed
193 194 195 196 197 198 199 200
	cd release && tar cvzf  $(RELEASE_ARCHIVE) $(DIST_DIR) \
	&& rm -rf $(DIST_DIR)

	# Untag the source
	rm -f $(RELEASE_H) ; touch $(RELEASE_H)

	# Check archive
	cd release && tar xvfz $(RELEASE_ARCHIVE)
Mikaël Salson's avatar
Mikaël Salson committed
201 202 203 204 205
	cd release/$(DIST_DIR) && $(MAKE)
	cd release/$(DIST_DIR) && $(MAKE) germline
	cd release/$(DIST_DIR) && $(MAKE) data
	cd release/$(DIST_DIR) && $(MAKE) test
	cd release/$(DIST_DIR) && $(MAKE) clean && $(MAKE) static && mv vidjil vidjil-$(RELEASE_TAG)_`uname -m`
Mikaël Salson's avatar
Mikaël Salson committed
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
release_browser:
	$(info ==== Browser Release $(RELEASE_TAG) ====)

	# Tag the release
	if test "$(RELEASE_TAG)" != "notag"; then \
		git tag -f release-$(RELEASE_TAG); \
		echo 'RELEASE_TAG = "$(RELEASE_TAG)"' > $(RELEASE_JS); \
	fi

	mkdir -p release 
	rm -rf release/$(RELEASE_BROWSER_ARCHIVE) release/$(DIST_BROWSER_DIR)
	mkdir -p release/$(DIST_BROWSER_DIR)
	for file in  $(RELEASE_FILES_BROWSER); do\
		dir=release/$(DIST_BROWSER_DIR)/`dirname "$$file"`;	\
		mkdir -p $$dir;	\
		cp "$$file" $$dir;	\
	done
	cd release && tar cvzf  $(RELEASE_BROWSER_ARCHIVE) $(DIST_BROWSER_DIR) \
	&& rm -rf $(DIST_BROWSER_DIR)

	# Untag the source
	rm -f $(RELEASE_JS) ; touch $(RELEASE_JS)

	# Check archive
	cd release && tar xvfz $(RELEASE_BROWSER_ARCHIVE)
Mikaël Salson's avatar
Mikaël Salson committed
233
	cd release/$(DIST_BROWSER_DIR) && $(MAKE) unit_browser
234 235


Mikaël Salson's avatar
Mikaël Salson committed
236