From: Martin Quinson Date: Thu, 22 Mar 2018 22:28:55 +0000 (+0100) Subject: smpiff: proper handling of non-f77 source files X-Git-Tag: v3.20~661 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/3084095879515d3bc832f716cd6c89e3bd5e7a3e smpiff: proper handling of non-f77 source files --- diff --git a/src/smpi/smpiff.in b/src/smpi/smpiff.in index c889053331..5741ba8941 100644 --- a/src/smpi/smpiff.in +++ b/src/smpi/smpiff.in @@ -26,7 +26,7 @@ cleanup () { } trap 'cleanup' EXIT -filter_and_compile() { +filter_and_compile_f77() { list_add TMPFILES "${TMPFILE}" #replace "program main_name by subroutine user\_main (and the end clause as well)" if [ $TRACE_CALL_LOCATION -gt 0 ]; then @@ -37,6 +37,17 @@ filter_and_compile() { SRCFILE="${TMPFILE}" list_add CMDLINE "${SRCFILE}" } +filter_and_compile_f90() { + list_add TMPFILES "${TMPFILE}" + #replace "program main_name by subroutine user\_main (and the end clause as well)" + if [ $TRACE_CALL_LOCATION -gt 0 ]; then + echo "#include \"@includedir@/smpi/smpi_extended_traces_fortran.h\"" > ${TMPFILE} + echo "#line 1 \"${ARG}\"" >> ${TMPFILE} + fi + sed 's/[[:space:]]*[pP][rR][oO][gG][rR][aA][mM][[:space:]]*\([a-zA-Z0-9\-\_]*\)/ subroutine user\_main /g;s/[[:space:]]*[uU][sS][eE][[:space:]]*[mM][pP][iI]/\include \"mpif\.h\" /g' "${ARG}" > "${TMPFILE}" + SRCFILE="${TMPFILE}" + list_add CMDLINE "${SRCFILE}" +} TRACE_CALL_LOCATION=0 NEEDS_OUTPUT=1 @@ -55,25 +66,25 @@ while [ $# -gt 0 ]; do FILENAME=`basename ${ARG}` TMPFILE=$(mymktemp "${ARG}" ".f") ORIGFILE="${FILENAME%.f}" - filter_and_compile + filter_and_compile_f77 ;; *.F)$ FILENAME=`basename ${ARG}` TMPFILE=$(mymktemp "${ARG}" ".F") ORIGFILE="${FILENAME%.F}" - filter_and_compile + filter_and_compile_f77 ;; *.f90) FILENAME=`basename ${ARG}` TMPFILE=$(mymktemp "${ARG}" ".f90") ORIGFILE="${FILENAME%.f90}" - filter_and_compile + filter_and_compile_f90 ;; *.F90)$ FILENAME=`basename ${ARG}` TMPFILE=$(mymktemp "${ARG}" ".F90") ORIGFILE="${FILENAME%.F90}" - filter_and_compile + filter_and_compile_f90 ;; '-version' | '--version') printf '%b\n' "$SIMGRID_VERSION"