source: Makefile @ e57a7d4

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

Makefile: bump waf to 1.9.6

  • Property mode set to 100644
File size: 6.1 KB
RevLine 
[c0c3f33]1#!/usr/bin/make -f
2# -*- makefile -*-
[4e56c55]3#
4# This makefile contains simple rules to prepare, compile, test, and install
5# aubio. Try one of the following rules:
6#
7# $ make configure
8# $ make build
9# $ make install
10# $ make test_python
[c0c3f33]11
[81ad577]12WAFCMD=python waf
[762f05a]13WAFURL=https://waf.io/waf-1.9.6
[6a6cb48]14
[5d9693c]15#WAFOPTS:=
16# turn on verbose mode
[1b2669a]17WAFOPTS += --verbose
[5d9693c]18# build wafopts
19WAFOPTS += --destdir $(DESTDIR)
20# multiple jobs
21WAFOPTS += --jobs 4
[3d14829]22# if HAVE_AUBIO_DOUBLE is defined, pass --enable-double to waf
23# python/lib/moresetuptools.py also checks for HAVE_AUBIO_DOUBLE
24WAFOPTS += $(shell [ -z $(HAVE_AUBIO_DOUBLE) ] || echo --enable-double )
[5d9693c]25
[c0c3f33]26PIPOPTS += --verbose
27
[5d9693c]28DESTDIR:=$(PWD)/build/dist
29PYDESTDIR:=$(PWD)/build/pydist
30
31# default install locations
32PREFIX?=/usr/local
33EXEC_PREFIX?=$(PREFIX)
34LIBDIR?=$(PREFIX)/lib
35INCLUDEDIR?=$(PREFIX)/include
36DATAROOTDIR?=$(PREFIX)/share
37MANDIR?=$(DATAROOTDIR)/man
38
[be06e53]39SOX=sox
40
[ceb884d]41TESTSOUNDS := python/tests/sounds
[6a6cb48]42
[8e94af5]43all: build
44
45checkwaf:
46        @[ -f waf ] || make getwaf
47
48getwaf:
[bab8e3d]49        ./scripts/get_waf.sh
50
51expandwaf: getwaf
52        [ -d wafilb ] || rm -fr waflib
53        $(WAFCMD) --help > /dev/null
54        mv .waf*/waflib . && rm -fr .waf*
55        sed '/^#==>$$/,$$d' waf > waf2 && mv waf2 waf
56        chmod +x waf
57
58cleanwaf:
59        rm -rf waf waflib .waf*
[8e94af5]60
[e372a0f]61configure: checkwaf
[3d14829]62        $(WAFCMD) configure $(WAFOPTS)
[e372a0f]63
64build: configure
[3fc5696]65        $(WAFCMD) build $(WAFOPTS)
[8e94af5]66
[5d9693c]67install:
68        # install
69        $(WAFCMD) install $(WAFOPTS)
[972a326]70
[5d9693c]71list_installed:
[f1fc216]72        find $(DESTDIR) -ls | sed 's|$(DESTDIR)|/«destdir»|'
[5d9693c]73
74list_installed_python:
[1b2669a]75        pip show -f aubio
76
77list_all_installed: list_installed list_installed_python
[5d9693c]78
79uninstall:
80        # uninstall
81        $(WAFCMD) uninstall $(WAFOPTS)
82
83delete_install:
84        rm -rf $(PWD)/dist/test
85
86build_python:
87        # build python-aubio, using locally built libaubio if found
[3d14829]88        python ./setup.py build
[5d9693c]89
90build_python_extlib:
91        # build python-aubio using (locally) installed libaubio
92        [ -f $(DESTDIR)/$(INCLUDEDIR)/aubio/aubio.h ]
93        [ -d $(DESTDIR)/$(LIBDIR) ]
94        [ -f $(DESTDIR)/$(LIBDIR)/pkgconfig/aubio.pc ]
95        PKG_CONFIG_PATH=$(DESTDIR)/$(LIBDIR)/pkgconfig \
[1b2669a]96        CFLAGS="-I$(DESTDIR)/$(INCLUDEDIR)" \
97        LDFLAGS="-L$(DESTDIR)/$(LIBDIR)" \
[5d9693c]98                make build_python
99
100deps_python:
101        # install or upgrade python requirements
[c0c3f33]102        pip install $(PIPOPTS) --requirement requirements.txt
[5d9693c]103
104# use pip or distutils?
[4e56c55]105install_python: install_python_with_pip
[5d9693c]106uninstall_python: uninstall_python_with_pip
[4e56c55]107#install_python: install_python_with_distutils
[5d9693c]108#uninstall_python: uninstall_python_with_distutils
109
110install_python_with_pip:
[e56ac16]111        # install package
[c0c3f33]112        pip install $(PIPOPTS) .
[5d9693c]113
114uninstall_python_with_pip:
[e56ac16]115        # uninstall package
[3762cdb]116        ( pip show aubio | grep -l aubio > /dev/null ) && \
117        pip uninstall -y -v aubio || echo "info: aubio package is not installed"
[5d9693c]118
119install_python_with_distutils:
[c0c3f33]120        ./setup.py install $(PIPOPTS) $(DISTUTILSOPTS)
[5d9693c]121
122uninstall_python_with_distutils:
123        #./setup.py uninstall
124        [ -d $(PYDESTDIR)/$(LIBDIR) ] && echo Warning: did not clean $(PYDESTDIR)/$(LIBDIR) || true
125
126force_uninstall_python:
127        # ignore failure if not installed
128        -make uninstall_python
[39122f0]129
[e56ac16]130local_dylib:
[5d9693c]131        # DYLD_LIBRARY_PATH is no more on mac os
[1167631]132        # create links from ~/lib/lib* to build/src/lib*
[5d9693c]133        [ -f $(PWD)/build/src/libaubio.[0-9].dylib ] && ( mkdir -p ~/lib && cp -prv build/src/libaubio.[0-9].dylib ~/lib ) || true
[e56ac16]134
[5d9693c]135test_python: export LD_LIBRARY_PATH=$(DESTDIR)/$(LIBDIR)
136test_python: export PYTHONPATH=$(PYDESTDIR)/$(LIBDIR)
137test_python: local_dylib
[e56ac16]138        # run test with installed package
139        ./python/tests/run_all_tests --verbose
[5d9693c]140        # also run with nose, multiple processes
[f465088]141        nose2 -N 4
142
[5d9693c]143clean_python:
144        ./setup.py clean
[a2ae70a]145
[5d9693c]146check_clean_python:
147        # check cleaning a second time works
148        make clean_python
149        make clean_python
[a2ae70a]150
[0799252]151clean: checkwaf
[5d9693c]152        # optionnaly clean before build
153        -$(WAFCMD) clean
[1b2669a]154        # remove possible left overs
155        -rm -rf doc/_build
[5d9693c]156
157check_clean:
158        # check cleaning after build works
159        $(WAFCMD) clean
160        # check cleaning a second time works
[81ad577]161        $(WAFCMD) clean
[ddd9861]162
[5864b43]163distclean:
164        $(WAFCMD) distclean
165
[5d9693c]166check_distclean:
167        make distclean
168
[e372a0f]169distcheck: checkwaf
[3d14829]170        $(WAFCMD) distcheck $(WAFOPTS)
[8e94af5]171
172help:
[81ad577]173        $(WAFCMD) --help
[be06e53]174
175create_test_sounds:
[3a7b7c6]176        -[ -z `which $(SOX)` ] && ( echo $(SOX) could not be found) || true
177        -mkdir -p $(TESTSOUNDS)
[90581a8]178        -$(SOX) -r 44100 -b 16 -n "$(TESTSOUNDS)/44100Hz_1f_silence.wav"      trim 0 1s
[ceb884d]179        -$(SOX) -r 22050 -b 16 -n "$(TESTSOUNDS)/22050Hz_5s_brownnoise.wav"   synth 5    brownnoise      vol 0.9
180        -$(SOX) -r 32000 -b 16 -n "$(TESTSOUNDS)/32000Hz_127f_sine440.wav"    synth 127s sine 440        vol 0.9
[90581a8]181        -$(SOX) -r  8000 -b 16 -n "$(TESTSOUNDS)/8000Hz_30s_silence.wav"      trim 0 30
[ceb884d]182        -$(SOX) -r 48000 -b 32 -n "$(TESTSOUNDS)/48000Hz_60s_sweep.wav"       synth 60   sine 100-20000  vol 0.9
[9e36acd]183        -$(SOX) -r 44100 -b 16 -n "$(TESTSOUNDS)/44100Hz_44100f_sine441.wav"  synth 44100s   sine 441   vol 0.9
184        -$(SOX) -r 44100 -b 16 -n "$(TESTSOUNDS)/44100Hz_100f_sine441.wav"    synth 100s sine 441       vol 0.9
[e48b072]185
[5d9693c]186# build only libaubio, no python-aubio
[1b2669a]187test_lib_only: clean distclean configure build install list_installed
[5d9693c]188# additionally, clean after a fresh build
189test_lib_only_clean: test_lib_only uninstall check_clean check_distclean
190
191# build libaubio, build and test python-aubio against it
192test_lib_python: force_uninstall_python deps_python \
193        clean_python clean distclean \
194        configure build build_python \
195        install install_python \
[1b2669a]196        test_python \
197        list_all_installed
[5d9693c]198
199test_lib_python_clean: test_lib_python \
200        uninstall_python uninstall \
201        check_clean_python \
202        check_clean \
203        check_distclean
204
205# build libaubio, install it, build python-aubio against it
206test_lib_install_python: force_uninstall_python deps_python \
207        clean_python distclean \
208        configure build \
209        install \
210        build_python_extlib \
211        install_python \
[1b2669a]212        test_python \
213        list_all_installed
[5d9693c]214
215test_lib_install_python_clean: test_lib_install_python \
216        uninstall_python \
217        delete_install \
218        check_clean_python \
219        check_distclean
220
221# build a python-aubio that includes libaubio
222test_python_only: force_uninstall_python deps_python \
223        clean_python clean distclean \
224        build_python \
225        install_python \
[1b2669a]226        test_python \
227        list_installed_python
[5d9693c]228
229test_python_only_clean: test_python_only \
230        uninstall_python \
231        check_clean_python
232
[f1fc216]233sphinx: configure
234        $(WAFCMD) sphinx $(WAFOPTS)
235
236doxygen: configure
237        $(WAFCMD) doxygen $(WAFOPTS)
238
239manpages: configure
240        $(WAFCMD) manpages $(WAFOPTS)
241
242html: doxygen sphinx
[5d9693c]243
[f1fc216]244docs: html manpages
[e48b072]245
246dist: distclean expandwaf
247        $(WAFCMD) dist
Note: See TracBrowser for help on using the repository browser.