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

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

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

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

15
test:
16
	make COVERAGE="$(COVERAGE)" unit
17 18 19 20
	make should
	# make pytests

test_with_fuse:
21
	make COVERAGE="$(COVERAGE)" unit
Mikaël Salson's avatar
Mikaël Salson committed
22
	make should
23
	make pytests
Mikaël Salson's avatar
Mikaël Salson committed
24

25 26
unit: all
	@echo "*** Launching unit tests..."
27
	make COVERAGE="$(COVERAGE_OPTION)" -C $(VIDJIL_ALGO_SRC)/tests
28
	@echo "*** All unit tests passed"
29

30 31 32
pytests:
	@echo "*** Launching python tests..."
	python server/fuse.py --test x
33
	@echo "*** All python tests passed"
Mathieu Giraud's avatar
Mathieu Giraud committed
34

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

41 42
### Code coverage

43 44 45 46 47 48
coverage: unit_coverage should_coverage

unit_coverage: clean
	make COVERAGE=1 unit
should_coverage: clean
	make COVERAGE=1 should
49 50 51 52 53 54

### Reports with gcovr

unit_gcovr: unit_coverage
	which gcovr > /dev/null && (cd algo;  gcovr -r . -e tests/ --xml > unit_coverage.xml) || echo "gcovr is needed to generate a full report"
should_gcovr: should_coverage
55
	which gcovr > /dev/null && (cd algo; gcovr -r . -e tests/ --xml > should_coverage.xml) || echo "gcovr is needed to generate a full report"
56

57 58 59
### Upload to coveralls.io

unit_coveralls:
60
	coveralls --exclude release --exclude algo/lib --exclude algo/tests --exclude algo/tools --exclude tests --exclude tools --exclude lib --gcov-options '\-lp'
61
should_coveralls:
62
	coveralls --exclude release --exclude algo/lib --exclude algo/tests --exclude algo/tools --exclude tests --exclude tools --exclude lib --gcov-options '\-lp' -r algo
63

Mikaël Salson's avatar
Mikaël Salson committed
64 65 66 67
data germline: %:
	make -C $@

clean:
Mathieu Giraud's avatar
Mathieu Giraud committed
68
	make -C $(VIDJIL_ALGO_SRC) clean
Mikaël Salson's avatar
Mikaël Salson committed
69 70 71 72 73

cleanall: clean
	make -C data $^
	make -C germline $^

74
.PHONY: all test should clean cleanall distrib data germline unit_coverage should_coverage coverage
Mikaël Salson's avatar
Mikaël Salson committed
75 76

RELEASE_TAG="notag"
Mathieu Giraud's avatar
Mathieu Giraud committed
77
RELEASE_H = $(VIDJIL_ALGO_SRC)/release.h
78
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)
79
RELEASE_MAKE = ./Makefile  $(VIDJIL_ALGO_SRC)/Makefile  $(VIDJIL_ALGO_SRC)/core/Makefile $(VIDJIL_ALGO_SRC)/tests/Makefile germline/Makefile data/Makefile
80
RELEASE_TESTS =  data/get-sequences $(wildcard data/*.fa) $(wildcard data/*.fq) $(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
81
RELEASE_FILES = $(RELEASE_SOURCE) $(RELEASE_TESTS) $(RELEASE_MAKE)  germline/get-germline germline/split-from-imgt.py  doc/algo.org doc/LICENSE data/segmentation.fasta
Mikaël Salson's avatar
Mikaël Salson committed
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
RELEASE_ARCHIVE = vidjil-$(RELEASE_TAG).tgz

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


# 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