1 2# Package name and version number: 3dist = faust2pd-$(version) 4version = 2.12 5 6# Default installation prefix: 7prefix = /usr/local 8 9# Try to guess the Pd installation prefix: 10pdprefix = $(patsubst %/bin/pd,%,$(shell which pd 2>/dev/null)) 11ifeq ($(strip $(pdprefix)),) 12# Fall back to /usr/local. 13pdprefix = /usr/local 14endif 15 16bindir = $(prefix)/bin 17# where to install the Pd stuff 18libdir = $(pdprefix)/lib 19datadir = $(libdir)/pd/extra 20 21# Try to guess the host system type and do platform-specific setup. 22host = $(shell ./config.guess) 23ifneq "$(findstring -mingw,$(host))" "" 24# Windows 25EXE = .exe 26endif 27 28DESTDIR= 29 30DISTFILES = Makefile COPYING ChangeLog README config.guess *.pure *.pd examples/README debian/* examples/*/Makefile examples/*/*.cpp examples/*/*.dsp examples/*/*.syn examples/*/*.pd examples/*/*.pure examples/*/*.xml pd/*.h 31SEDFILES = README 32 33.PHONY: all examples clean distclean realclean install uninstall 34 35all: faust2pd$(EXE) 36 37examples: faust2pd$(EXE) 38 for x in basic faust synth seqdemo; do $(MAKE) -C examples/$$x all; done 39 40clean: 41 rm -f faust2pd$(EXE) 42 for x in basic faust synth seqdemo; do $(MAKE) -C examples/$$x clean; done 43 44distclean: 45 rm -f faust2pd$(EXE) 46 for x in basic faust synth seqdemo; do $(MAKE) -C examples/$$x distclean; done 47 48realclean: 49 rm -f faust2pd$(EXE) 50 for x in basic faust synth seqdemo; do $(MAKE) -C examples/$$x realclean; done 51 52# as of pure-0.21, we can compile the script to an executable 53faust2pd$(EXE): faust2pd.pure faustxml.pure 54 sed -e 's?@version@?$(version)?' < $< > xx$< 55 pure $(PUREC_FLAGS) -I. -c xx$< -o $@ 56 rm -f xx$< 57 58# install faust2pd 59install: 60 test -d $(DESTDIR)$(bindir) || mkdir -p $(DESTDIR)$(bindir) 61 cp faust2pd$(EXE) $(DESTDIR)$(bindir) 62 strip $(DESTDIR)$(bindir)/faust2pd$(EXE) 63ifeq "$(findstring -mingw,$(host))" "" 64 chmod a+x $(DESTDIR)$(bindir)/faust2pd$(EXE) 65endif 66 @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" 67 @echo "Optionally, you can also run make install-pd to install the auxiliary Faust" 68 @echo "abstractions in $(DESTDIR)$(datadir)." 69 @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" 70 71# install the auxiliary Faust abstractions (faust-*.pd) 72install-pd: 73 test -d $(DESTDIR)$(datadir) || mkdir -p $(DESTDIR)$(datadir) 74 cp faust-*.pd $(DESTDIR)$(datadir) 75 76#uninstall 77uninstall: 78 rm -rf $(DESTDIR)$(bindir)/faust2pd$(EXE) 79 rm -f $(DESTDIR)$(datadir)/faust-*.pd 80 81.PHONY: dist distcheck 82 83# roll distribution tarball 84 85date = $(shell date "+%B %-d, %Y") 86datesubst = sed -e "s?@version@?$(version)?g" -e "s?|today|?$(date)?g" < $(1) > $(2) 87 88dist: 89 rm -rf $(dist) 90 mkdir $(dist) && mkdir $(dist)/debian && mkdir $(dist)/pd && mkdir $(dist)/examples 91 for x in basic faust seqdemo synth; do mkdir $(dist)/examples/$$x; done 92 for x in $(DISTFILES); do ln -sf $$PWD/$$x $(dist)/$$x; done 93 for x in $(SEDFILES); do rm -f $(dist)/$$x; $(call datesubst,$$PWD/$$x,$(dist)/$$x); done 94 rm -f $(dist).tar.gz 95 tar cfzh $(dist).tar.gz $(dist) 96 rm -rf $(dist) 97 98distcheck: dist 99 tar xfz $(dist).tar.gz 100 cd $(dist) && $(MAKE) all examples && $(MAKE) install install-pd DESTDIR=./BUILD 101 rm -rf $(dist) 102 103# Debian packaging 104 105debsrc = $(shell echo $(dist) | sed -e 's/-$(version)/_$(version)/').orig.tar.gz 106 107deb: $(debsrc) dist 108 tar xfz $(dist).tar.gz 109 cd $(dist) && debuild $(DEBUILD_FLAGS) 110 rm -rf $(dist) 111 112$(debsrc): 113 wget -nv https://bitbucket.org/purelang/pure-lang/downloads/$(dist).tar.gz -O $@ 114 115# Generate the documentation. 116 117sources = faustxml.pure 118 119faust2pd.txt: README $(sources) 120 pure-doc $(sources) | cat README - > $@ 121