source: Makefile @ bee6e96

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

Makefile: remove tar commands for now

  • Property mode set to 100644
File size: 6.0 KB
RevLine 
[81ad577]1WAFCMD=python waf
[7f35041]2WAFURL=https://waf.io/waf-1.8.22
[6a6cb48]3
[5d9693c]4#WAFOPTS:=
5# turn on verbose mode
[1b2669a]6WAFOPTS += --verbose
[5d9693c]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
[be06e53]23SOX=sox
24
[6a6cb48]25ENABLE_DOUBLE := $(shell [ -z $(HAVE_DOUBLE) ] || echo --enable-double )
[ceb884d]26TESTSOUNDS := python/tests/sounds
[6a6cb48]27
[8e94af5]28all: build
29
30checkwaf:
31        @[ -f waf ] || make getwaf
32
33getwaf:
[bab8e3d]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*
[8e94af5]45
[e372a0f]46configure: checkwaf
[6a6cb48]47        $(WAFCMD) configure $(WAFOPTS) $(ENABLE_DOUBLE)
[e372a0f]48
49build: configure
[3fc5696]50        $(WAFCMD) build $(WAFOPTS)
[8e94af5]51
[5d9693c]52install:
53        # install
54        $(WAFCMD) install $(WAFOPTS)
[972a326]55
[5d9693c]56list_installed:
[1b2669a]57        find $(DESTDIR) -ls | \
58                sed 's|$(DESTDIR)|/«destdir»|'
[5d9693c]59
60list_installed_python:
[1b2669a]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
[5d9693c]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
[1b2669a]84        python ./setup.py build_ext $(ENABLE_DOUBLE)
[5d9693c]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 \
[1b2669a]92        CFLAGS="-I$(DESTDIR)/$(INCLUDEDIR)" \
93        LDFLAGS="-L$(DESTDIR)/$(LIBDIR)" \
[5d9693c]94                make build_python
95
96deps_python:
97        # install or upgrade python requirements
[fe957ad]98        pip install --verbose --requirement requirements.txt
[5d9693c]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:
[e56ac16]107        # install package
[5d9693c]108        pip install --verbose .
109
110uninstall_python_with_pip:
[e56ac16]111        # uninstall package
[5d9693c]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
[39122f0]124
[e56ac16]125local_dylib:
[5d9693c]126        # DYLD_LIBRARY_PATH is no more on mac os
[1167631]127        # create links from ~/lib/lib* to build/src/lib*
[5d9693c]128        [ -f $(PWD)/build/src/libaubio.[0-9].dylib ] && ( mkdir -p ~/lib && cp -prv build/src/libaubio.[0-9].dylib ~/lib ) || true
[e56ac16]129
[5d9693c]130test_python: export LD_LIBRARY_PATH=$(DESTDIR)/$(LIBDIR)
131test_python: export PYTHONPATH=$(PYDESTDIR)/$(LIBDIR)
132test_python: local_dylib
[e56ac16]133        # run test with installed package
134        ./python/tests/run_all_tests --verbose
[5d9693c]135        # also run with nose, multiple processes
[f465088]136        nose2 -N 4
137
[5d9693c]138clean_python:
139        ./setup.py clean
[a2ae70a]140
[5d9693c]141check_clean_python:
142        # check cleaning a second time works
143        make clean_python
144        make clean_python
[a2ae70a]145
[0799252]146clean: checkwaf
[5d9693c]147        # optionnaly clean before build
148        -$(WAFCMD) clean
[1b2669a]149        # remove possible left overs
150        -rm -rf doc/_build
[5d9693c]151
152check_clean:
153        # check cleaning after build works
154        $(WAFCMD) clean
155        # check cleaning a second time works
[81ad577]156        $(WAFCMD) clean
[ddd9861]157
[5864b43]158distclean:
159        $(WAFCMD) distclean
160
[5d9693c]161check_distclean:
162        make distclean
163
[e372a0f]164distcheck: checkwaf
[7aed123]165        $(WAFCMD) distcheck $(WAFOPTS) $(ENABLE_DOUBLE)
[8e94af5]166
167help:
[81ad577]168        $(WAFCMD) --help
[be06e53]169
170create_test_sounds:
[3a7b7c6]171        -[ -z `which $(SOX)` ] && ( echo $(SOX) could not be found) || true
172        -mkdir -p $(TESTSOUNDS)
[9e36acd]173        -$(SOX) -r 44100 -b 16 -n "$(TESTSOUNDS)/44100Hz_1f_silence.wav"          synth 1s   silence 0        dcshift .01
[ceb884d]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
[9e36acd]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
[e48b072]180
[5d9693c]181# build only libaubio, no python-aubio
[1b2669a]182test_lib_only: clean distclean configure build install list_installed
[5d9693c]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 \
[1b2669a]191        test_python \
192        list_all_installed
[5d9693c]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 \
[1b2669a]207        test_python \
208        list_all_installed
[5d9693c]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 \
[1b2669a]221        test_python \
222        list_installed_python
[5d9693c]223
224test_python_only_clean: test_python_only \
225        uninstall_python \
226        check_clean_python
227
228
[e48b072]229html:
230        cd doc && make html
231
232dist: distclean expandwaf
233        $(WAFCMD) dist
Note: See TracBrowser for help on using the repository browser.