3 # Copyright (c) 2012-2017. 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@"
12 F77=@SMPI_Fortran_COMPILER@
14 INCLUDEARGS="@includeflag@"
15 CMAKE_LINKARGS="-L@libdir@"
19 list_set FFLAGS @SMPI_Fortran_FLAGS@
20 list_set LINKARGS "-shared" "-lsimgrid" @SMPI_Fortran_LIBS@ "-lm"
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 \"@includedir@/smpi/smpi_extended_traces_fortran.h\"" > ${TMPFILE}
35 echo "#line 1 \"${ARG}\"" >> ${TMPFILE}
37 sed 's/[[:space:]]\{6\}[[:space:]]*\([eE][nN][dD] \)\{0,1\}[pP][rR][oO][gG][rR][aA][mM][[:space:]]*\([a-zA-Z0-9\-\_]*\)/ \1subroutine user_main /g;s/[[:space:]]*[uU][sS][eE][[:space:]]*[mM][pP][iI]/\include \"mpif\.h\" /g' "${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"
84 list_add CMDLINE "-o$1"
88 list_add CMDLINE "${ARG}"
93 if [ $NEEDS_OUTPUT -ne 0 ]; then
94 list_add CMDLINE "-o${ORIGFILE}.o"
97 list_add_not_empty CMDLINE ${INCLUDEARGS}
98 list_add_not_empty CMDLINE ${CMAKE_LINKARGS}
99 list_add_not_empty CMDLINE "${LINKARGS}"
101 eval $(list_get CMDLINE)