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 if [ $TRACE_CALL_LOCATION -gt 0 ]; then
34 echo "#include \"/tmp/local/include/smpi/smpi_extended_traces_fortran.h\"" > ${TMPFILE}
35 echo "#line 1 \"${ARG}\"" >> ${TMPFILE}
37 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}"
39 list_add CMDLINE "${SRCFILE}"
44 list_set CMDLINE "${F77}"
45 list_add_not_empty CMDLINE "${FFLAGS}"
46 while [ $# -gt 0 ]; do
56 TMPFILE=$(mymktemp "${ARG}" ".f")
61 TMPFILE=$(mymktemp "${ARG}" ".F")
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')
76 '-trace-call-location')
78 # This should be list_add FFLAGS but it's not possible
79 # anymore: FFLAGS was already moved into CMDLINE above.
80 list_add_not_empty CMDLINE "-ffixed-line-length-none" "-cpp"
87 list_add CMDLINE "${ARG}"
92 if [ $NEEDS_OUTPUT -ne 0 ]; then
93 list_add CMDLINE "-o${ORIGFILE}.o"
96 list_add_not_empty CMDLINE ${INCLUDEARGS}
97 list_add_not_empty CMDLINE ${CMAKE_LINKARGS}
98 list_add_not_empty CMDLINE "${LINKARGS}"
100 eval $(list_get CMDLINE)