Add 5 example Makefiles: primitives, dilation, erosion, open, close.
[Faustine.git] / interpretor / preprocessor / faust-0.9.47mr3 / tools / faust2appls / faust2csound
1 #!/bin/bash
2
3 #####################################################################
4 # #
5 # Compiles a Faust program into a csound opcode #
6 # (c) Grame, 2009 #
7 # #
8 #####################################################################
9
10
11 #-------------------------------------------------------------------
12 # Analyze command arguments :
13 # faust options -> OPTIONS
14 # if -omp : -openmp or -fopenmp -> OPENMP
15 # existing *.dsp files -> FILES
16 #
17
18 # PHASE 1 : Look for -icc option to force use of intel icc (actually icpc)
19 # without having to configure CXX and CXXFLAGS
20 for p in $@; do
21 if [ "$p" = -icc ]; then
22 CXX=icpc
23 CXXFLAGS='-O3 -xT -ftz -fno-alias -fp-model fast=2'
24 fi
25 done
26
27 #PHASE 2 : dispatch command arguments
28 for p in $@; do
29 if [ "$p" = -omp ]; then
30 if [[ $CXX == "icpc" ]]; then
31 OMP="-openmp"
32 else
33 OMP="-fopenmp"
34 fi
35 fi
36
37 if [ "$p" = -icc ]; then
38 ignore=" "
39 elif [ ${p:0:1} = "-" ]; then
40 OPTIONS="$OPTIONS $p"
41 elif [[ -e "$p" ]]; then
42 FILES="$FILES $p"
43 else
44 OPTIONS="$OPTIONS $p"
45 fi
46 done
47
48
49 #-------------------------------------------------------------------
50 # compile the *.dsp files
51 #
52 for SRC in $FILES; do
53 opname=`basename ${SRC%.dsp}`
54 faust -uim -double -a csound.cpp $OPTIONS "$SRC" -o "$SRC.cpp"
55 ${CXX=g++} ${CXXFLAGS=-O3} $OMP -I/usr/include/csound -shared -fPIC -DOPCODE_NAME=$opname "$SRC.cpp" -o "${SRC%.dsp}.dylib"
56 rm "$SRC.cpp"
57 BINARIES="$BINARIES${SRC%.dsp}.dylib;"
58 done
59
60 # return the binaries names
61 echo "$BINARIES"