From: degomme Date: Wed, 20 Jan 2016 00:27:06 +0000 (+0100) Subject: be careful never to change the case of the extension in fortran ... X-Git-Tag: v3_13~1194 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/ddc1d616213207cdfb68448cfa6fe02da6516261 be careful never to change the case of the extension in fortran ... Yes, it matters because one forces the C preprocessor to pass, and not the other. --- diff --git a/src/smpi/smpif90.in b/src/smpi/smpif90.in index 1e6a7e6703..1b61608847 100644 --- a/src/smpi/smpif90.in +++ b/src/smpi/smpif90.in @@ -27,6 +27,15 @@ cleanup () { } trap 'cleanup' EXIT +filter_and_compile() { + list_add TMPFILES "${TMPFILE}" +#replace "program main_name by subroutine user\_main (and the end clause as well)" + sed 's/[[:space:]]*program[[:space:]]*\([a-zA-Z0-9\-\_]*\)/ subroutine user\_main /gI;s/[[:space:]]*use[[:space:]]*mpi/\include \"mpif\.h\" /gI' "${ARG}" > "${TMPFILE}" + SRCFILE="${TMPFILE}" + list_add CMDLINE "${SRCFILE}" +} + + list_set CMDLINE "${F90}" list_add_not_empty CMDLINE "${FFLAGS}" while [ $# -gt 0 ]; do @@ -38,13 +47,13 @@ while [ $# -gt 0 ]; do LINKARGS="" list_add CMDLINE "-c" ;; - *.f90|*.F90) + *.f90) TMPFILE=$(mymktemp "${ARG}" ".f90") - list_add TMPFILES "${TMPFILE}" - #replace "program main_name by subroutine user\_main (and the end clause as well)" - sed 's/[[:space:]]*program[[:space:]]*\([a-zA-Z0-9\-\_]*\)/ subroutine user\_main /gI;s/[[:space:]]*use[[:space:]]*mpi/\include \"mpif\.h\" /gI' "${ARG}" > "${TMPFILE}" - SRCFILE="${TMPFILE}" - list_add CMDLINE "${SRCFILE}" + filter_and_compile + ;; + *.F90) + TMPFILE=$(mymktemp "${ARG}" ".F90") + filter_and_compile ;; '-version' | '--version') printf '%b\n' "$SIMGRID_VERSION" diff --git a/src/smpi/smpiff.in b/src/smpi/smpiff.in index 8cb4bf4ca2..9cfa9fb611 100644 --- a/src/smpi/smpiff.in +++ b/src/smpi/smpiff.in @@ -27,7 +27,14 @@ cleanup () { } trap 'cleanup' EXIT - +filter_and_compile() { + list_add TMPFILES "${TMPFILE}" + #replace "program main_name by subroutine user\_main (and the end clause as well)" + sed 's/[[:space:]]\{6\}[[:space:]]*\(end \)\{0,1\}program[[:space:]]*\([a-zA-Z0-9\-\_]*\)/ \1subroutine user_main /gI;s/[[:space:]]*use[[:space:]]*mpi/\include \"mpif\.h\" /gI' "${ARG}" > "${TMPFILE}" + ORIGFILE="${ARG}" + SRCFILE="${TMPFILE}" + list_add CMDLINE "${SRCFILE}" +} NEEDS_OUTPUT=1 list_set CMDLINE "${F77}" @@ -41,14 +48,13 @@ while [ $# -gt 0 ]; do LINKARGS="" list_add CMDLINE "-c" ;; - *.f|*.F) + *.f) TMPFILE=$(mymktemp "${ARG}" ".f") - list_add TMPFILES "${TMPFILE}" - #replace "program main_name by subroutine user\_main (and the end clause as well)" - sed 's/[[:space:]]\{6\}[[:space:]]*\(end \)\{0,1\}program[[:space:]]*\([a-zA-Z0-9\-\_]*\)/ \1subroutine user_main /gI;s/[[:space:]]*use[[:space:]]*mpi/\include \"mpif\.h\" /gI' "${ARG}" > "${TMPFILE}" - ORIGFILE="${ARG}" - SRCFILE="${TMPFILE}" - list_add CMDLINE "${SRCFILE}" + filter_and_compile + ;; + *.F) + TMPFILE=$(mymktemp "${ARG}" ".F") + filter_and_compile ;; '-version' | '--version') printf '%b\n' "$SIMGRID_VERSION"