Makefile: add rules for documentation, simplify listing
[aubio.git] / Makefile
index 53b75ba..afe00e2 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,14 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+#
+# This makefile contains simple rules to prepare, compile, test, and install
+# aubio. Try one of the following rules:
+#
+# $ make configure
+# $ make build
+# $ make install
+# $ make test_python
+
 WAFCMD=python waf
 WAFURL=https://waf.io/waf-1.8.22
 
@@ -8,12 +19,15 @@ WAFOPTS += --verbose
 WAFOPTS += --destdir $(DESTDIR)
 # multiple jobs
 WAFOPTS += --jobs 4
+# if HAVE_AUBIO_DOUBLE is defined, pass --enable-double to waf
+# python/lib/moresetuptools.py also checks for HAVE_AUBIO_DOUBLE
+WAFOPTS += $(shell [ -z $(HAVE_AUBIO_DOUBLE) ] || echo --enable-double )
+
+PIPOPTS += --verbose
 
 DESTDIR:=$(PWD)/build/dist
 PYDESTDIR:=$(PWD)/build/pydist
 
-BUILDID=$(shell mktemp -d -p $(PWD)/dist/)
-
 # default install locations
 PREFIX?=/usr/local
 EXEC_PREFIX?=$(PREFIX)
@@ -24,7 +38,6 @@ MANDIR?=$(DATAROOTDIR)/man
 
 SOX=sox
 
-ENABLE_DOUBLE := $(shell [ -z $(HAVE_DOUBLE) ] || echo --enable-double )
 TESTSOUNDS := python/tests/sounds
 
 all: build
@@ -46,7 +59,7 @@ cleanwaf:
        rm -rf waf waflib .waf*
 
 configure: checkwaf
-       $(WAFCMD) configure $(WAFOPTS) $(ENABLE_DOUBLE)
+       $(WAFCMD) configure $(WAFOPTS)
 
 build: configure
        $(WAFCMD) build $(WAFOPTS)
@@ -56,26 +69,10 @@ install:
        $(WAFCMD) install $(WAFOPTS)
 
 list_installed:
-       find $(DESTDIR) -ls | \
-               sed 's|$(DESTDIR)|/«destdir»|'
-       tar --full-time --mtime=$(PWD)/src/aubio.h -jcvf $(BUILDID)/aubio-dist.tar.bz2 -C $(DESTDIR)/ .
+       find $(DESTDIR) -ls | sed 's|$(DESTDIR)|/«destdir»|'
 
 list_installed_python:
-       ( find $(PYDESTDIR) -ls || make list_installed_python_package ) | \
-               sed 's|$(PYDESTDIR)|/«pydestdir»|'
-       [ -d $(PYDESTDIR) ] && \
-               tar --full-time --mtime=$(PWD)/src/aubio.h -jcvf $(BUILDID)/python-aubio-dist.tar.bz2 -C $(PYDESTDIR)/ . || \
-               true
-
-list_installed_python_package:
        pip show -f aubio
-       PACKAGE_LOCATION=$(shell pip show -f aubio | grep ^Location | cut -d \  -f 2) \
-               make list_installed_python_package_content
-
-list_installed_python_package_content:
-       ( [ -d $(PACKAGE_LOCATION) ] && find $(PACKAGE_LOCATION) -ls ) || \
-               unzip -l $(PACKAGE_LOCATION)
-       cp -prv $(PACKAGE_LOCATION) $(BUILDID)
 
 list_all_installed: list_installed list_installed_python
 
@@ -88,7 +85,7 @@ delete_install:
 
 build_python:
        # build python-aubio, using locally built libaubio if found
-       python ./setup.py build_ext $(ENABLE_DOUBLE)
+       python ./setup.py build
 
 build_python_extlib:
        # build python-aubio using (locally) installed libaubio
@@ -102,24 +99,24 @@ build_python_extlib:
 
 deps_python:
        # install or upgrade python requirements
-       pip install --verbose --requirement requirements.txt
+       pip install $(PIPOPTS) --requirement requirements.txt
 
 # use pip or distutils?
-#install_python: install_python_with_pip
+install_python: install_python_with_pip
 uninstall_python: uninstall_python_with_pip
-install_python: install_python_with_distutils
+#install_python: install_python_with_distutils
 #uninstall_python: uninstall_python_with_distutils
 
 install_python_with_pip:
        # install package
-       pip install --verbose .
+       pip install $(PIPOPTS) .
 
 uninstall_python_with_pip:
        # uninstall package
        pip uninstall -y -v aubio || make uninstall_python_with_distutils
 
 install_python_with_distutils:
-       ./setup.py install $(DISTUTILSOPTS)
+       ./setup.py install $(PIPOPTS) $(DISTUTILSOPTS)
 
 uninstall_python_with_distutils:
        #./setup.py uninstall
@@ -169,7 +166,7 @@ check_distclean:
        make distclean
 
 distcheck: checkwaf
-       $(WAFCMD) distcheck $(WAFOPTS) $(ENABLE_DOUBLE)
+       $(WAFCMD) distcheck $(WAFOPTS)
 
 help:
        $(WAFCMD) --help
@@ -232,9 +229,18 @@ test_python_only_clean: test_python_only \
        uninstall_python \
        check_clean_python
 
+sphinx: configure
+       $(WAFCMD) sphinx $(WAFOPTS)
+
+doxygen: configure
+       $(WAFCMD) doxygen $(WAFOPTS)
+
+manpages: configure
+       $(WAFCMD) manpages $(WAFOPTS)
+
+html: doxygen sphinx
 
-html:
-       cd doc && make html
+docs: html manpages
 
 dist: distclean expandwaf
        $(WAFCMD) dist