4c99acf0b44c24fa40ed876fb3ed78fadd69f3e7
[Faustine.git] / interpretor / preprocessor / faust-0.9.47mr3 / tools / faust2pd / examples / synth / Makefile
1
2 # Generic Makefile for Faust Pd plugins.
3 # Translates ordinary effects (.dsp) and synths (.syn => -n 8).
4
5 # make, make all: make plugins and wrappers
6 # make cpp: make C++ sources
7 # make svg: make SVG diagrams
8 # make clean: remove all generated stuff
9
10 DLL = .pd_linux
11 shared = -shared
12
13 # Try to guess the host system type and figure out platform specifics.
14 host = $(shell ../../config.guess)
15 ifneq "$(findstring -mingw,$(host))" ""
16 # Windows
17 DLL = .dll
18 PDLIB = -Wl,--enable-auto-import -lpd
19 endif
20 ifneq "$(findstring x86_64-,$(host))" ""
21 # 64 bit, needs -fPIC flag
22 EXTRA_CFLAGS += -fPIC
23 endif
24 ifneq "$(findstring x86,$(host))" ""
25 # architecture-specific options for x86 and x86_64
26 EXTRA_CFLAGS += -msse -ffast-math
27 endif
28
29 # Try to figure out the Pd include directory.
30 pdincdir = $(strip $(shell pkg-config pd --cflags-only-I 2>/dev/null))
31 ifeq "$(pdincdir)" ""
32 # Try some common locations.
33 pdincdir = $(addprefix -I,$(shell ls -d /usr/local/include/pdextended /usr/local/include/pd /usr/include/pdextended /usr/include/pd 2>/dev/null))
34 endif
35 EXTRA_CFLAGS += $(pdincdir)
36
37 # Define the desired number of voices for synth (.syn) plugins here:
38 NVOICES = 8
39
40 dspsrc := $(wildcard *.dsp)
41 synsrc := $(wildcard *.syn)
42 cppsrc := $(dspsrc:.dsp=.cpp) $(synsrc:.syn=.cpp)
43 plugins := $(dspsrc:%.dsp=%~$(DLL)) $(synsrc:%.syn=%~$(DLL))
44 svg := $(dspsrc:.dsp=.dsp-svg) $(synsrc:.syn=.syn-svg)
45 xml := $(dspsrc:.dsp=.dsp.xml) $(synsrc:.syn=.syn.xml)
46 pd := $(dspsrc:.dsp=.pd) $(synsrc:.syn=.pd)
47
48 #faust2pd = faust2pd
49 faust2pd = ../../faust2pd
50
51 #all: $(plugins) $(svg) $(pd)
52 all: $(plugins) $(pd)
53 cpp: $(cppsrc)
54 svg: $(svg)
55 xml: $(xml)
56 pd: $(pd)
57
58 clean:
59 rm -Rf *~ $(plugins)
60
61 distclean: clean
62 rm -f $(cppsrc)
63
64 realclean: distclean
65 rm -Rf $(svg) $(xml) $(pd)
66
67 %.dsp-svg: %.dsp
68 faust -svg $< -o /dev/null >/dev/null
69
70 %.syn-svg: %.syn
71 faust -svg $< -o /dev/null >/dev/null
72
73 %.cpp: %.dsp
74 faust $(VEC) -a puredata.cpp $< -o $@
75
76 %.cpp: %.syn
77 faust $(VEC) -a puredata.cpp $< -o $@
78
79 %.dsp.xml: %.dsp
80 faust -xml $< -o /dev/null
81
82 %.syn.xml: %.syn
83 faust -xml $< -o /dev/null
84
85 %~$(DLL): %.cpp
86 $(CXX) $(shared) $(EXTRA_CFLAGS) $(CFLAGS) -Dmydsp=$(@:%~$(DLL)=%) $< -o $@ $(PDLIB)
87
88 %.pd: %.dsp.xml
89 $(faust2pd) -s $<
90
91 %.pd: %.syn.xml
92 $(faust2pd) -n $(NVOICES) -s $<