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
10DLL = .pd_linux
11shared = -shared
12
13# Try to guess the host system type and figure out platform specifics.
14host = $(shell ../../config.guess)
15ifneq "$(findstring -mingw,$(host))" ""
16# Windows
17DLL = .dll
18PDLIB = -Wl,--enable-auto-import -lpd
19endif
20ifneq "$(findstring -darwin,$(host))" ""
21# OSX
22DLL = .pd_darwin
23shared = -dynamiclib -Wl,-undefined -Wl,dynamic_lookup
24endif
25ifneq "$(findstring x86_64-,$(host))" ""
26# 64 bit, needs -fPIC flag
27EXTRA_CFLAGS += -fPIC
28endif
29ifneq "$(findstring x86,$(host))" ""
30# architecture-specific options for x86 and x86_64
31EXTRA_CFLAGS += -msse -ffast-math
32endif
33
34EXTRA_CFLAGS += -I ../../pd
35
36# Define the desired number of voices for synth (.syn) plugins here:
37NVOICES = 8
38
39dspsrc  := $(wildcard *.dsp)
40synsrc  := $(wildcard *.syn)
41cppsrc  := $(dspsrc:.dsp=.cpp) $(synsrc:.syn=.cpp)
42plugins	:= $(dspsrc:%.dsp=%~$(DLL)) $(synsrc:%.syn=%~$(DLL))
43svg 	:= $(dspsrc:.dsp=.dsp-svg) $(synsrc:.syn=.syn-svg)
44xml 	:= $(dspsrc:.dsp=.dsp.xml) $(synsrc:.syn=.syn.xml)
45pd 	:= $(dspsrc:.dsp=.pd) $(synsrc:.syn=.pd)
46
47#faust2pd = faust2pd
48faust2pd = ../../faust2pd
49
50#all: $(plugins) $(svg) $(pd)
51all: $(plugins) $(pd)
52cpp: $(cppsrc)
53svg: $(svg)
54xml: $(xml)
55pd:  $(pd)
56
57clean:
58	rm -Rf *~ $(plugins)
59
60distclean: clean
61	rm -f $(cppsrc)
62
63realclean: distclean
64	rm -Rf $(svg) $(xml) $(pd)
65
66%.dsp-svg: %.dsp
67	faust -svg $< -o /dev/null >/dev/null
68
69%.syn-svg: %.syn
70	faust -svg $< -o /dev/null >/dev/null
71
72%.cpp: %.dsp
73	faust $(VEC) -a puredata.cpp $< -o $@
74
75%.cpp: %.syn
76	faust $(VEC) -a puredata.cpp $< -o $@
77
78%.dsp.xml: %.dsp
79	faust -xml $< -o /dev/null
80
81%.syn.xml: %.syn
82	faust -xml $< -o /dev/null
83
84%~$(DLL): %.cpp
85	$(CXX) $(shared) $(EXTRA_CFLAGS) $(CFLAGS) -Dmydsp=$(@:%~$(DLL)=%) $(LDFLAGS) $< -o $@ $(PDLIB)
86
87%.pd: %.dsp.xml
88	$(faust2pd) -s $<
89
90%.pd: %.syn.xml
91	$(faust2pd) -n $(NVOICES) -s $<
92