1DLL = .pd_linux
2shared = -shared
3
4# Try to guess the host system type and figure out platform specifics.
5host = $(shell ../../config.guess)
6ifneq "$(findstring -mingw,$(host))" ""
7# Windows
8DLL = .dll
9PDLIB = -Wl,--enable-auto-import -lpd
10endif
11ifneq "$(findstring -darwin,$(host))" ""
12# OSX
13DLL = .pd_darwin
14shared = -dynamiclib -Wl,-undefined -Wl,dynamic_lookup
15endif
16ifneq "$(findstring x86_64-,$(host))" ""
17# 64 bit, needs -fPIC flag
18EXTRA_CFLAGS += -fPIC
19endif
20ifneq "$(findstring x86,$(host))" ""
21# architecture-specific options for x86 and x86_64
22EXTRA_CFLAGS += -msse -ffast-math
23endif
24
25EXTRA_CFLAGS += -I ../../pd
26
27dspsrc  := $(wildcard *.dsp)
28cppsrc  := $(dspsrc:.dsp=.cpp)
29mods	:= $(dspsrc:%.dsp=%~$(DLL))
30svg 	:= $(dspsrc:.dsp=.svg)
31xml 	:= $(dspsrc:.dsp=.dsp.xml)
32pd 	:= $(dspsrc:.dsp=.pd)
33libs    := $(wildcard *.lib)
34
35ARCH     = puredata.cpp
36#FAUST2PD = faust2pd
37FAUST2PD = ../../faust2pd
38# faust2pd options (the -s forces additional number controls for each slider)
39# a number of other options are supported, run faust2pd -h for help
40F2PDFLAGS = -s
41
42all: $(mods) $(pd)
43
44cpp: $(cppsrc)
45
46svg: $(svg)
47
48xml: $(xml)
49
50%~$(DLL): %.cpp
51	$(CXX) $(shared) $(EXTRA_CFLAGS) $(CFLAGS) -Dmydsp=$(@:%~$(DLL)=%) $(LDFLAGS) $< -o $@ $(PDLIB)
52
53%.cpp: %.dsp
54	faust $(VEC) -a $(ARCH) $< -o $@
55
56%.svg: %.dsp
57	faust -svg $< -o /dev/null >/dev/null
58
59%.dsp.xml: %.dsp
60	faust -xml $< -o /dev/null
61
62# synths
63
64NVOICES = 2
65
66organ.pd: organ.dsp.xml
67	$(FAUST2PD) $(F2PDFLAGS) -n $(NVOICES) $<
68
69subtractive.pd: subtractive.dsp.xml
70	$(FAUST2PD) $(F2PDFLAGS) -n $(NVOICES) $<
71
72karplusplus.pd: karplusplus.dsp.xml
73	$(FAUST2PD) $(F2PDFLAGS) -n $(NVOICES) $<
74
75# other dsps (effect units)
76
77%.pd: %.dsp.xml
78	$(FAUST2PD) $(F2PDFLAGS) $<
79
80clean:
81	rm -f $(mods) *~ *.a *.o
82
83distclean:
84	rm -f $(mods) $(cppsrc) *~ *.a *.o
85
86clean-cpp:
87	rm -f $(cppsrc)
88
89clean-xml:
90	rm -f $(xml)
91
92clean-pd:
93	rm -f $(pd)
94
95clean-svg:
96	rm -rf *-svg
97
98realclean:
99	rm -f $(mods) $(cppsrc) $(xml) $(pd) *~ *.a *.o
100	rm -rf *-svg
101