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 F90=@SMPI_Fortran_COMPILER@
13 INCLUDEARGS="@includeflag@"
14 CMAKE_LINKARGS="-L@libdir@"
18 list_set FFLAGS @SMPI_Fortran_FLAGS@
19 list_set LINKARGS "-shared" "-lsimgrid" @SMPI_Fortran_LIBS@ "-lm"
24 eval $(list_get TMPFILES)
29 filter_and_compile() {
30 list_add TMPFILES "${TMPFILE}"
31 #replace "program main_name by subroutine user\_main (and the end clause as well)"
32 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}"
34 list_add CMDLINE "${SRCFILE}"
39 list_set CMDLINE "${F90}"
40 list_add_not_empty CMDLINE "${FFLAGS}"
41 while [ $# -gt 0 ]; do
51 ORIGFILE="${ARG%.f90}"
52 TMPFILE=$(mymktemp "${ARG}" ".f90")
56 ORIGFILE="${ARG%.F90}"
57 TMPFILE=$(mymktemp "${ARG}" ".F90")
60 '-version' | '--version')
61 printf '%b\n' "$SIMGRID_VERSION"
64 "-git-version" | "--git-version")
65 printf '%b\n' "$SIMGRID_GITHASH"
68 '-compiler-version' | '--compiler-version')
72 list_add CMDLINE "-o$1"
77 list_add CMDLINE "${ARG}"
83 if [ $NEEDS_OUTPUT -ne 0 ]; then
84 list_add CMDLINE "-o${ORIGFILE}.o"
87 list_add_not_empty CMDLINE ${INCLUDEARGS}
88 list_add_not_empty CMDLINE ${CMAKE_LINKARGS}
89 list_add_not_empty CMDLINE "${LINKARGS}"
91 eval $(list_get CMDLINE)