Makefile: always generate coverage.info
[aubio.git] / Makefile
index 4f68487..7a9de9b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,6 @@
 # $ make test_python
 
 WAFCMD=python waf
-WAFURL=https://waf.io/waf-1.8.22
 
 #WAFOPTS:=
 # turn on verbose mode
@@ -36,6 +35,9 @@ INCLUDEDIR?=$(PREFIX)/include
 DATAROOTDIR?=$(PREFIX)/share
 MANDIR?=$(DATAROOTDIR)/man
 
+# default nose2 command
+NOSE2?=nose2 -N 4 --verbose
+
 SOX=sox
 
 TESTSOUNDS := python/tests/sounds
@@ -53,7 +55,7 @@ expandwaf: getwaf
        $(WAFCMD) --help > /dev/null
        mv .waf*/waflib . && rm -fr .waf*
        sed '/^#==>$$/,$$d' waf > waf2 && mv waf2 waf
-       chmod +x waf
+       chmod +x waf && chmod -R go-w waflib
 
 cleanwaf:
        rm -rf waf waflib .waf*
@@ -113,7 +115,8 @@ install_python_with_pip:
 
 uninstall_python_with_pip:
        # uninstall package
-       pip uninstall -y -v aubio || make uninstall_python_with_distutils
+       ( pip show aubio | grep -l aubio > /dev/null ) && \
+       pip uninstall -y -v aubio || echo "info: aubio package is not installed"
 
 install_python_with_distutils:
        ./setup.py install $(PIPOPTS) $(DISTUTILSOPTS)
@@ -135,9 +138,9 @@ test_python: export LD_LIBRARY_PATH=$(DESTDIR)/$(LIBDIR)
 test_python: export PYTHONPATH=$(PYDESTDIR)/$(LIBDIR)
 test_python: local_dylib
        # run test with installed package
-       ./python/tests/run_all_tests --verbose
-       # also run with nose, multiple processes
-       nose2 -N 4
+       ./python/tests/run_all_tests --verbose
+       # run with nose2, multiple processes
+       $(NOSE2)
 
 clean_python:
        ./setup.py clean
@@ -161,6 +164,8 @@ check_clean:
 
 distclean:
        $(WAFCMD) distclean
+       -rm -rf doc/_build/
+       -rm -rf doc/web/
 
 check_distclean:
        make distclean
@@ -229,6 +234,24 @@ test_python_only_clean: test_python_only \
        uninstall_python \
        check_clean_python
 
+coverage: export CFLAGS=--coverage
+coverage: export LDFLAGS=--coverage
+coverage: export PYTHONPATH=$(PWD)/python/lib
+coverage: force_uninstall_python deps_python \
+       clean_python clean distclean
+       pip install -v -e .
+       coverage run `which nose2`
+       lcov --capture --no-external --directory . --output-file build/coverage.info
+
+coverage_report: coverage
+       genhtml build/coverage.info --output-directory lcov_html
+       mkdir -p gcovr_html/
+       gcovr -r . --html --html-details \
+               --output gcovr_html/index.html \
+               --exclude ".*tests/.*" --exclude ".*examples/.*"
+       coverage report
+       coverage html
+
 sphinx: configure
        $(WAFCMD) sphinx $(WAFOPTS)