Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
b86184bd968d305f61cd769abed195a3d84492ee
[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       CFILE="${SRCFILE%.f}.c"
34       #echo "$prefix/bin/smpif2c ${SRCFILE} && $prefix/bin/smpicc ${ARGS} ${CFILE} && rm ${CFILE}"
35       $prefix/bin/smpif2c ${SRCFILE} && $prefix/bin/smpicc ${ARGS} ${CFILE} && rm ${CFILE}
36    done
37 else
38    #echo "$prefix/bin/smpicc ${ARGS}"
39    $prefix/bin/smpicc ${ARGS}
40 fi