1 | WAFCMD=python waf |
---|
2 | WAFURL=https://waf.io/waf-1.9.1 |
---|
3 | |
---|
4 | SOX=sox |
---|
5 | |
---|
6 | ENABLE_DOUBLE := $(shell [ -z $(HAVE_DOUBLE) ] || echo --enable-double ) |
---|
7 | TESTSOUNDS := python/tests/sounds |
---|
8 | |
---|
9 | all: build |
---|
10 | |
---|
11 | checkwaf: |
---|
12 | @[ -f waf ] || make getwaf |
---|
13 | |
---|
14 | getwaf: |
---|
15 | @( which wget > /dev/null && wget -qO waf $(WAFURL) ) || ( which curl > /dev/null && curl $(WAFURL) > waf ) |
---|
16 | @chmod +x waf |
---|
17 | |
---|
18 | expandwaf: |
---|
19 | @[ -d wafilb ] || rm -fr waflib |
---|
20 | @$(WAFCMD) --help > /dev/null |
---|
21 | @mv .waf*/waflib . && rm -fr .waf* |
---|
22 | @sed '/^#==>$$/,$$d' waf > waf2 && mv waf2 waf |
---|
23 | @chmod +x waf |
---|
24 | |
---|
25 | configure: checkwaf |
---|
26 | $(WAFCMD) configure $(WAFOPTS) $(ENABLE_DOUBLE) |
---|
27 | |
---|
28 | build: configure |
---|
29 | $(WAFCMD) build $(WAFOPTS) |
---|
30 | |
---|
31 | build_python: |
---|
32 | python ./setup.py generate $(ENABLE_DOUBLE) build |
---|
33 | |
---|
34 | test_python: export LD_LIBRARY_PATH=$(PWD)/build/src |
---|
35 | test_python: |
---|
36 | pip install -v -r requirements.txt |
---|
37 | pip install -v . |
---|
38 | nose2 --verbose |
---|
39 | pip uninstall -y -v aubio |
---|
40 | |
---|
41 | test_python_osx: |
---|
42 | # create links from ~/lib/lib* to build/src/lib* |
---|
43 | [ -f build/src/libaubio.[0-9].dylib ] && ( mkdir -p ~/lib && cp -prv build/src/libaubio.4.dylib ~/lib ) || true |
---|
44 | # then run the tests |
---|
45 | pip install --user -v -r requirements.txt |
---|
46 | pip install --user -v . |
---|
47 | nose2 --verbose |
---|
48 | pip uninstall -y -v aubio |
---|
49 | |
---|
50 | clean_python: |
---|
51 | ./setup.py clean |
---|
52 | |
---|
53 | test_pure_python: |
---|
54 | -pip uninstall -v -y aubio |
---|
55 | -rm -rf build/ python/gen/ |
---|
56 | -rm -f dist/*.egg |
---|
57 | -pip install -v -r requirements.txt |
---|
58 | CFLAGS=-Os python setup.py bdist_egg |
---|
59 | [ "$(TRAVIS_OS_NAME)" == "osx" ] && easy_install --user dist/*.egg || \ |
---|
60 | easy_install dist/*.egg |
---|
61 | nose2 -N 4 |
---|
62 | pip uninstall -v -y aubio |
---|
63 | |
---|
64 | test_pure_python_wheel: |
---|
65 | -pip uninstall -v -y aubio |
---|
66 | -rm -rf build/ python/gen/ |
---|
67 | -rm -f dist/*.whl |
---|
68 | -pip install -v -r requirements.txt |
---|
69 | -pip install -v wheel |
---|
70 | CFLAGS=-Os python setup.py bdist_wheel --universal |
---|
71 | wheel install dist/*.whl |
---|
72 | nose2 -N 4 |
---|
73 | pip uninstall -v -y aubio |
---|
74 | |
---|
75 | build_python3: |
---|
76 | python3 ./setup.py generate $(ENABLE_DOUBLE) build |
---|
77 | |
---|
78 | clean_python3: |
---|
79 | python3 ./setup.py clean |
---|
80 | |
---|
81 | clean: |
---|
82 | $(WAFCMD) clean |
---|
83 | |
---|
84 | distcheck: checkwaf |
---|
85 | $(WAFCMD) distcheck $(WAFOPTS) $(ENABLE_DOUBLE) |
---|
86 | |
---|
87 | help: |
---|
88 | $(WAFCMD) --help |
---|
89 | |
---|
90 | create_test_sounds: |
---|
91 | -[ -z `which $(SOX)` ] && ( echo $(SOX) could not be found) || true |
---|
92 | -mkdir -p $(TESTSOUNDS) |
---|
93 | -$(SOX) -r 44100 -b 16 -n "$(TESTSOUNDS)/44100Hz_1f_silence.wav" synth 1s silence 0 |
---|
94 | -$(SOX) -r 22050 -b 16 -n "$(TESTSOUNDS)/22050Hz_5s_brownnoise.wav" synth 5 brownnoise vol 0.9 |
---|
95 | -$(SOX) -r 32000 -b 16 -n "$(TESTSOUNDS)/32000Hz_127f_sine440.wav" synth 127s sine 440 vol 0.9 |
---|
96 | -$(SOX) -r 8000 -b 16 -n "$(TESTSOUNDS)/8000Hz_30s_silence.wav" synth 30 silence 0 vol 0.9 |
---|
97 | -$(SOX) -r 48000 -b 32 -n "$(TESTSOUNDS)/48000Hz_60s_sweep.wav" synth 60 sine 100-20000 vol 0.9 |
---|