MEGMS logo - go to the home page
  1. Home

    1. MEGS_Log

    2. CoalLog tools

    3. Fortran Tools

      1. FF08Depends

      2. FF08Diff

      3. FF08FixedFormForEver

      4. FF08Obfuscate

      5. Internal test utilities

      6. aniso_varying_string

      7. Direct2D API bindings

      8. Fortran shared pointers

    4. Contact Us

  2. Site map

"Let's model me a mine"

M.E.G.M.S.


Mining & Exploration Geological Modelling Services

Parent topic Home topic Next topic

FF08Depends

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.

How to use

The command line has the following syntax:

FF08Depends [options] source-file-specs...

Command line options:

-? or --help
Display command line and program usage help, then exit.
--version
Display program version information, then exit.
-t or --tree
Display the dependency tree rather than the dependency order. The optional argument specifies the format for the tree. The default format is make, which is a format that is suitable for many "make" programs. The other available format is dot, which specifies a format suitable as input into the dot graph tool (graphviz).
--list[:] file
Specify a list file - each record from the given file will be added (in addition to any source file specifications provided on the command line) to the list of source file specifications to be processed. May be specified multiple times.
--root-unit[:] unit
Specify the name of a main program module or submodule program unit, the file that contains the definition of the unit will be a root node of the dependency analysis. To nominate a submodule the name is in the form of a parent-identifier - the ancestor module of the submodule, followed by a colon, followed by the name of the submodule. May be specified multiple times to have multiple dependency roots.
--root-file[:] file
Specify the name of a file (not a file spec) that will be a root node of the dependency analysis. May be specified multiple times to have multiple dependency roots.
--reverse
Reverse the meaning of a root unit or root file from the default, such that files listed as a consequence of a root file or unit are the file that consume modules defined by the root file or unit.
--forward
Use the default meaning of a root unit or root file, such that the files listed as a consequence of a root unit or root file are the files that define modules that are ultimately used by the root unit or file. Currently the only practical difference this option makes is that it results in an error if the --reverse option is also specified.
--submodules
Include files containing submodules that are descendants of modules in the dependency chain. Applicable only if the default meaning of a root unit or root file is in effect (as implied by --forward).
@response-file
Nominates a response file with additional arguments and options. Each argument or option in a response file place should be in its own record. Options and arguments in response files are expanded as they are encountered into the total set of options and arguments for the program. Multiple response files may be specified, and response files may reference other response files, but a response file reference may not be recursive.

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):

no code:
Program completed successfully. This will be reported by most processors back to the operating system as an exit code of zero. (I did what you asked.)
2
Dependency analysis commenced, but with errors. (I know what you want me to do, but I couldn't do it.)
3
There was a problem with the command line arguments. (I haven't got a clue what you want to do.)

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.

Examples

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 -

Building from source

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.

Feedback

Questions, queries and quibbles can be sent to ff08@megms.com.au.