Commit a942fb54 authored by Mikaël Salson's avatar Mikaël Salson

Makefile: Add an option to compile with coverage.

Now you must compile with make COVERAGE=1 to compile with coverage
information. There is another rule (called coverage) which compiles with
coverage options and then runs gcovr (if available).
parent 7aacc2b8
COVERAGE=
VIDJIL_ALGO_SRC = algo/
VIDJIL_SERVER_SRC = server/
ifeq (${COVERAGE},1)
COVERAGE_OPTION=--coverage
else
COVERAGE_OPTION=
endif
all:
make -C $(VIDJIL_ALGO_SRC)
make COVERAGE="$(COVERAGE_OPTION)" -C $(VIDJIL_ALGO_SRC)
test:
make unit
make COVERAGE="$(COVERAGE)" unit
make should
# make pytests
test_with_fuse:
make unit
make COVERAGE="$(COVERAGE)" unit
make should
make pytests
unit: all
@echo "*** Launching unit tests..."
make -C $(VIDJIL_ALGO_SRC)/tests
make COVERAGE="$(COVERAGE_OPTION)" -C $(VIDJIL_ALGO_SRC)/tests
@echo "*** All .should_get tests passed"
pytests:
......@@ -29,9 +35,19 @@ pytests:
should: all
@echo
@echo "*** Launching .should_get tests..."
make -C $(VIDJIL_ALGO_SRC)/tests should
make COVERAGE="$(COVERAGE_OPTION)" -C $(VIDJIL_ALGO_SRC)/tests should
@echo "*** All .should_get tests passed"
coverage: unit_coverage should_coverage
unit_coverage: clean
make COVERAGE=1 unit
test -x gcovr && gcovr -r algo -e tests/ --xml > unit_coverage.xml || echo "gcovr is needed to generate a full report"
should_coverage: clean
make COVERAGE=1 should
test -x gcovr && gcovr -r algo -e tests/ --xml > should_coverage.xml || echo "gcovr is needed to generate a full report"
data germline: %:
make -C $@
......@@ -42,7 +58,7 @@ cleanall: clean
make -C data $^
make -C germline $^
.PHONY: all test should clean cleanall distrib data germline
.PHONY: all test should clean cleanall distrib data germline unit_coverage should_coverage coverage
RELEASE_TAG="notag"
RELEASE_H = $(VIDJIL_ALGO_SRC)/release.h
......
CC=g++
OPTIM=-O2 -DNDEBUG
OPTIM=-O2 -DNDEBUG $(COVERAGE)
CXXFLAGS=-W -Wall $(OPTIM) $(DEBUG) $(CONFIG)
LDFLAGS=-lm
EXEC=vidjil kmer kmer_count cut count detailed_affect
......@@ -50,6 +50,7 @@ $(EXEC): %: %.o
clean:
make -C core $@
rm -f *.o *.gcda *.gcno *.gcov
cd $(BINDIR) ; rm -f $(EXEC)
make -C tests $@
......
......@@ -13,7 +13,7 @@ $(LIBCORE): $(OBJCORE)
ar rc $@ $^
clean:
rm -f $(OBJCORE) $(LIBCORE)
rm -f $(OBJCORE) $(LIBCORE) *.gcda *.gcno *.gcov
forcedep:
g++ -M $(SRCCORE) > dep.mk
......
CC=g++
CXXFLAGS=-W -Wall -g -O0
CXXFLAGS=-W -Wall -g -O0 $(COVERAGE)
INCLUDE=-I ..
LDFLAGS=
SRC= tests.cpp
......@@ -33,16 +33,16 @@ $(EXEC): % : %.o $(LIB)
../core.a: core
vidjil:
make OPTIM="-O0 -g" -C ../
make CXXFLAGS="$(CXXFLAGS)" -C ../
core:
make OPTIM="-O0 -g" -C ../core
make CXXFLAGS="$(CXXFLAGS)" -C ../core
%.o: %.cpp $(OTHER_SRC)
$(CC) -o $@ $(INCLUDE) -c $< $(CXXFLAGS)
clean:
rm -f *.o $(EXEC) *.tap *.log
rm -f *.o $(EXEC) *.tap *.log *.gcda *.gcno *.gcov
forcedep:
g++ $(INCLUDE) -M $(SRC) > dep.mk
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment