3 # Copyright (c) 2012-2019. The SimGrid Team. All rights reserved.
5 # This program is free software; you can redistribute it and/or modify it
6 # under the terms of the license (GNU LGPL) which comes with this package.
8 SIMGRID_VERSION="@SIMGRID_VERSION_STRING@"
9 SIMGRID_GITHASH="@SIMGRID_GITHASH@"
11 REAL_FORTRAN_COMPILER=@SMPI_Fortran_COMPILER@
13 INCLUDEARGS="@includeflag@"
14 CMAKE_LINKARGS="-L@libdir@"
18 list_set FFLAGS @SMPI_Fortran_FLAGS@
19 list_set LINKARGS "-lsimgrid" @SMPI_Fortran_LIBS@ "-lm"
20 if [ "x${SMPI_PRETEND_CC}" = "x" ]; then
21 list_add LINKARGS "-shared"
23 echo "Warning: smpif90 pretends to be a regular compiler (SMPI_PRETEND_CC is set). Produced binaries will not be usable in SimGrid."
29 eval $(list_get TMPFILES)
34 filter_and_compile() {
35 list_add TMPFILES "${TMPFILE}"
36 #replace "program main_name by subroutine user_main (and the end clause as well)"
37 sed 's/^\([[:space:]]*\)\([eE][nN][dD] \)\{0,1\}[pP][rR][oO][gG][rR][aA][mM][^a-zA-Z0-9]*\([a-zA-Z0-9_]*\)/\1\2subroutine user_main /g' "${ARG}" >> "${TMPFILE}"
39 list_add CMDLINE "${SRCFILE}"
44 list_set CMDLINE "${REAL_FORTRAN_COMPILER}"
45 list_add_not_empty CMDLINE "${FFLAGS}"
46 while [ $# -gt 0 ]; do
56 FILENAME=`basename ${ARG}`
57 TMPFILE=$(mymktemp "${ARG}" ".f90")
58 ORIGFILE="${FILENAME%.f90}"
62 FILENAME=`basename ${ARG}`
63 TMPFILE=$(mymktemp "${ARG}" ".F90")
64 ORIGFILE="${FILENAME%.F90}"
67 '-version' | '--version')
68 printf '%b\n' "$SIMGRID_VERSION"
71 "-git-version" | "--git-version")
72 printf '%b\n' "$SIMGRID_GITHASH"
75 '-compiler-version' | '--compiler-version')
76 ${REAL_FORTRAN_COMPILER} --version
79 list_add CMDLINE "-o$1"
84 list_add CMDLINE "${ARG}"
89 if [ $NEEDS_OUTPUT -ne 0 ]; then
90 list_add CMDLINE "-o${ORIGFILE}.o"
93 list_add_not_empty CMDLINE ${INCLUDEARGS}
94 list_add_not_empty CMDLINE ${CMAKE_LINKARGS}
95 list_add_not_empty CMDLINE "${LINKARGS}"
97 eval $(list_get CMDLINE)