2
###--------------------------------------------
3
### Build puredata externals on Darwin or Linux
6
system := $(shell uname -s)
8
dspsrc := $(wildcard *.dsp)
9
cppsrc := $(addprefix $(DEST), $(dspsrc:.dsp=.cpp))
10
patches := $(addprefix $(DEST), $(dspsrc:.dsp=.pd))
13
FREEVERB := freeverb.dsp.xml
15
###--------------------------------------------
16
### compilation flags for Linux
17
### include dir must contain m_pd.h
19
LINUXCFLAGS := -DPD -O2 -funroll-loops -fomit-frame-pointer -fPIC \
21
LINUXINCLUDE := -I/usr/include/pdextended
23
###--------------------------------------------
24
### compilation flags for Darwin
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
30
###--------------------------------------------
31
### check what type of modules to build (MacOSX Darwin or Linux)
33
ifeq ($(system), Darwin)
34
modules := $(addprefix $(DEST), $(dspsrc:.dsp=~.pd_darwin))
36
modules := $(addprefix $(DEST), $(dspsrc:.dsp=~.pd_linux))
40
###--------------------------------------------
41
### Will use faust2pd to create the GUI patches
42
### only if it is installed
44
helper:=$(shell which faust2pd)
45
hasfaust2pd := $(findstring /faust2pd, $(helper))
47
ifeq ($(hasfaust2pd),)
49
message:="*** Install <faust>/tools/faust2pd if you want the example Pd patches to work ***"
51
todo:=$(modules) $(patches)
52
message:="Compiled: $(todo)"
55
###--------------------------------------------
58
allmodules: $(todo) print_message
61
faust -a $(ARCH) $< -o $@
64
faust -xml $< -o /dev/null
65
$(FAUST2PD) $(F2PDFLAGS) $<.xml
66
mv $(<:.dsp=.pd) $(DEST)
69
$(DEST)%~.pd_linux: $(DEST)%.cpp
70
$(CXX) $(LINUXCFLAGS) $(LINUXINCLUDE) $(OPTIONAL) -shared -Dmydsp=$(patsubst %~.pd_linux,%,$(notdir $@)) $< -o $@
72
$(DEST)%~.pd_darwin: $(DEST)%.cpp
73
$(CXX) $(DARWINCFLAGS) $(DARWININCLUDE) $(DYNLOAD_FLAGS) $(OPTIONAL) -Dmydsp=$(patsubst %~.pd_darwin,%,$(notdir $@)) $< -o $@