source: Makefile @ 3d14829

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5sampleryinfft+
Last change on this file since 3d14829 was 3d14829, checked in by Paul Brossier <piem@piem.org>, 8 years ago

python/lib/moresetuptools.py: also check for HAVE_AUBIO_DOUBLE

  • Property mode set to 100644
File size: 6.1 KB
Line 
1WAFCMD=python waf
2WAFURL=https://waf.io/waf-1.8.22
3
4#WAFOPTS:=
5# turn on verbose mode
6WAFOPTS += --verbose
7# build wafopts
8WAFOPTS += --destdir $(DESTDIR)
9# multiple jobs
10WAFOPTS += --jobs 4
11# if HAVE_AUBIO_DOUBLE is defined, pass --enable-double to waf
12# python/lib/moresetuptools.py also checks for HAVE_AUBIO_DOUBLE
13WAFOPTS += $(shell [ -z $(HAVE_AUBIO_DOUBLE) ] || echo --enable-double )
14
15DESTDIR:=$(PWD)/build/dist
16PYDESTDIR:=$(PWD)/build/pydist
17
18# default install locations
19PREFIX?=/usr/local
20EXEC_PREFIX?=$(PREFIX)
21LIBDIR?=$(PREFIX)/lib
22INCLUDEDIR?=$(PREFIX)/include
23DATAROOTDIR?=$(PREFIX)/share
24MANDIR?=$(DATAROOTDIR)/man
25
26SOX=sox
27
28TESTSOUNDS := python/tests/sounds
29
30all: build
31
32checkwaf:
33        @[ -f waf ] || make getwaf
34
35getwaf:
36        ./scripts/get_waf.sh
37
38expandwaf: 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
43        chmod +x waf
44
45cleanwaf:
46        rm -rf waf waflib .waf*
47
48configure: checkwaf
49        $(WAFCMD) configure $(WAFOPTS)
50
51build: configure
52        $(WAFCMD) build $(WAFOPTS)
53
54install:
55        # install
56        $(WAFCMD) install $(WAFOPTS)
57
58list_installed:
59        find $(DESTDIR) -ls | \
60                sed 's|$(DESTDIR)|/«destdir»|'
61
62list_installed_python:
63        ( find $(PYDESTDIR) -ls || make list_installed_python_package ) | \
64                sed 's|$(PYDESTDIR)|/«pydestdir»|'
65
66list_installed_python_package:
67        pip show -f aubio
68        PACKAGE_LOCATION=$(shell pip show -f aubio | grep ^Location | cut -d \  -f 2) \
69                make list_installed_python_package_content
70
71list_installed_python_package_content:
72        ( [ -d $(PACKAGE_LOCATION) ] && find $(PACKAGE_LOCATION) -ls ) || \
73                unzip -l $(PACKAGE_LOCATION)
74
75list_all_installed: list_installed list_installed_python
76
77uninstall:
78        # uninstall
79        $(WAFCMD) uninstall $(WAFOPTS)
80
81delete_install:
82        rm -rf $(PWD)/dist/test
83
84build_python:
85        # build python-aubio, using locally built libaubio if found
86        python ./setup.py build
87
88build_python_extlib:
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)" \
96                make build_python
97
98deps_python:
99        # install or upgrade python requirements
100        pip install --verbose --requirement requirements.txt
101
102# use pip or distutils?
103#install_python: install_python_with_pip
104uninstall_python: uninstall_python_with_pip
105install_python: install_python_with_distutils
106#uninstall_python: uninstall_python_with_distutils
107
108install_python_with_pip:
109        # install package
110        pip install --verbose .
111
112uninstall_python_with_pip:
113        # uninstall package
114        pip uninstall -y -v aubio || make uninstall_python_with_distutils
115
116install_python_with_distutils:
117        ./setup.py install $(DISTUTILSOPTS)
118
119uninstall_python_with_distutils:
120        #./setup.py uninstall
121        [ -d $(PYDESTDIR)/$(LIBDIR) ] && echo Warning: did not clean $(PYDESTDIR)/$(LIBDIR) || true
122
123force_uninstall_python:
124        # ignore failure if not installed
125        -make uninstall_python
126
127local_dylib:
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
131
132test_python: export LD_LIBRARY_PATH=$(DESTDIR)/$(LIBDIR)
133test_python: export PYTHONPATH=$(PYDESTDIR)/$(LIBDIR)
134test_python: local_dylib
135        # run test with installed package
136        ./python/tests/run_all_tests --verbose
137        # also run with nose, multiple processes
138        nose2 -N 4
139
140clean_python:
141        ./setup.py clean
142
143check_clean_python:
144        # check cleaning a second time works
145        make clean_python
146        make clean_python
147
148clean: checkwaf
149        # optionnaly clean before build
150        -$(WAFCMD) clean
151        # remove possible left overs
152        -rm -rf doc/_build
153
154check_clean:
155        # check cleaning after build works
156        $(WAFCMD) clean
157        # check cleaning a second time works
158        $(WAFCMD) clean
159
160distclean:
161        $(WAFCMD) distclean
162
163check_distclean:
164        make distclean
165
166distcheck: checkwaf
167        $(WAFCMD) distcheck $(WAFOPTS)
168
169help:
170        $(WAFCMD) --help
171
172create_test_sounds:
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
182
183# build only libaubio, no python-aubio
184test_lib_only: clean distclean configure build install list_installed
185# additionally, clean after a fresh build
186test_lib_only_clean: test_lib_only uninstall check_clean check_distclean
187
188# build libaubio, build and test python-aubio against it
189test_lib_python: force_uninstall_python deps_python \
190        clean_python clean distclean \
191        configure build build_python \
192        install install_python \
193        test_python \
194        list_all_installed
195
196test_lib_python_clean: test_lib_python \
197        uninstall_python uninstall \
198        check_clean_python \
199        check_clean \
200        check_distclean
201
202# build libaubio, install it, build python-aubio against it
203test_lib_install_python: force_uninstall_python deps_python \
204        clean_python distclean \
205        configure build \
206        install \
207        build_python_extlib \
208        install_python \
209        test_python \
210        list_all_installed
211
212test_lib_install_python_clean: test_lib_install_python \
213        uninstall_python \
214        delete_install \
215        check_clean_python \
216        check_distclean
217
218# build a python-aubio that includes libaubio
219test_python_only: force_uninstall_python deps_python \
220        clean_python clean distclean \
221        build_python \
222        install_python \
223        test_python \
224        list_installed_python
225
226test_python_only_clean: test_python_only \
227        uninstall_python \
228        check_clean_python
229
230
231html:
232        cd doc && make html
233
234dist: distclean expandwaf
235        $(WAFCMD) dist
Note: See TracBrowser for help on using the repository browser.