New Makefile for libsndfile-ocaml library integration; Makefiles chain modified.
[Faustine.git] / interpretor / preprocessor / faust-0.9.47mr3 / tools / faust2appls / faust2ladspa
1 #!/bin/bash
2
3 OSCDEFS=""
4 #####################################################################
5 # #
6 # Compiles Faust programs to ladspa plugins #
7 # (c) Grame, 2011 #
8 # #
9 #####################################################################
10
11 #-------------------------------------------------------------------
12 # Check darwin specifics
13 #
14 if [[ $(uname) == Darwin ]]; then
15 MARCH=""
16 SPEC="-fPIC -bundle"
17 else
18 MARCH="-march=native"
19 SPEC="-fPIC -shared"
20 fi
21
22 #-------------------------------------------------------------------
23 # Analyze command arguments :
24 # faust options -> OPTIONS
25 # if -omp : -openmp or -fopenmp -> OPENMP
26 # existing *.dsp files -> FILES
27 #
28
29 # PHASE 1 : Look for -icc option to force use of intel icc (actually icpc)
30 # without having to configure CXX and CXXFLAGS
31
32 CXXFLAGS='-O3 $MARCH -mfpmath=sse -msse -msse2 -msse3 -ffast-math'
33
34 for p in $@; do
35 if [ "$p" = -icc ]; then
36 CXX=icpc
37 CXXFLAGS='-O3 -xT -ftz -fno-alias -fp-model fast=2'
38 fi
39 done
40
41 #PHASE 2 : dispatch command arguments
42 for p in $@; do
43 if [ "$p" = -omp ]; then
44 if [[ $CXX == "icpc" ]]; then
45 OMP="-openmp"
46 else
47 OMP="-fopenmp"
48 fi
49 fi
50
51 if [ "$p" = -icc ]; then
52 ignore=" "
53 elif [ $p = "-osc" ]; then
54 #option ignored for plugins
55 OSCDEFS="-I/usr/local/lib/faust/osclib -DOSCCTRL -L/usr/local/lib/faust/osclib -lOSCFaust -loscpack"
56 elif [ ${p:0:1} = "-" ]; then
57 OPTIONS="$OPTIONS $p"
58 elif [[ -e "$p" ]]; then
59 FILES="$FILES $p"
60 else
61 OPTIONS="$OPTIONS $p"
62 fi
63 done
64
65
66
67 #-------------------------------------------------------------------
68 # Check darwin specifics
69 #
70 if [[ $(uname) == Darwin ]]; then
71 SPEC="-fPIC -bundle"
72 else
73 SPEC="-fPIC -shared"
74 fi
75
76
77
78
79
80 #-------------------------------------------------------------------
81 # compile the *.dsp files as ladspa plugins
82 #
83 for f in $FILES; do
84
85 dst="${f%.dsp}.so"
86 module=`basename $f .dsp`
87
88 # compile faust to c++
89 faust -a ladspa.cpp $OPTIONS "$f" -o "$f.cpp"
90
91 # compile c++ to binary
92 (
93 ${CXX=g++} $CXXFLAGS $SPEC -Dmydsp=$module -I/usr/local/lib/faust "$f.cpp" -o $dst
94 ) #> /dev/null
95 #rm "$f.cpp"
96
97 # collect binary file name for FaustGIDE
98 BINARIES="$BINARIES$dst;"
99 done
100
101
102 echo $BINARIES
103
104