File cleaning and architecture directory.
[Faustine.git] / interpretor / preprocessor / faust-0.9.47mr3 / examples / faust-stk / Makefile.pdcompile
1
2 ###--------------------------------------------
3 ### Build puredata externals on Darwin or Linux
4 ###
5
6 system := $(shell uname -s)
7 DEST := pddir/
8 dspsrc := $(wildcard *.dsp)
9 cppsrc := $(addprefix $(DEST), $(dspsrc:.dsp=.cpp))
10 patches := $(addprefix $(DEST), $(dspsrc:.dsp=.pd))
11 FAUST2PD := faust2pd
12 OPTIONAL := -I ./
13 FREEVERB := freeverb.dsp.xml
14
15 ###--------------------------------------------
16 ### compilation flags for Linux
17 ### include dir must contain m_pd.h
18 ###
19 LINUXCFLAGS := -DPD -O2 -funroll-loops -fomit-frame-pointer -fPIC \
20 -Wall $(CXXFLAGS)
21 LINUXINCLUDE := -I/usr/include/pdextended
22
23 ###--------------------------------------------
24 ### compilation flags for Darwin
25 ###
26 DARWINCFLAGS := -DPD -O2 -funroll-loops -fomit-frame-pointer -fPIC -Wall -msse
27 DYNLOAD_FLAGS := -bundle -undefined suppress -flat_namespace
28 DARWININCLUDE := -I/Applications/Pd-extended.app/Contents/Resources/include/ -I/opt/local/include
29
30 ###--------------------------------------------
31 ### check what type of modules to build (MacOSX Darwin or Linux)
32 ###
33 ifeq ($(system), Darwin)
34 modules := $(addprefix $(DEST), $(dspsrc:.dsp=~.pd_darwin))
35 else
36 modules := $(addprefix $(DEST), $(dspsrc:.dsp=~.pd_linux))
37 endif
38
39
40 ###--------------------------------------------
41 ### Will use faust2pd to create the GUI patches
42 ### only if it is installed
43
44 helper:=$(shell which faust2pd)
45 hasfaust2pd := $(findstring /faust2pd, $(helper))
46
47 ifeq ($(hasfaust2pd),)
48 todo:=$(modules)
49 message:="*** Install <faust>/tools/faust2pd if you want the example Pd patches to work ***"
50 else
51 todo:=$(modules) $(patches)
52 message:="Compiled: $(todo)"
53 endif
54
55 ###--------------------------------------------
56
57
58 allmodules: $(todo) print_message
59
60 $(DEST)%.cpp: %.dsp
61 faust -a $(ARCH) $< -o $@
62
63 $(DEST)%.pd: %.dsp
64 faust -xml $< -o /dev/null
65 $(FAUST2PD) $(F2PDFLAGS) $<.xml
66 mv $(<:.dsp=.pd) $(DEST)
67 rm -f $<.xml
68
69 $(DEST)%~.pd_linux: $(DEST)%.cpp
70 $(CXX) $(LINUXCFLAGS) $(LINUXINCLUDE) $(OPTIONAL) -shared -Dmydsp=$(patsubst %~.pd_linux,%,$(notdir $@)) $< -o $@
71
72 $(DEST)%~.pd_darwin: $(DEST)%.cpp
73 $(CXX) $(DARWINCFLAGS) $(DARWININCLUDE) $(DYNLOAD_FLAGS) $(OPTIONAL) -Dmydsp=$(patsubst %~.pd_darwin,%,$(notdir $@)) $< -o $@
74
75 print_message:
76 echo $(message)
77
78 clean:
79 rm -rf $(DEST)