source: Makefile @ 641e533

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

Makefile: avoid offline operations

  • Property mode set to 100644
File size: 5.7 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
6#WAFOPTS += --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
[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)
55        make list_installed
[972a326]56
[5d9693c]57list_installed:
58        find $(DESTDIR) -ls | sed 's|$(DESTDIR)|/«destdir»|'
59
60list_installed_python:
61        find $(PYDESTDIR) -ls | sed 's|$(PYDESTDIR)|/«pydestdir»|'
62
63uninstall:
64        # uninstall
65        $(WAFCMD) uninstall $(WAFOPTS)
66
67delete_install:
68        rm -rf $(PWD)/dist/test
69
70build_python:
71        # build python-aubio, using locally built libaubio if found
72        python ./setup.py build $(ENABLE_DOUBLE)
73
74build_python_extlib:
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)" \
82                make build_python
83        make list_installed
84        cat $(DESTDIR)/$(LIBDIR)/pkgconfig/aubio.pc
85
86deps_python:
87        # install or upgrade python requirements
[fe957ad]88        pip install --verbose --requirement requirements.txt
[5d9693c]89
90# use pip or distutils?
91#install_python: install_python_with_pip
92uninstall_python: uninstall_python_with_pip
93install_python: install_python_with_distutils
94#uninstall_python: uninstall_python_with_distutils
95
96install_python_with_pip:
[e56ac16]97        # install package
[5d9693c]98        pip install --verbose .
99
100uninstall_python_with_pip:
[e56ac16]101        # uninstall package
[5d9693c]102        pip uninstall -y -v aubio || make uninstall_python_with_distutils
103
104install_python_with_distutils:
105        ./setup.py install $(DISTUTILSOPTS)
106
107uninstall_python_with_distutils:
108        #./setup.py uninstall
109        [ -d $(PYDESTDIR)/$(LIBDIR) ] && echo Warning: did not clean $(PYDESTDIR)/$(LIBDIR) || true
110
111force_uninstall_python:
112        # ignore failure if not installed
113        -make uninstall_python
[39122f0]114
[e56ac16]115local_dylib:
[5d9693c]116        # DYLD_LIBRARY_PATH is no more on mac os
[1167631]117        # create links from ~/lib/lib* to build/src/lib*
[5d9693c]118        [ -f $(PWD)/build/src/libaubio.[0-9].dylib ] && ( mkdir -p ~/lib && cp -prv build/src/libaubio.[0-9].dylib ~/lib ) || true
[e56ac16]119
[5d9693c]120test_python: export LD_LIBRARY_PATH=$(DESTDIR)/$(LIBDIR)
121test_python: export PYTHONPATH=$(PYDESTDIR)/$(LIBDIR)
122test_python: local_dylib
[e56ac16]123        # run test with installed package
124        ./python/tests/run_all_tests --verbose
[5d9693c]125        # also run with nose, multiple processes
[f465088]126        nose2 -N 4
[5d9693c]127        # list installed files
128        #find $(DESTDIR) -ls | sed 's|$(DESTDIR)||'
129        make list_installed_python
[f465088]130
[5d9693c]131clean_python:
132        ./setup.py clean
[a2ae70a]133
[5d9693c]134check_clean_python:
135        # check cleaning a second time works
136        make clean_python
137        make clean_python
[a2ae70a]138
[0799252]139clean: checkwaf
[5d9693c]140        # optionnaly clean before build
141        -$(WAFCMD) clean
142
143check_clean:
144        # check cleaning after build works
145        $(WAFCMD) clean
146        # check cleaning a second time works
[81ad577]147        $(WAFCMD) clean
[ddd9861]148
[5864b43]149distclean:
150        $(WAFCMD) distclean
151
[5d9693c]152check_distclean:
153        make distclean
154
[e372a0f]155distcheck: checkwaf
[7aed123]156        $(WAFCMD) distcheck $(WAFOPTS) $(ENABLE_DOUBLE)
[8e94af5]157
158help:
[81ad577]159        $(WAFCMD) --help
[be06e53]160
161create_test_sounds:
[3a7b7c6]162        -[ -z `which $(SOX)` ] && ( echo $(SOX) could not be found) || true
163        -mkdir -p $(TESTSOUNDS)
[9e36acd]164        -$(SOX) -r 44100 -b 16 -n "$(TESTSOUNDS)/44100Hz_1f_silence.wav"          synth 1s   silence 0        dcshift .01
[ceb884d]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
[9e36acd]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
[e48b072]171
[5d9693c]172# build only libaubio, no python-aubio
173test_lib_only: clean distclean configure build install
174# additionally, clean after a fresh build
175test_lib_only_clean: test_lib_only uninstall check_clean check_distclean
176
177# build libaubio, build and test python-aubio against it
178test_lib_python: force_uninstall_python deps_python \
179        clean_python clean distclean \
180        configure build build_python \
181        install install_python \
182        test_python
183
184test_lib_python_clean: test_lib_python \
185        uninstall_python uninstall \
186        check_clean_python \
187        check_clean \
188        check_distclean
189
190# build libaubio, install it, build python-aubio against it
191test_lib_install_python: force_uninstall_python deps_python \
192        clean_python distclean \
193        configure build \
194        install \
195        build_python_extlib \
196        install_python \
197        test_python
198
199test_lib_install_python_clean: test_lib_install_python \
200        uninstall_python \
201        delete_install \
202        check_clean_python \
203        check_distclean
204
205# build a python-aubio that includes libaubio
206test_python_only: force_uninstall_python deps_python \
207        clean_python clean distclean \
208        build_python \
209        install_python \
210        test_python
211
212test_python_only_clean: test_python_only \
213        uninstall_python \
214        check_clean_python
215
216
[e48b072]217html:
218        cd doc && make html
219
220dist: distclean expandwaf
221        $(WAFCMD) dist
Note: See TracBrowser for help on using the repository browser.