"Let's model me a mine"
M.E.G.M.S.
Mining & Exploration Geological Modelling Services
FF08Depends is a command line tool for obtaining file dependency information for Fortran 2008 source files.
The tool itself is written in Fortran 2003. A zip archive of the latest source release (revision 3189 from 2024-08-12), available under an Apache 2.0 licence, can be found at www.megms.com.au/download/FF08Depends.zip.
The command line has the following syntax:
FF08Depends [options] source-file-specs...
Command line options:
source-file-specs is a list of the names of the Fortran source files to parse.
A source-file-spec of - directs that source file specifications will also be read from the console, one file per record. A line that is zero length or all blanks terminates the input. - may only be specified once on the command line. This feature is useful with operating system shell provided pipes between programs.
Source files with an extension (part of the filename following the last dot) of for or f are taken to be fixed source form files. Source files with an extension of f90, f95, f03 or f08 are taken to be free source form. Other extensions result in an error. The comparison with the file extension is not case sensitive.
Note that the --reverse option does not change the order in which dependencies are output (for example the compilation order is still the order that files will need to be compiled in), instead it changes the subset of files output by the analysis. Using --reverse without any root units or root files may not be usefully different from output without --reverse.
STOP codes (which may also be the program's exit code):
The dependency analysis is based on the definition and subsequent use of modules and the parent-child relationship between modules and submodules. Files that contain a program unit that USE's a module or that defines a submodule of a module depend on the file that defines the module.
The dependency analysis does not consider external procedures.
Dependency analysis errors that may be reported include circular module or file references. An example of the first case is where module A depends on (USE's) module B which depends on module C which depends back on module A. An example of the second is where module A depends on module B which depends on module C (linear), but the definitions of modules A and C are in the same file.
The analysis will accommodate some syntactical errors in the Fortran source but some syntax issues, in particular with any module statements, submodule statements or use statements, may prevent an accurate depiction of the dependencies.
Error messages are written to the error unit. Dependency analysis results are written to the console.
Perform a dependency analysis of the f90 files in the current directory:
dir /b *.f90 | FF08Depends -
or, depending on your operating system:
ls *.f90 | FF08Depends -
The source code should be compilable by a Fortran 2003 compiler.
Intel Visual Fortran 15.0 was the compiler used for development. With that compiler, the /standard-semantics switch (or its equivalent on non-Windows platforms) is required.
The "last" version of classic ifort (2021.13.0) can be used to generate working executables. However, at the time of writing, the LLVM edition of the Intel Fortran Compiler, version 2024.2.0 running on Windows cannot be used due to a runtime issue associated with the /heap-arrays0 compiler command line argument.
Note that gfortran current trunk (at the time of writing r238060) cannot be used due to PR 44265 and PR 71796.
The file compile-order.txt in the source archive specifies the order in which the included source files may be compiled.
Questions, queries and quibbles can be sent to ff08@megms.com.au.