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)
58 find $(DESTDIR) -ls | sed 's|$(DESTDIR)|/«destdir»|'
60 list_installed_python:
61 find $(PYDESTDIR) -ls | sed 's|$(PYDESTDIR)|/«pydestdir»|'
65 $(WAFCMD) uninstall $(WAFOPTS)
68 rm -rf $(PWD)/dist/test
71 # build python-aubio, using locally built libaubio if found
72 python ./setup.py build $(ENABLE_DOUBLE)
75 # build python-aubio using (locally) installed libaubio
76 [ -f $(DESTDIR)/$(INCLUDEDIR)/aubio/aubio.h ]
77 [ -d $(DESTDIR)/$(LIBDIR) ]
78 [ -f $(DESTDIR)/$(LIBDIR)/pkgconfig/aubio.pc ]
79 PKG_CONFIG_PATH=$(DESTDIR)/$(LIBDIR)/pkgconfig \
80 CFLAGS="-I$(DESTDIR)/$(INCLUDEDIR) $(CFLAGS)" \
81 LDFLAGS="-L$(DESTDIR)/$(LIBDIR) $(CFLAGS)" \
84 cat $(DESTDIR)/$(LIBDIR)/pkgconfig/aubio.pc
87 # install or upgrade python requirements
88 pip install --verbose --requirement requirements.txt
90 # use pip or distutils?
91 #install_python: install_python_with_pip
92 uninstall_python: uninstall_python_with_pip
93 install_python: install_python_with_distutils
94 #uninstall_python: uninstall_python_with_distutils
96 install_python_with_pip:
98 pip install --verbose .
100 uninstall_python_with_pip:
102 pip uninstall -y -v aubio || make uninstall_python_with_distutils
104 install_python_with_distutils:
105 ./setup.py install $(DISTUTILSOPTS)
107 uninstall_python_with_distutils:
108 #./setup.py uninstall
109 [ -d $(PYDESTDIR)/$(LIBDIR) ] && echo Warning: did not clean $(PYDESTDIR)/$(LIBDIR) || true
111 force_uninstall_python:
112 # ignore failure if not installed
113 -make uninstall_python
116 # DYLD_LIBRARY_PATH is no more on mac os
117 # create links from ~/lib/lib* to build/src/lib*
118 [ -f $(PWD)/build/src/libaubio.[0-9].dylib ] && ( mkdir -p ~/lib && cp -prv build/src/libaubio.[0-9].dylib ~/lib ) || true
120 test_python: export LD_LIBRARY_PATH=$(DESTDIR)/$(LIBDIR)
121 test_python: export PYTHONPATH=$(PYDESTDIR)/$(LIBDIR)
122 test_python: local_dylib
123 # run test with installed package
124 ./python/tests/run_all_tests --verbose
125 # also run with nose, multiple processes
127 # list installed files
128 #find $(DESTDIR) -ls | sed 's|$(DESTDIR)||'
129 make list_installed_python
135 # check cleaning a second time works
140 # optionnaly clean before build
144 # check cleaning after build works
146 # check cleaning a second time works
156 $(WAFCMD) distcheck $(WAFOPTS) $(ENABLE_DOUBLE)
162 -[ -z `which $(SOX)` ] && ( echo $(SOX) could not be found) || true
163 -mkdir -p $(TESTSOUNDS)
164 -$(SOX) -r 44100 -b 16 -n "$(TESTSOUNDS)/44100Hz_1f_silence.wav" synth 1s silence 0 dcshift .01
165 -$(SOX) -r 22050 -b 16 -n "$(TESTSOUNDS)/22050Hz_5s_brownnoise.wav" synth 5 brownnoise vol 0.9
166 -$(SOX) -r 32000 -b 16 -n "$(TESTSOUNDS)/32000Hz_127f_sine440.wav" synth 127s sine 440 vol 0.9
167 -$(SOX) -r 8000 -b 16 -n "$(TESTSOUNDS)/8000Hz_30s_silence.wav" synth 30 silence 0 vol 0.9
168 -$(SOX) -r 48000 -b 32 -n "$(TESTSOUNDS)/48000Hz_60s_sweep.wav" synth 60 sine 100-20000 vol 0.9
169 -$(SOX) -r 44100 -b 16 -n "$(TESTSOUNDS)/44100Hz_44100f_sine441.wav" synth 44100s sine 441 vol 0.9
170 -$(SOX) -r 44100 -b 16 -n "$(TESTSOUNDS)/44100Hz_100f_sine441.wav" synth 100s sine 441 vol 0.9
172 # build only libaubio, no python-aubio
173 test_lib_only: clean distclean configure build install
174 # additionally, clean after a fresh build
175 test_lib_only_clean: test_lib_only uninstall check_clean check_distclean
177 # build libaubio, build and test python-aubio against it
178 test_lib_python: force_uninstall_python deps_python \
179 clean_python clean distclean \
180 configure build build_python \
181 install install_python \
184 test_lib_python_clean: test_lib_python \
185 uninstall_python uninstall \
190 # build libaubio, install it, build python-aubio against it
191 test_lib_install_python: force_uninstall_python deps_python \
192 clean_python distclean \
195 build_python_extlib \
199 test_lib_install_python_clean: test_lib_install_python \
205 # build a python-aubio that includes libaubio
206 test_python_only: force_uninstall_python deps_python \
207 clean_python clean distclean \
212 test_python_only_clean: test_python_only \
220 dist: distclean expandwaf