Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
301802c2f9078034b01422ef629a5c72183ebffa
[simgrid.git] / src / smpi / smpiff.in
1 #! /bin/bash
2 prefix="@exec_prefix@"
3
4 ARGS="-DMAIN__=user_main -Diargc_=smpi_process_argc -Dgetarg_=smpi_process_getarg"
5 LINKARGS="-lf2c"
6 SRCFILES=""
7
8 while [ -n "$1" ]; do
9   ARG="$1"
10   shift
11   case "${ARG}" in
12     *.f)
13       SRCFILE="$(readlink -f ${ARG} 2>/dev/null)"
14        if [ -z $SRCFILE ] ; then
15          SRCFILE="$ARG"
16        fi
17        SRCFILES="${SRCFILES} ${SRCFILE}"
18        ;;
19     *)
20       if [ "${ARG}" = "-c" ]; then
21           LINKARGS=""
22       fi
23       ARGS="${ARGS} ${ARG}"
24       ;;
25   esac
26 done
27 ARGS="${ARGS} ${LINKARGS}"
28
29 if [ -n "${SRCFILES}" ]
30 then
31    for SRCFILE in "${SRCFILES}"
32    do
33       TMPFILE=${SRCFILE}\_$RANDOM.f
34       cp ${SRCFILE} ${TMPFILE}
35       CFILE="${TMPFILE%.f}.c"
36       #echo "$prefix/bin/smpif2c ${TMPFILE} && $prefix/bin/smpicc ${ARGS} ${CFILE} && rm ${CFILE} && rm ${TMPFILE}"
37       $prefix/bin/smpif2c ${TMPFILE} && $prefix/bin/smpicc ${ARGS} ${CFILE} && rm ${CFILE} && rm ${TMPFILE}
38    done
39 else
40    #echo "$prefix/bin/smpicc ${ARGS}"
41    $prefix/bin/smpicc ${ARGS}
42 fi