Readme and Install files lifting.
[Faustine.git] / interpretor / faust-0.9.47mr3 / tools / faust2appls / faust2octave
1 #!/bin/bash
2
3 #####################################################################
4 # #
5 # Compiles Faust programs to plotters #
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 f in $FILES; do
53
54 # compile faust to c++
55 faust -a matlabplot.cpp $OPTIONS "$f" -o "$f.cpp"
56
57 # compile c++ to binary
58 (
59 ${CXX=g++} ${CXXFLAGS=-O3} $OMP "$f.cpp" -o "${f%.dsp}"
60 ) > /dev/null
61
62 # run binary to generate data file
63 ./"${f%.dsp}" -n 60000 > "${f%.dsp}.m"
64
65 # display data file
66 octave --persist ${f%.dsp}.m
67 rm "$f.cpp"
68
69 # collect binary file name for FaustWorks
70 BINARIES="$BINARIES${f%.dsp};"
71 done
72 echo $BINARIES
73