forked from eberdahl/SaM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.pdcompile
93 lines (72 loc) · 2.74 KB
/
Makefile.pdcompile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
###--------------------------------------------
### Build puredata externals on Darwin or Linux
###
system := $(shell uname -s)
DEST := pddir/
ifdef SAMTARGET
dspsrc := $(SAMTARGET).mdl
else
dspsrc := $(wildcard *.mdl)
endif
cppsrc := $(addprefix $(DEST), $(dspsrc:.mdl=.cpp))
dspfile := $(dspsrc:.mdl=.dsp)
mdxfile := $(dspsrc:.mdl=.mdx)
patches := $(addprefix $(DEST), $(dspsrc:.mdl=.pd))
FAUST2PD := faust2pd
F2PDFLAGS := -r 10 -s
###--------------------------------------------
### compilation flags for Linux
###
LINUXCFLAGS := -DPD -fPIC -Wall -O3 -mfpmath=sse -msse -msse2 -msse3 -ffast-math
LINUXINCLUDE := -I/usr/include/pdextended
###--------------------------------------------
### compilation flags for Darwin
###
DARWINCFLAGS := -DPD -fPIC -Wall -O3 -msse -msse2 -msse3 -ffast-math -Wextra-tokens -Wno-unused-variable
DYNLOAD_FLAGS := -bundle -undefined suppress -flat_namespace
DARWININCLUDE := -I/Applications/Pd-extended.app/Contents/Resources/include/
###--------------------------------------------
### check what type of modules to build (MacOSX Darwin or Linux)
###
ifeq ($(system), Darwin)
modules := $(addprefix $(DEST), $(dspsrc:.mdl=~.pd_darwin))
else
modules := $(addprefix $(DEST), $(dspsrc:.mdl=~.pd_linux))
endif
###--------------------------------------------
### Will use faust2pd to create the GUI patches
### only if it is installed
helper:=$(shell which faust2pd)
hasfaust2pd := $(findstring /faust2pd, $(helper))
ifeq ($(hasfaust2pd),)
todo:=$(modules)
else
todo:=$(modules) $(patches)
endif
###--------------------------------------------
allmodules: $(mdxfile) $(dspfile) $(todo)
%.mdx : %.mdl
@perl SAM-preprocessor $< $@
%.dsp : %.mdx
perl Synth-A-Modeler $< $@
$(DEST)%.cpp: %.dsp
# $(dspfile) # EJB: I don't know why that was in here, so I commented it out ...
faust -a $(ARCH) -double $< -o $@
# If there are pre-specified help files, then copy them over
cp pdhelp/$(<:.dsp=*) $(DEST) &
$(DEST)%.pd: %.dsp
sed 's/samtargetdspname/$(<:.dsp=)/g' PureDataFireFaderSimulator.pd > $(DEST)$(<:.dsp=-FireFaderSimulator.pd)
faust -xml $< -o /dev/null
$(FAUST2PD) $(F2PDFLAGS) $<.xml
mv $(<:.dsp=.pd) $(DEST)
rm -f $<.xml
$(DEST)%~.pd_linux: $(DEST)%.cpp
$(CXX) $(LINUXCFLAGS) $(LINUXINCLUDE) -shared -Dmydsp=$(patsubst %~.pd_linux,%,$(notdir $@)) $< -o $@
# On Darwin we create both 32-bits and 64-bits intel code
$(DEST)%~.pd_darwin: $(DEST)%.cpp
$(CXX) -arch i386 $(DARWINCFLAGS) $(DARWININCLUDE) $(DYNLOAD_FLAGS) -Dmydsp=$(patsubst %~.pd_darwin,%,$(notdir $@)) $< -o [email protected]
$(CXX) -arch x86_64 $(DARWINCFLAGS) $(DARWININCLUDE) $(DYNLOAD_FLAGS) -Dmydsp=$(patsubst %~.pd_darwin,%,$(notdir $@)) $< -o [email protected]_64
lipo -create [email protected] [email protected]_64 -output $@
clean:
rm -rf $(DEST)