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