Makefile 7.43 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

Mikaël Salson's avatar
Mikaël Salson committed
13
all:
14
	make COVERAGE="$(COVERAGE_OPTION)" -C $(VIDJIL_ALGO_SRC)
Mikaël Salson's avatar
Mikaël Salson committed
15

16
test:
17
	make COVERAGE="$(COVERAGE)" unit
18
	make functional
19
	make test_tools
20 21
	@echo
	@echo "*** All tests passed. Congratulations !"
Mikaël Salson's avatar
Mikaël Salson committed
22

23 24
test_browser: unit_browser functional_browser

25 26
test_server: unit_server

27 28
test_tools:
	make -C tools/tests
29

30 31
unit: all
	@echo "*** Launching unit tests..."
32
	make COVERAGE="$(COVERAGE_OPTION)" -C $(VIDJIL_ALGO_SRC)/tests
33
	@echo "*** All unit tests passed"
34

35 36 37 38
functional: all
	make should
	make shouldvdj

Mikaël Salson's avatar
Mikaël Salson committed
39 40 41
should: all
	@echo
	@echo "*** Launching .should_get tests..."
42
	make COVERAGE="$(COVERAGE_OPTION)" -C $(VIDJIL_ALGO_SRC)/tests should
Mikaël Salson's avatar
Mikaël Salson committed
43 44
	@echo "*** All .should_get tests passed"

45 46 47 48 49 50
shouldvdj: all
	@echo
	@echo "*** Launching .should-vdj-fa tests..."
	make COVERAGE="$(COVERAGE_OPTION)" -C $(VIDJIL_ALGO_SRC)/tests shouldvdj
	@echo "*** All .should-vdj.fa tests passed"

51
shouldvdj_generate:
52
	@echo
53
	rm -rf data/gen
54 55
	mkdir -p data/gen
	cd germline ; python generate-recombinations.py
56

57
shouldvdj_generated_kmer: all shouldvdj_generate
58
	@echo
59 60 61 62 63 64
	@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

65
shouldvdj_generated_fine: all shouldvdj_generate
66
	@echo
67 68 69 70 71 72
	@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

73 74 75 76 77
valgrind_unit:
	make -C algo/tests valgrind_tests

valgrind_should:
	make -C algo/tests valgrind_should
78

79 80 81 82 83 84 85 86 87
unit_browser:
	make -C browser/test unit

functional_browser:
	make -C browser/test functional

headless_browser:
	make -C browser/test headless

88 89 90
unit_server:
	make -C server/ unit

91 92
### Code coverage

93 94 95 96 97
coverage: unit_coverage should_coverage

unit_coverage: clean
	make COVERAGE=1 unit
should_coverage: clean
98
	make COVERAGE=1 functional
99 100 101 102

### Reports with gcovr

unit_gcovr: unit_coverage
103
	mkdir -p reports
104
	which gcovr > /dev/null && (cd algo;  gcovr -r . -e tests/ --xml > ../reports/unit_coverage.xml) || echo "gcovr is needed to generate a full report"
105
should_gcovr: should_coverage
106
	mkdir -p reports
107
	which gcovr > /dev/null && (cd algo; gcovr -r . -e tests/ --xml > ../reports/should_coverage.xml) || echo "gcovr is needed to generate a full report"
108

109 110 111
### Upload to coveralls.io

unit_coveralls:
112
	coveralls --exclude release --exclude algo/lib --exclude algo/tests --exclude algo/tools --exclude tests --exclude tools --exclude lib --gcov-options '\-lp'
113
should_coveralls:
114
	coveralls --exclude release --exclude algo/lib --exclude algo/tests --exclude algo/tools --exclude tests --exclude tools --exclude lib --gcov-options '\-lp' -r algo
115

116 117 118 119 120 121 122 123 124

### cppcheck

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

###

Mikaël Salson's avatar
Mikaël Salson committed
125 126 127 128
data germline: %:
	make -C $@

clean:
Mathieu Giraud's avatar
Mathieu Giraud committed
129
	make -C $(VIDJIL_ALGO_SRC) clean
Mikaël Salson's avatar
Mikaël Salson committed
130 131 132 133

cleanall: clean
	make -C data $^
	make -C germline $^
134
	make -C $(VIDJIL_ALGO_SRC) cleanall
135
	make -C server cleanall
Mikaël Salson's avatar
Mikaël Salson committed
136

137
.PHONY: all test should clean cleanall distrib data germline unit_coverage should_coverage coverage
Mikaël Salson's avatar
Mikaël Salson committed
138 139

RELEASE_TAG="notag"
Mathieu Giraud's avatar
Mathieu Giraud committed
140
RELEASE_H = $(VIDJIL_ALGO_SRC)/release.h
141
RELEASE_SOURCE = $(wildcard $(VIDJIL_ALGO_SRC)/*.cpp) $(wildcard $(VIDJIL_ALGO_SRC)/*.h)  $(wildcard $(VIDJIL_ALGO_SRC)/core/*.cpp)  $(wildcard $(VIDJIL_ALGO_SRC)/tests/*.cpp) $(wildcard $(VIDJIL_ALGO_SRC)/core/*.h)  $(wildcard $(VIDJIL_ALGO_SRC)/tests/*.h)  $(wildcard $(VIDJIL_ALGO_SRC)/cgi/*.cpp) $(wildcard $(VIDJIL_ALGO_SRC)/lib/*.cpp) $(wildcard $(VIDJIL_ALGO_SRC)/lib/*.h) $(wildcard tools/*.py)
142 143
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
RELEASE_TESTS =  doc/format-analysis.org data/get-sequences $(wildcard data/*.vidjil) $(wildcard data/*.analysis) $(wildcard data/*.fa) $(wildcard data/*.fq)  $(VIDJIL_ALGO_SRC)/tests/should-vdj-to-tap.py $(wildcard $(VIDJIL_ALGO_SRC)/tests/should-vdj-tests/*.should-vdj.fa)  $(VIDJIL_ALGO_SRC)/tests/should-to-tap.sh $(wildcard $(VIDJIL_ALGO_SRC)/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
144
RELEASE_GERMLINES = germline/germline_id germline/get-saved-germline germline/get-germline germline/split-from-imgt.py
145
RELEASE_FILES = $(RELEASE_SOURCE) $(RELEASE_TESTS) $(RELEASE_MAKE) $(RELEASE_GERMLINES) doc/CHANGELOG doc/algo.org doc/LICENSE data/segmentation.fasta $(wildcard data/*.fa.gz) $(wildcard data/*.label)
Mikaël Salson's avatar
Mikaël Salson committed
146 147 148 149 150 151
RELEASE_ARCHIVE = vidjil-$(RELEASE_TAG).tgz

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

152 153 154 155 156 157
# 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
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

# make distrib RELEASE_TAG=2013.04alpha
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
	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)
	cd release/$(DIST_DIR) && make
	cd release/$(DIST_DIR) && make germline
	cd release/$(DIST_DIR) && make data
	cd release/$(DIST_DIR) && make test


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
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)
	cd release/$(DIST_BROWSER_DIR) && make unit_browser


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