File: Makefile.pdcompile

package info (click to toggle)
faust 0.9.46-2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 15,256 kB
  • ctags: 9,961
  • sloc: cpp: 47,746; sh: 2,254; ansic: 1,503; makefile: 1,211; ruby: 950; yacc: 468; objc: 459; lex: 200; xml: 177
file content (79 lines) | stat: -rw-r--r-- 2,278 bytes parent folder | download
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

###--------------------------------------------
### Build puredata externals on Darwin or Linux
###

system			:= $(shell uname -s)
DEST			:= pddir/
dspsrc  		:= $(wildcard *.dsp)
cppsrc  		:= $(addprefix $(DEST), $(dspsrc:.dsp=.cpp))
patches			:= $(addprefix $(DEST),  $(dspsrc:.dsp=.pd))
FAUST2PD 		:= faust2pd
OPTIONAL 		:= -I ./
FREEVERB 		:= freeverb.dsp.xml

###--------------------------------------------
### compilation flags for Linux
### include dir must contain m_pd.h
###
LINUXCFLAGS 	:= -DPD -O2 -funroll-loops -fomit-frame-pointer -fPIC \
                   -Wall $(CXXFLAGS)
LINUXINCLUDE 	:= -I/usr/include/pdextended

###--------------------------------------------
### compilation flags for Darwin
###
DARWINCFLAGS 	:= -DPD -O2 -funroll-loops -fomit-frame-pointer -fPIC -Wall -msse
DYNLOAD_FLAGS	:= -bundle -undefined suppress -flat_namespace
DARWININCLUDE 	:= -I/Applications/Pd-extended.app/Contents/Resources/include/  -I/opt/local/include

###--------------------------------------------
### check what type of modules to build (MacOSX Darwin or Linux)
###
ifeq ($(system), Darwin)
modules 		:= $(addprefix $(DEST),  $(dspsrc:.dsp=~.pd_darwin))
else
modules			:= $(addprefix $(DEST),  $(dspsrc:.dsp=~.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)
	message:="*** Install <faust>/tools/faust2pd if you want the example Pd patches to work ***"
else
	todo:=$(modules) $(patches)
	message:="Compiled: $(todo)"
endif

###--------------------------------------------


allmodules: $(todo) print_message

$(DEST)%.cpp: %.dsp
	faust -a $(ARCH) $< -o $@
	
$(DEST)%.pd: %.dsp
	faust -xml $< -o /dev/null
	$(FAUST2PD) $(F2PDFLAGS) $<.xml
	mv $(<:.dsp=.pd) $(DEST)
	rm -f $<.xml

$(DEST)%~.pd_linux: $(DEST)%.cpp
	$(CXX) $(LINUXCFLAGS) $(LINUXINCLUDE) $(OPTIONAL) -shared -Dmydsp=$(patsubst %~.pd_linux,%,$(notdir $@)) $< -o $@

$(DEST)%~.pd_darwin: $(DEST)%.cpp
	$(CXX) $(DARWINCFLAGS) $(DARWININCLUDE) $(DYNLOAD_FLAGS) $(OPTIONAL) -Dmydsp=$(patsubst %~.pd_darwin,%,$(notdir $@)) $< -o $@

print_message:
	echo $(message)

clean:
	rm -rf $(DEST)