5 WAFURL=https://waf.io/waf-1.8.22
11 WAFOPTS += --destdir $(DESTDIR)
14 # if HAVE_AUBIO_DOUBLE is defined, pass --enable-double to waf
15 # python/lib/moresetuptools.py also checks for HAVE_AUBIO_DOUBLE
16 WAFOPTS += $(shell [ -z $(HAVE_AUBIO_DOUBLE) ] || echo --enable-double )
20 DESTDIR:=$(PWD)/build/dist
21 PYDESTDIR:=$(PWD)/build/pydist
23 # default install locations
25 EXEC_PREFIX?=$(PREFIX)
27 INCLUDEDIR?=$(PREFIX)/include
28 DATAROOTDIR?=$(PREFIX)/share
29 MANDIR?=$(DATAROOTDIR)/man
33 TESTSOUNDS := python/tests/sounds
38 @[ -f waf ] || make getwaf
44 [ -d wafilb ] || rm -fr waflib
45 $(WAFCMD) --help > /dev/null
46 mv .waf*/waflib . && rm -fr .waf*
47 sed '/^#==>$$/,$$d' waf > waf2 && mv waf2 waf
51 rm -rf waf waflib .waf*
54 $(WAFCMD) configure $(WAFOPTS)
57 $(WAFCMD) build $(WAFOPTS)
61 $(WAFCMD) install $(WAFOPTS)
64 find $(DESTDIR) -ls | \
65 sed 's|$(DESTDIR)|/«destdir»|'
67 list_installed_python:
68 ( find $(PYDESTDIR) -ls || make list_installed_python_package ) | \
69 sed 's|$(PYDESTDIR)|/«pydestdir»|'
71 list_installed_python_package:
73 PACKAGE_LOCATION=$(shell pip show -f aubio | grep ^Location | cut -d \ -f 2) \
74 make list_installed_python_package_content
76 list_installed_python_package_content:
77 ( [ -d $(PACKAGE_LOCATION) ] && find $(PACKAGE_LOCATION) -ls ) || \
78 unzip -l $(PACKAGE_LOCATION)
80 list_all_installed: list_installed list_installed_python
84 $(WAFCMD) uninstall $(WAFOPTS)
87 rm -rf $(PWD)/dist/test
90 # build python-aubio, using locally built libaubio if found
91 python ./setup.py build
94 # build python-aubio using (locally) installed libaubio
95 [ -f $(DESTDIR)/$(INCLUDEDIR)/aubio/aubio.h ]
96 [ -d $(DESTDIR)/$(LIBDIR) ]
97 [ -f $(DESTDIR)/$(LIBDIR)/pkgconfig/aubio.pc ]
98 PKG_CONFIG_PATH=$(DESTDIR)/$(LIBDIR)/pkgconfig \
99 CFLAGS="-I$(DESTDIR)/$(INCLUDEDIR)" \
100 LDFLAGS="-L$(DESTDIR)/$(LIBDIR)" \
104 # install or upgrade python requirements
105 pip install $(PIPOPTS) --requirement requirements.txt
107 # use pip or distutils?
108 #install_python: install_python_with_pip
109 uninstall_python: uninstall_python_with_pip
110 install_python: install_python_with_distutils
111 #uninstall_python: uninstall_python_with_distutils
113 install_python_with_pip:
115 pip install $(PIPOPTS) .
117 uninstall_python_with_pip:
119 pip uninstall -y -v aubio || make uninstall_python_with_distutils
121 install_python_with_distutils:
122 ./setup.py install $(PIPOPTS) $(DISTUTILSOPTS)
124 uninstall_python_with_distutils:
125 #./setup.py uninstall
126 [ -d $(PYDESTDIR)/$(LIBDIR) ] && echo Warning: did not clean $(PYDESTDIR)/$(LIBDIR) || true
128 force_uninstall_python:
129 # ignore failure if not installed
130 -make uninstall_python
133 # DYLD_LIBRARY_PATH is no more on mac os
134 # create links from ~/lib/lib* to build/src/lib*
135 [ -f $(PWD)/build/src/libaubio.[0-9].dylib ] && ( mkdir -p ~/lib && cp -prv build/src/libaubio.[0-9].dylib ~/lib ) || true
137 test_python: export LD_LIBRARY_PATH=$(DESTDIR)/$(LIBDIR)
138 test_python: export PYTHONPATH=$(PYDESTDIR)/$(LIBDIR)
139 test_python: local_dylib
140 # run test with installed package
141 ./python/tests/run_all_tests --verbose
142 # also run with nose, multiple processes
149 # check cleaning a second time works
154 # optionnaly clean before build
156 # remove possible left overs
160 # check cleaning after build works
162 # check cleaning a second time works
172 $(WAFCMD) distcheck $(WAFOPTS)
178 -[ -z `which $(SOX)` ] && ( echo $(SOX) could not be found) || true
179 -mkdir -p $(TESTSOUNDS)
180 -$(SOX) -r 44100 -b 16 -n "$(TESTSOUNDS)/44100Hz_1f_silence.wav" synth 1s silence 0 dcshift .01
181 -$(SOX) -r 22050 -b 16 -n "$(TESTSOUNDS)/22050Hz_5s_brownnoise.wav" synth 5 brownnoise vol 0.9
182 -$(SOX) -r 32000 -b 16 -n "$(TESTSOUNDS)/32000Hz_127f_sine440.wav" synth 127s sine 440 vol 0.9
183 -$(SOX) -r 8000 -b 16 -n "$(TESTSOUNDS)/8000Hz_30s_silence.wav" synth 30 silence 0 vol 0.9
184 -$(SOX) -r 48000 -b 32 -n "$(TESTSOUNDS)/48000Hz_60s_sweep.wav" synth 60 sine 100-20000 vol 0.9
185 -$(SOX) -r 44100 -b 16 -n "$(TESTSOUNDS)/44100Hz_44100f_sine441.wav" synth 44100s sine 441 vol 0.9
186 -$(SOX) -r 44100 -b 16 -n "$(TESTSOUNDS)/44100Hz_100f_sine441.wav" synth 100s sine 441 vol 0.9
188 # build only libaubio, no python-aubio
189 test_lib_only: clean distclean configure build install list_installed
190 # additionally, clean after a fresh build
191 test_lib_only_clean: test_lib_only uninstall check_clean check_distclean
193 # build libaubio, build and test python-aubio against it
194 test_lib_python: force_uninstall_python deps_python \
195 clean_python clean distclean \
196 configure build build_python \
197 install install_python \
201 test_lib_python_clean: test_lib_python \
202 uninstall_python uninstall \
207 # build libaubio, install it, build python-aubio against it
208 test_lib_install_python: force_uninstall_python deps_python \
209 clean_python distclean \
212 build_python_extlib \
217 test_lib_install_python_clean: test_lib_install_python \
223 # build a python-aubio that includes libaubio
224 test_python_only: force_uninstall_python deps_python \
225 clean_python clean distclean \
229 list_installed_python
231 test_python_only_clean: test_python_only \
239 dist: distclean expandwaf