Bug fixed for unix error "readlink /proc/self/fd/0" on MacOS.
[Faustine.git] / interpreter / preprocessor / faust-0.9.47mr3 / examples / 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 F2PDFLAGS := -r 10 -s
13
14 ###--------------------------------------------
15 ### compilation flags for Linux
16 ###
17 LINUXCFLAGS := -DPD -fPIC -Wall -O3 -mfpmath=sse -msse -msse2 -msse3 -ffast-math
18 LINUXINCLUDE := -I/usr/include/pdextended
19
20 ###--------------------------------------------
21 ### compilation flags for Darwin
22 ###
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/
26
27 ###--------------------------------------------
28 ### check what type of modules to build (MacOSX Darwin or Linux)
29 ###
30 ifeq ($(system), Darwin)
31 modules := $(addprefix $(DEST), $(dspsrc:.dsp=~.pd_darwin))
32 else
33 modules := $(addprefix $(DEST), $(dspsrc:.dsp=~.pd_linux))
34 endif
35
36
37 ###--------------------------------------------
38 ### Will use faust2pd to create the GUI patches
39 ### only if it is installed
40
41 helper:=$(shell which faust2pd)
42 hasfaust2pd := $(findstring /faust2pd, $(helper))
43
44 ifeq ($(hasfaust2pd),)
45 todo:=$(modules)
46 else
47 todo:=$(modules) $(patches)
48 endif
49
50 ###--------------------------------------------
51
52
53 allmodules: $(todo)
54
55 $(DEST)%.cpp: %.dsp
56 faust -a $(ARCH) $< -o $@
57
58 $(DEST)%.pd: %.dsp
59 faust -xml $< -o /dev/null
60 $(FAUST2PD) $(F2PDFLAGS) $<.xml
61 mv $(<:.dsp=.pd) $(DEST)
62 rm -f $<.xml
63
64 $(DEST)%~.pd_linux: $(DEST)%.cpp
65 $(CXX) $(LINUXCFLAGS) $(LINUXINCLUDE) -shared -Dmydsp=$(patsubst %~.pd_linux,%,$(notdir $@)) $< -o $@
66
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 $@
72 rm $@.i386 $@.x86_64
73
74 clean:
75 rm -rf $(DEST)