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))
14 ###--------------------------------------------
15 ### compilation flags for Linux
17 LINUXCFLAGS := -DPD -fPIC -Wall -O3 -mfpmath=sse -msse -msse2 -msse3 -ffast-math
18 LINUXINCLUDE := -I/usr/include/pdextended
20 ###--------------------------------------------
21 ### compilation flags for Darwin
23 DARWINCFLAGS := -DPD -fPIC -Wall -O3 -mfpmath=sse -msse -msse2 -msse3 -ffast-math
24 DYNLOAD_FLAGS := -bundle -undefined suppress -flat_namespace
25 DARWININCLUDE := -I/Applications/Pd-extended.app/Contents/Resources/include/
27 ###--------------------------------------------
28 ### check what type of modules to build (MacOSX Darwin or Linux)
30 ifeq ($(system), Darwin)
31 modules := $(addprefix $(DEST), $(dspsrc:.dsp=~.pd_darwin))
33 modules := $(addprefix $(DEST), $(dspsrc:.dsp=~.pd_linux))
37 ###--------------------------------------------
38 ### Will use faust2pd to create the GUI patches
39 ### only if it is installed
41 helper:=$(shell which faust2pd)
42 hasfaust2pd := $(findstring /faust2pd, $(helper))
44 ifeq ($(hasfaust2pd),)
47 todo:=$(modules) $(patches)
50 ###--------------------------------------------
56 faust -a $(ARCH) $< -o $@
59 faust -xml $< -o /dev/null
60 $(FAUST2PD) $(F2PDFLAGS) $<.xml
61 mv $(<:.dsp=.pd) $(DEST)
64 $(DEST)%~.pd_linux: $(DEST)%.cpp
65 $(CXX) $(LINUXCFLAGS) $(LINUXINCLUDE) -shared -Dmydsp=$(patsubst %~.pd_linux,%,$(notdir $@)) $< -o $@
67 # On Darwin we create both 32-bits and 64-bits intel code
68 $(DEST)%~.pd_darwin: $(DEST)%.cpp
69 $(CXX) -arch i386 $(DARWINCFLAGS) $(DARWININCLUDE) $(DYNLOAD_FLAGS) -Dmydsp=$(patsubst %~.pd_darwin,%,$(notdir $@)) $< -o $@.i386
70 $(CXX) -arch x86_64 $(DARWINCFLAGS) $(DARWININCLUDE) $(DYNLOAD_FLAGS) -Dmydsp=$(patsubst %~.pd_darwin,%,$(notdir $@)) $< -o $@.x86_64
71 lipo -create $@.i386 $@.x86_64 -output $@