source: Makefile @ bee6e96

feature/autosinkfeature/constantqfeature/pitchshiftfeature/pydocstringsfeature/timestretchsampleryinfft+
Last change on this file since bee6e96 was bee6e96, checked in by Paul Brossier <piem@piem.org>, 3 years ago

Makefile: remove tar commands for now

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