Makefile: pass options to waf distcheck
[aubio.git] / Makefile
index 779a0d5..939c7c1 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,11 +1,17 @@
 WAFCMD=python waf
+
+SOX=sox
+
+ENABLE_DOUBLE := $(shell [ -z $(HAVE_DOUBLE) ] || echo --enable-double )
+TESTSOUNDS := python/tests/sounds
+
 all: build
 
 checkwaf:
        @[ -f waf ] || make getwaf
 
 getwaf:
-       curl https://waf.io/waf-1.8.14 > waf
+       curl https://waf.io/waf-1.8.20 > waf
        @chmod +x waf
 
 expandwaf:
@@ -16,22 +22,30 @@ expandwaf:
        @chmod +x waf
 
 configure: checkwaf
-       $(WAFCMD) configure
+       $(WAFCMD) configure $(WAFOPTS) $(ENABLE_DOUBLE)
 
 build: configure
-       $(WAFCMD) build
+       $(WAFCMD) build $(WAFOPTS)
 
 build_python:
-       cd python && ./setup.py build
+       cd python && python ./setup.py generate $(ENABLE_DOUBLE) build
 
 test_python:
-       cd python && ./setup.py install && ./tests/run_all_tests
+       cd python && pip install -v .
+       cd python && LD_LIBRARY_PATH=$(PWD)/build/src nose2 --verbose
+       cd python && pip uninstall -y -v aubio
+
+test_python_osx:
+       cd python && pip install --user -v .
+       [ -f build/src/libaubio.[0-9].dylib ] && ( mkdir -p ~/lib && cp -prv build/src/libaubio.4.dylib ~/lib ) || true
+       cd python && nose2 --verbose
+       cd python && pip uninstall -y -v aubio
 
 clean_python:
        cd python && ./setup.py clean
 
 build_python3:
-       cd python && python3 ./setup.py build
+       cd python && python3 ./setup.py generate $(ENABLE_DOUBLE) build
 
 clean_python3:
        cd python && python3 ./setup.py clean
@@ -40,7 +54,16 @@ clean:
        $(WAFCMD) clean
 
 distcheck: checkwaf
-       $(WAFCMD) distcheck
+       $(WAFCMD) distcheck $(WAFOPTS) $(ENABLE_DOUBLE)
 
 help:
        $(WAFCMD) --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
+       -$(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 48000 -b 32 -n "$(TESTSOUNDS)/48000Hz_60s_sweep.wav"       synth 60   sine 100-20000  vol 0.9