2 WAFURL=https://waf.io/waf-1.8.22
8 WAFOPTS += --destdir $(DESTDIR)
11 # if HAVE_AUBIO_DOUBLE is defined, pass --enable-double to waf
12 # python/lib/moresetuptools.py also checks for HAVE_AUBIO_DOUBLE
13 WAFOPTS += $(shell [ -z $(HAVE_AUBIO_DOUBLE) ] || echo --enable-double )
15 DESTDIR:=$(PWD)/build/dist
16 PYDESTDIR:=$(PWD)/build/pydist
18 # default install locations
20 EXEC_PREFIX?=$(PREFIX)
22 INCLUDEDIR?=$(PREFIX)/include
23 DATAROOTDIR?=$(PREFIX)/share
24 MANDIR?=$(DATAROOTDIR)/man
28 TESTSOUNDS := python/tests/sounds
33 @[ -f waf ] || make getwaf
39 [ -d wafilb ] || rm -fr waflib
40 $(WAFCMD) --help > /dev/null
41 mv .waf*/waflib . && rm -fr .waf*
42 sed '/^#==>$$/,$$d' waf > waf2 && mv waf2 waf
46 rm -rf waf waflib .waf*
49 $(WAFCMD) configure $(WAFOPTS)
52 $(WAFCMD) build $(WAFOPTS)
56 $(WAFCMD) install $(WAFOPTS)
59 find $(DESTDIR) -ls | \
60 sed 's|$(DESTDIR)|/«destdir»|'
62 list_installed_python:
63 ( find $(PYDESTDIR) -ls || make list_installed_python_package ) | \
64 sed 's|$(PYDESTDIR)|/«pydestdir»|'
66 list_installed_python_package:
68 PACKAGE_LOCATION=$(shell pip show -f aubio | grep ^Location | cut -d \ -f 2) \
69 make list_installed_python_package_content
71 list_installed_python_package_content:
72 ( [ -d $(PACKAGE_LOCATION) ] && find $(PACKAGE_LOCATION) -ls ) || \
73 unzip -l $(PACKAGE_LOCATION)
75 list_all_installed: list_installed list_installed_python
79 $(WAFCMD) uninstall $(WAFOPTS)
82 rm -rf $(PWD)/dist/test
85 # build python-aubio, using locally built libaubio if found
86 python ./setup.py build
89 # build python-aubio using (locally) installed libaubio
90 [ -f $(DESTDIR)/$(INCLUDEDIR)/aubio/aubio.h ]
91 [ -d $(DESTDIR)/$(LIBDIR) ]
92 [ -f $(DESTDIR)/$(LIBDIR)/pkgconfig/aubio.pc ]
93 PKG_CONFIG_PATH=$(DESTDIR)/$(LIBDIR)/pkgconfig \
94 CFLAGS="-I$(DESTDIR)/$(INCLUDEDIR)" \
95 LDFLAGS="-L$(DESTDIR)/$(LIBDIR)" \
99 # install or upgrade python requirements
100 pip install --verbose --requirement requirements.txt
102 # use pip or distutils?
103 #install_python: install_python_with_pip
104 uninstall_python: uninstall_python_with_pip
105 install_python: install_python_with_distutils
106 #uninstall_python: uninstall_python_with_distutils
108 install_python_with_pip:
110 pip install --verbose .
112 uninstall_python_with_pip:
114 pip uninstall -y -v aubio || make uninstall_python_with_distutils
116 install_python_with_distutils:
117 ./setup.py install $(DISTUTILSOPTS)
119 uninstall_python_with_distutils:
120 #./setup.py uninstall
121 [ -d $(PYDESTDIR)/$(LIBDIR) ] && echo Warning: did not clean $(PYDESTDIR)/$(LIBDIR) || true
123 force_uninstall_python:
124 # ignore failure if not installed
125 -make uninstall_python
128 # DYLD_LIBRARY_PATH is no more on mac os
129 # create links from ~/lib/lib* to build/src/lib*
130 [ -f $(PWD)/build/src/libaubio.[0-9].dylib ] && ( mkdir -p ~/lib && cp -prv build/src/libaubio.[0-9].dylib ~/lib ) || true
132 test_python: export LD_LIBRARY_PATH=$(DESTDIR)/$(LIBDIR)
133 test_python: export PYTHONPATH=$(PYDESTDIR)/$(LIBDIR)
134 test_python: local_dylib
135 # run test with installed package
136 ./python/tests/run_all_tests --verbose
137 # also run with nose, multiple processes
144 # check cleaning a second time works
149 # optionnaly clean before build
151 # remove possible left overs
155 # check cleaning after build works
157 # check cleaning a second time works
167 $(WAFCMD) distcheck $(WAFOPTS)
173 -[ -z `which $(SOX)` ] && ( echo $(SOX) could not be found) || true
174 -mkdir -p $(TESTSOUNDS)
175 -$(SOX) -r 44100 -b 16 -n "$(TESTSOUNDS)/44100Hz_1f_silence.wav" synth 1s silence 0 dcshift .01
176 -$(SOX) -r 22050 -b 16 -n "$(TESTSOUNDS)/22050Hz_5s_brownnoise.wav" synth 5 brownnoise vol 0.9
177 -$(SOX) -r 32000 -b 16 -n "$(TESTSOUNDS)/32000Hz_127f_sine440.wav" synth 127s sine 440 vol 0.9
178 -$(SOX) -r 8000 -b 16 -n "$(TESTSOUNDS)/8000Hz_30s_silence.wav" synth 30 silence 0 vol 0.9
179 -$(SOX) -r 48000 -b 32 -n "$(TESTSOUNDS)/48000Hz_60s_sweep.wav" synth 60 sine 100-20000 vol 0.9
180 -$(SOX) -r 44100 -b 16 -n "$(TESTSOUNDS)/44100Hz_44100f_sine441.wav" synth 44100s sine 441 vol 0.9
181 -$(SOX) -r 44100 -b 16 -n "$(TESTSOUNDS)/44100Hz_100f_sine441.wav" synth 100s sine 441 vol 0.9
183 # build only libaubio, no python-aubio
184 test_lib_only: clean distclean configure build install list_installed
185 # additionally, clean after a fresh build
186 test_lib_only_clean: test_lib_only uninstall check_clean check_distclean
188 # build libaubio, build and test python-aubio against it
189 test_lib_python: force_uninstall_python deps_python \
190 clean_python clean distclean \
191 configure build build_python \
192 install install_python \
196 test_lib_python_clean: test_lib_python \
197 uninstall_python uninstall \
202 # build libaubio, install it, build python-aubio against it
203 test_lib_install_python: force_uninstall_python deps_python \
204 clean_python distclean \
207 build_python_extlib \
212 test_lib_install_python_clean: test_lib_install_python \
218 # build a python-aubio that includes libaubio
219 test_python_only: force_uninstall_python deps_python \
220 clean_python clean distclean \
224 list_installed_python
226 test_python_only_clean: test_python_only \
234 dist: distclean expandwaf