Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
be careful never to change the case of the extension in fortran ...
authordegomme <augustin.degomme@unibas.ch>
Wed, 20 Jan 2016 00:27:06 +0000 (01:27 +0100)
committerdegomme <augustin.degomme@unibas.ch>
Wed, 20 Jan 2016 00:27:06 +0000 (01:27 +0100)
Yes, it matters because one forces the C preprocessor to pass, and not the other.

src/smpi/smpif90.in
src/smpi/smpiff.in

index 1e6a7e6..1b61608 100644 (file)
@@ -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"
index 8cb4bf4..9cfa9fb 100644 (file)
@@ -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"