2 WAFURL=https://waf.io/waf-1.8.22
8 WAFOPTS += --destdir $(DESTDIR)
12 DESTDIR:=$(PWD)/build/dist
13 PYDESTDIR:=$(PWD)/build/pydist
15 # default install locations
17 EXEC_PREFIX?=$(PREFIX)
19 INCLUDEDIR?=$(PREFIX)/include
20 DATAROOTDIR?=$(PREFIX)/share
21 MANDIR?=$(DATAROOTDIR)/man
25 ENABLE_DOUBLE := $(shell [ -z $(HAVE_DOUBLE) ] || echo --enable-double )
26 TESTSOUNDS := python/tests/sounds
31 @[ -f waf ] || make getwaf
37 [ -d wafilb ] || rm -fr waflib
38 $(WAFCMD) --help > /dev/null
39 mv .waf*/waflib . && rm -fr .waf*
40 sed '/^#==>$$/,$$d' waf > waf2 && mv waf2 waf
44 rm -rf waf waflib .waf*
47 $(WAFCMD) configure $(WAFOPTS) $(ENABLE_DOUBLE)
50 $(WAFCMD) build $(WAFOPTS)
54 $(WAFCMD) install $(WAFOPTS)
57 find $(DESTDIR) -ls | \
58 sed 's|$(DESTDIR)|/«destdir»|'
60 list_installed_python:
61 ( find $(PYDESTDIR) -ls || make list_installed_python_package ) | \
62 sed 's|$(PYDESTDIR)|/«pydestdir»|'
64 list_installed_python_package:
66 PACKAGE_LOCATION=$(shell pip show -f aubio | grep ^Location | cut -d \ -f 2) \
67 make list_installed_python_package_content
69 list_installed_python_package_content:
70 ( [ -d $(PACKAGE_LOCATION) ] && find $(PACKAGE_LOCATION) -ls ) || \
71 unzip -l $(PACKAGE_LOCATION)
73 list_all_installed: list_installed list_installed_python
77 $(WAFCMD) uninstall $(WAFOPTS)
80 rm -rf $(PWD)/dist/test
83 # build python-aubio, using locally built libaubio if found
84 python ./setup.py build_ext $(ENABLE_DOUBLE)
87 # build python-aubio using (locally) installed libaubio
88 [ -f $(DESTDIR)/$(INCLUDEDIR)/aubio/aubio.h ]
89 [ -d $(DESTDIR)/$(LIBDIR) ]
90 [ -f $(DESTDIR)/$(LIBDIR)/pkgconfig/aubio.pc ]
91 PKG_CONFIG_PATH=$(DESTDIR)/$(LIBDIR)/pkgconfig \
92 CFLAGS="-I$(DESTDIR)/$(INCLUDEDIR)" \
93 LDFLAGS="-L$(DESTDIR)/$(LIBDIR)" \
97 # install or upgrade python requirements
98 pip install --verbose --requirement requirements.txt
100 # use pip or distutils?
101 #install_python: install_python_with_pip
102 uninstall_python: uninstall_python_with_pip
103 install_python: install_python_with_distutils
104 #uninstall_python: uninstall_python_with_distutils
106 install_python_with_pip:
108 pip install --verbose .
110 uninstall_python_with_pip:
112 pip uninstall -y -v aubio || make uninstall_python_with_distutils
114 install_python_with_distutils:
115 ./setup.py install $(DISTUTILSOPTS)
117 uninstall_python_with_distutils:
118 #./setup.py uninstall
119 [ -d $(PYDESTDIR)/$(LIBDIR) ] && echo Warning: did not clean $(PYDESTDIR)/$(LIBDIR) || true
121 force_uninstall_python:
122 # ignore failure if not installed
123 -make uninstall_python
126 # DYLD_LIBRARY_PATH is no more on mac os
127 # create links from ~/lib/lib* to build/src/lib*
128 [ -f $(PWD)/build/src/libaubio.[0-9].dylib ] && ( mkdir -p ~/lib && cp -prv build/src/libaubio.[0-9].dylib ~/lib ) || true
130 test_python: export LD_LIBRARY_PATH=$(DESTDIR)/$(LIBDIR)
131 test_python: export PYTHONPATH=$(PYDESTDIR)/$(LIBDIR)
132 test_python: local_dylib
133 # run test with installed package
134 ./python/tests/run_all_tests --verbose
135 # also run with nose, multiple processes
142 # check cleaning a second time works
147 # optionnaly clean before build
149 # remove possible left overs
153 # check cleaning after build works
155 # check cleaning a second time works
165 $(WAFCMD) distcheck $(WAFOPTS) $(ENABLE_DOUBLE)
171 -[ -z `which $(SOX)` ] && ( echo $(SOX) could not be found) || true
172 -mkdir -p $(TESTSOUNDS)
173 -$(SOX) -r 44100 -b 16 -n "$(TESTSOUNDS)/44100Hz_1f_silence.wav" synth 1s silence 0 dcshift .01
174 -$(SOX) -r 22050 -b 16 -n "$(TESTSOUNDS)/22050Hz_5s_brownnoise.wav" synth 5 brownnoise vol 0.9
175 -$(SOX) -r 32000 -b 16 -n "$(TESTSOUNDS)/32000Hz_127f_sine440.wav" synth 127s sine 440 vol 0.9
176 -$(SOX) -r 8000 -b 16 -n "$(TESTSOUNDS)/8000Hz_30s_silence.wav" synth 30 silence 0 vol 0.9
177 -$(SOX) -r 48000 -b 32 -n "$(TESTSOUNDS)/48000Hz_60s_sweep.wav" synth 60 sine 100-20000 vol 0.9
178 -$(SOX) -r 44100 -b 16 -n "$(TESTSOUNDS)/44100Hz_44100f_sine441.wav" synth 44100s sine 441 vol 0.9
179 -$(SOX) -r 44100 -b 16 -n "$(TESTSOUNDS)/44100Hz_100f_sine441.wav" synth 100s sine 441 vol 0.9
181 # build only libaubio, no python-aubio
182 test_lib_only: clean distclean configure build install list_installed
183 # additionally, clean after a fresh build
184 test_lib_only_clean: test_lib_only uninstall check_clean check_distclean
186 # build libaubio, build and test python-aubio against it
187 test_lib_python: force_uninstall_python deps_python \
188 clean_python clean distclean \
189 configure build build_python \
190 install install_python \
194 test_lib_python_clean: test_lib_python \
195 uninstall_python uninstall \
200 # build libaubio, install it, build python-aubio against it
201 test_lib_install_python: force_uninstall_python deps_python \
202 clean_python distclean \
205 build_python_extlib \
210 test_lib_install_python_clean: test_lib_install_python \
216 # build a python-aubio that includes libaubio
217 test_python_only: force_uninstall_python deps_python \
218 clean_python clean distclean \
222 list_installed_python
224 test_python_only_clean: test_python_only \
232 dist: distclean expandwaf