Make install.
[Faustine.git] / interpretor / preprocessor / faust-0.9.47mr3 / tools / faust2pd / Makefile
1
2 # Package name and version number:
3 dist = faust2pd-$(version)
4 version = 2.5
5
6 # Default installation prefix:
7 prefix = /usr/local
8
9 # Try to guess the Pd installation prefix:
10 pdprefix = $(patsubst %/bin/pd,%,$(shell which pd 2>/dev/null))
11 ifeq ($(strip $(pdprefix)),)
12 # Fall back to /usr/local.
13 pdprefix = /usr/local
14 endif
15
16 bindir = $(prefix)/bin
17 # where to install the Pd stuff
18 libdir = $(pdprefix)/lib
19 datadir = $(libdir)/pd/extra
20
21 # Try to guess the host system type and do platform-specific setup.
22 host = $(shell ./config.guess)
23 ifneq "$(findstring -mingw,$(host))" ""
24 # Windows
25 EXE = .exe
26 endif
27
28 DESTDIR=
29
30 DISTFILES = Makefile COPYING ChangeLog README config.guess *.pure *.pd examples/README examples/*/Makefile examples/*/*.dsp examples/*/*.syn examples/*/*.pd examples/*/*.pure examples/*/*.xml
31 SEDFILES = README
32
33 .PHONY: all examples clean distclean realclean install uninstall
34
35 all: faust2pd$(EXE)
36
37 examples: faust2pd$(EXE)
38 for x in basic faust synth seqdemo; do make -C examples/$$x all; done
39
40 clean:
41 rm -f faust2pd$(EXE)
42 for x in basic faust synth seqdemo; do make -C examples/$$x clean; done
43
44 distclean:
45 rm -f faust2pd$(EXE)
46 for x in basic faust synth seqdemo; do make -C examples/$$x distclean; done
47
48 realclean:
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
53 faust2pd$(EXE): faust2pd.pure faustxml.pure
54 sed -e 's?@version@?$(version)?' < $< > xx$<
55 pure -c xx$< -o $@
56 rm -f xx$<
57
58 # install faust2pd
59 install:
60 test -d $(DESTDIR)$(bindir) || mkdir -p $(DESTDIR)$(bindir)
61 cp faust2pd$(EXE) $(DESTDIR)$(bindir)
62 strip $(DESTDIR)$(bindir)/faust2pd$(EXE)
63 ifeq "$(findstring -mingw,$(host))" ""
64 chmod a+x $(DESTDIR)$(bindir)/faust2pd$(EXE)
65 endif
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)
72 install-pd:
73 test -d $(DESTDIR)$(datadir) || mkdir -p $(DESTDIR)$(datadir)
74 cp faust-*.pd $(DESTDIR)$(datadir)
75
76 #uninstall
77 uninstall:
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
85 date = $(shell date "+%B %-d, %Y")
86 datesubst = sed -e "s?@version@?$(version)?g" -e "s?|today|?$(date)?g" < $(1) > $(2)
87
88 dist:
89 rm -rf $(dist)
90 mkdir $(dist) && 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
98 distcheck: 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 # Generate the documentation.
104
105 sources = faustxml.pure
106
107 faust2pd.txt: README $(sources)
108 pure-doc $(sources) | cat README - > $@