3 # Copyright (c) 2012-2015. The SimGrid Team.
6 # This program is free software; you can redistribute it and/or modify it
7 # under the terms of the license (GNU LGPL) which comes with this package.
9 SIMGRID_VERSION="@SIMGRID_VERSION_STRING@"
10 SIMGRID_GITHASH="@SIMGRID_GITHASH@"
14 INCLUDEARGS="@includeflag@"
15 CMAKE_LINKARGS="-L@libdir@"
19 list_set FFLAGS "-ff2c" "-fno-second-underscore"
20 list_set LINKARGS "-lsimgrid" "-lm" "-lgfortran"
25 eval $(list_get TMPFILES)
30 filter_and_compile() {
31 list_add TMPFILES "${TMPFILE}"
32 #replace "program main_name by subroutine user\_main (and the end clause as well)"
33 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}"
35 list_add CMDLINE "${SRCFILE}"
39 list_set CMDLINE "${F77}"
40 list_add_not_empty CMDLINE "${FFLAGS}"
41 while [ $# -gt 0 ]; do
51 TMPFILE=$(mymktemp "${ARG}" ".f")
56 TMPFILE=$(mymktemp "${ARG}" ".F")
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')
76 list_add CMDLINE "${ARG}"
81 if [ $NEEDS_OUTPUT -ne 0 ]; then
82 list_add CMDLINE "-o${ORIGFILE}.o"
85 list_add_not_empty CMDLINE ${INCLUDEARGS}
86 list_add_not_empty CMDLINE ${CMAKE_LINKARGS}
87 list_add_not_empty CMDLINE "${LINKARGS}"
89 eval $(list_get CMDLINE)