3 # Copyright (c) 2012-2018. 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 if [ "x${SMPI_PRETEND_CC}" = "x" ]; then
20 list_add LINKARGS "-shared"
22 list_set LINKARGS "-lsimgrid" @SMPI_Fortran_LIBS@ "-lm"
27 eval $(list_get TMPFILES)
32 filter_and_compile() {
33 list_add TMPFILES "${TMPFILE}"
34 #replace "program main_name by subroutine user\_main (and the end clause as well)"
35 sed 's/[[:space:]]*[pP][rR][oO][gG][rR][aA][mM][[:space:]]*\([a-zA-Z0-9\-\_]*\)/ subroutine user\_main /g' "${ARG}" > "${TMPFILE}"
37 list_add CMDLINE "${SRCFILE}"
42 list_set CMDLINE "${REAL_FORTRAN_COMPILER}"
43 list_add_not_empty CMDLINE "${FFLAGS}"
44 while [ $# -gt 0 ]; do
54 FILENAME=`basename ${ARG}`
55 TMPFILE=$(mymktemp "${ARG}" ".f90")
56 ORIGFILE="${FILENAME%.f90}"
60 FILENAME=`basename ${ARG}`
61 TMPFILE=$(mymktemp "${ARG}" ".F90")
62 ORIGFILE="${FILENAME%.F90}"
65 '-version' | '--version')
66 printf '%b\n' "$SIMGRID_VERSION"
69 "-git-version" | "--git-version")
70 printf '%b\n' "$SIMGRID_GITHASH"
73 '-compiler-version' | '--compiler-version')
74 ${REAL_FORTRAN_COMPILER} --version
77 list_add CMDLINE "-o$1"
82 list_add CMDLINE "${ARG}"
87 if [ $NEEDS_OUTPUT -ne 0 ]; then
88 list_add CMDLINE "-o${ORIGFILE}.o"
91 list_add_not_empty CMDLINE ${INCLUDEARGS}
92 list_add_not_empty CMDLINE ${CMAKE_LINKARGS}
93 list_add_not_empty CMDLINE "${LINKARGS}"
95 eval $(list_get CMDLINE)