setup.py: use custom build_ext instead of 'generate' command, define HAVE_AUBIO_DOUBL...
[aubio.git] / Makefile
index a3b9df4..07e6bcd 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,10 @@
 WAFCMD=python waf
+WAFURL=https://waf.io/waf-1.8.22
 
 SOX=sox
 
 ENABLE_DOUBLE := $(shell [ -z $(HAVE_DOUBLE) ] || echo --enable-double )
-TESTSOUNDS := "python/tests/sounds"
+TESTSOUNDS := python/tests/sounds
 
 all: build
 
@@ -11,8 +12,7 @@ checkwaf:
        @[ -f waf ] || make getwaf
 
 getwaf:
-       curl https://waf.io/waf-1.8.20 > waf
-       @chmod +x waf
+       @./scripts/get_waf.sh
 
 expandwaf:
        @[ -d wafilb ] || rm -fr waflib
@@ -28,42 +28,69 @@ build: configure
        $(WAFCMD) build $(WAFOPTS)
 
 build_python:
-       cd python && python ./setup.py generate $(ENABLE_DOUBLE) build
+       python ./setup.py build_ext $(ENABLE_DOUBLE)
 
+test_python: export LD_LIBRARY_PATH=$(PWD)/build/src
 test_python:
-       cd python && pip install -v .
-       LD_LIBRARY_PATH=$(PWD)/build/src python/tests/run_all_tests --verbose
-       cd python && pip uninstall -y -v aubio
+       pip install -v -r requirements.txt
+       pip install -v .
+       nose2 --verbose
+       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
-       ./python/tests/run_all_tests --verbose
-       cd python && pip uninstall -y -v aubio
+       # create links from ~/lib/lib* to build/src/lib*
+       [ -f build/src/libaubio.[0-9].dylib ] && ( mkdir -p ~/lib && cp -prv build/src/libaubio.[0-9].dylib ~/lib ) || true
+       # then run the tests
+       pip install --user -v -r requirements.txt
+       pip install --user -v .
+       nose2 --verbose
+       pip uninstall -y -v aubio
 
 clean_python:
-       cd python && ./setup.py clean
+       ./setup.py clean
+
+test_pure_python:
+       -pip uninstall -v -y aubio
+       -rm -rf build/ python/gen/
+       -rm -f dist/*.egg
+       -pip install -v -r requirements.txt
+       CFLAGS=-Os python setup.py bdist_egg
+       [ "$(TRAVIS_OS_NAME)" == "osx" ] && easy_install --user dist/*.egg || \
+               easy_install dist/*.egg
+       nose2 -N 4
+       pip uninstall -v -y aubio
+
+test_pure_python_wheel:
+       -pip uninstall -v -y aubio
+       -rm -rf build/ python/gen/
+       -rm -f dist/*.whl
+       -pip install -v -r requirements.txt
+       -pip install -v wheel
+       CFLAGS=-Os python setup.py bdist_wheel --universal
+       wheel install dist/*.whl
+       nose2 -N 4
+       pip uninstall -v -y aubio
 
 build_python3:
-       cd python && python3 ./setup.py generate $(ENABLE_DOUBLE) build
+       python3 ./setup.py build_ext $(ENABLE_DOUBLE)
 
 clean_python3:
-       cd python && python3 ./setup.py clean
+       python3 ./setup.py clean
 
 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; false ) || true
-       mkdir -p $(TESTSOUNDS)
-       $(SOX) -r 44100 -n $(TESTSOUNDS)/44100Hz_1f_silence.wav synth 1s silence 0
-       $(SOX) -r  8000 -n $(TESTSOUNDS)/8000Hz_30s_silence.wav synth 30 silence 0
-       $(SOX) -r 32000 -n $(TESTSOUNDS)/32000Hz_127f_sine440.wav synth 127 sine 440
-       $(SOX) -r 22050 -n $(TESTSOUNDS)/22050Hz_5s_brownnoise.wav synth 5 brownnoise
-       $(SOX) -r 48000 -n $(TESTSOUNDS)/48000Hz_60s_sweep.wav synth 60 sine 200-24000
+       -[ -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