3 # Copyright (c) 2010-2014. The SimGrid Team.
6 # This program is free software; you can redistribute it and/or modify it
7 # under the terms of the license (GNU LGPL) which comes with this package.
10 smpicc="$prefix/bin/smpicc"
11 smpif2c="$prefix/bin/smpif2c"
15 list_set ARGS "-DMAIN__=user_main" "-Diargc_=smpi_process_argc" "-Dgetarg_=smpi_process_getarg"
16 list_set LINKARGS "-L@F2C_LIBRARY_PATH@" "-lf2c" "-lm"
19 while [ $# -gt 0 ]; do
24 SRCFILE="$(readlink -f ${ARG} 2>/dev/null)"
25 if [ -z "$SRCFILE" ] ; then
28 list_add SRCFILES "${SRCFILE}"
31 if [ "${ARG}" = "-c" ]; then
34 list_add ARGS "${ARG}"
38 list_add_not_empty ARGS "${LINKARGS}"
43 TMPFILE=$(mymktemp "${SRCFILE}" ".f")
44 CFILE="${TMPFILE%.f}.c"
48 cp "${SRCFILE}" "${TMPFILE}" \
49 && "$smpif2c" "${TMPFILE}" \
50 && "$smpicc" "$@" "${CFILE}" \
52 && rm -f "${TMPFILE}" \
55 # When the file is compiled with "-c" and no output file is specified with
56 # "-o", rename the output. FIXME: do it properly.
57 if [ -f "${CFILE%.c}.o" ]; then
58 mv "${CFILE%.c}.o" "${SRCFILE%.f}.o"
62 if [ -n "${SRCFILES}" ]; then
63 eval $(list_get SRCFILES)
64 for SRCFILE in "$@"; do