Completing basic operations in basic.ml for primitives float, And, Or, Xor, fmod...
[Faustine.git] / interpretor / preprocessor / faust-0.9.47mr3 / tools / faust2appls / faust2plot
1 #!/bin/bash
2
3 #####################################################################
4 # #
5 # Compiles Faust programs to plotters #
6 # (c) Grame, 2009 #
7 # #
8 #####################################################################
9
10 #-------------------------------------------------------------------
11 # Check darwin specifics
12 #
13 if [[ $(uname) == Darwin ]]; then
14 MARCH=""
15 else
16 MARCH="-march=native"
17 fi
18
19 #-------------------------------------------------------------------
20 # Default compilation flags for gcc and icc :
21 #
22 MYGCCFLAGS="-O3 $MARCH -mfpmath=sse -msse -msse2 -msse3 -ffast-math -ftree-vectorize"
23 MYICCFLAGS="-O3 -xHost -ftz -fno-alias -fp-model fast=2"
24
25 #-------------------------------------------------------------------
26 # Analyze command arguments :
27 # faust options -> OPTIONS
28 # if -omp : -openmp or -fopenmp -> OPENMP
29 # existing *.dsp files -> FILES
30 #
31
32 # PHASE 1 : Look for -icc option to force use of intel icc (actually icpc)
33 # without having to configure CXX and CXXFLAGS
34 CXX=g++
35 CXXFLAGS=$MYGCCFLAGS
36 for p in $@; do
37 if [ "$p" = -icc ]; then
38 CXX=icpc
39 CXXFLAGS=$MYICCFLAGS
40 fi
41 done
42
43 #PHASE 2 : dispatch command arguments
44 for p in $@; do
45 if [ "$p" = -omp ]; then
46 if [[ $CXX == "icpc" ]]; then
47 OMP="-openmp"
48 else
49 OMP="-fopenmp"
50 fi
51 fi
52
53 if [ "$p" = -icc ]; then
54 ignore=" "
55 elif [ ${p:0:1} = "-" ]; then
56 OPTIONS="$OPTIONS $p"
57 elif [[ -e "$p" ]]; then
58 FILES="$FILES $p"
59 else
60 OPTIONS="$OPTIONS $p"
61 fi
62 done
63
64 #-------------------------------------------------------------------
65 # compile the *.dsp files
66
67 for f in $FILES; do
68
69 # compile faust to c++
70 faust -a matlabplot.cpp $OPTIONS "$f" -o "$f.cpp"
71
72 # compile c++ to binary
73 (
74 ${CXX=g++} ${CXXFLAGS=-O3} $OMP "$f.cpp" -o "${f%.dsp}"
75 ) > /dev/null
76 rm "$f.cpp"
77
78 # collect binary file name for FaustWorks
79 BINARIES="$BINARIES${f%.dsp};"
80 done
81 echo $BINARIES