Makefile: chmod go-w waflib, clean cleaner
[aubio.git] / Makefile
index daedae9..8334c42 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,16 @@
+#!/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
+WAFURL=https://waf.io/waf-1.9.6
 
 #WAFOPTS:=
 # turn on verbose mode
@@ -8,6 +19,11 @@ 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
@@ -22,7 +38,6 @@ MANDIR?=$(DATAROOTDIR)/man
 
 SOX=sox
 
-ENABLE_DOUBLE := $(shell [ -z $(HAVE_DOUBLE) ] || echo --enable-double )
 TESTSOUNDS := python/tests/sounds
 
 all: build
@@ -38,13 +53,13 @@ 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 go-w -R waflib
 
 cleanwaf:
        rm -rf waf waflib .waf*
 
 configure: checkwaf
-       $(WAFCMD) configure $(WAFOPTS) $(ENABLE_DOUBLE)
+       $(WAFCMD) configure $(WAFOPTS)
 
 build: configure
        $(WAFCMD) build $(WAFOPTS)
@@ -54,21 +69,10 @@ install:
        $(WAFCMD) install $(WAFOPTS)
 
 list_installed:
-       find $(DESTDIR) -ls | \
-               sed 's|$(DESTDIR)|/«destdir»|'
+       find $(DESTDIR) -ls | sed 's|$(DESTDIR)|/«destdir»|'
 
 list_installed_python:
-       ( find $(PYDESTDIR) -ls || make list_installed_python_package ) | \
-               sed 's|$(PYDESTDIR)|/«pydestdir»|'
-
-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)
 
 list_all_installed: list_installed list_installed_python
 
@@ -81,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
@@ -95,24 +99,25 @@ 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
+       ( 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 $(DISTUTILSOPTS)
+       ./setup.py install $(PIPOPTS) $(DISTUTILSOPTS)
 
 uninstall_python_with_distutils:
        #./setup.py uninstall
@@ -157,12 +162,14 @@ check_clean:
 
 distclean:
        $(WAFCMD) distclean
+       -rm -rf doc/_build/
+       -rm -rf doc/web/
 
 check_distclean:
        make distclean
 
 distcheck: checkwaf
-       $(WAFCMD) distcheck $(WAFOPTS) $(ENABLE_DOUBLE)
+       $(WAFCMD) distcheck $(WAFOPTS)
 
 help:
        $(WAFCMD) --help
@@ -170,10 +177,10 @@ help:
 create_test_sounds:
        -[ -z `which $(SOX)` ] && ( echo $(SOX) could not be found) || true
        -mkdir -p $(TESTSOUNDS)
-       -$(SOX) -r 44100 -b 16 -n "$(TESTSOUNDS)/44100Hz_1f_silence.wav"          synth 1s   silence 0        dcshift .01
+       -$(SOX) -r 44100 -b 16 -n "$(TESTSOUNDS)/44100Hz_1f_silence.wav"      trim 0 1s
        -$(SOX) -r 22050 -b 16 -n "$(TESTSOUNDS)/22050Hz_5s_brownnoise.wav"   synth 5    brownnoise      vol 0.9
        -$(SOX) -r 32000 -b 16 -n "$(TESTSOUNDS)/32000Hz_127f_sine440.wav"    synth 127s sine 440        vol 0.9
-       -$(SOX) -r  8000 -b 16 -n "$(TESTSOUNDS)/8000Hz_30s_silence.wav"      synth 30   silence 0       vol 0.9
+       -$(SOX) -r  8000 -b 16 -n "$(TESTSOUNDS)/8000Hz_30s_silence.wav"      trim 0 30
        -$(SOX) -r 48000 -b 32 -n "$(TESTSOUNDS)/48000Hz_60s_sweep.wav"       synth 60   sine 100-20000  vol 0.9
        -$(SOX) -r 44100 -b 16 -n "$(TESTSOUNDS)/44100Hz_44100f_sine441.wav"  synth 44100s   sine 441   vol 0.9
        -$(SOX) -r 44100 -b 16 -n "$(TESTSOUNDS)/44100Hz_100f_sine441.wav"    synth 100s sine 441       vol 0.9
@@ -225,9 +232,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