link to homepage

Institute for Advanced Simulation (IAS)

Navigation and service

f90depend Man Page


f90depend   -   Fortran 90/95 dependency checker and makefile builder


f90depend { -c[[,suboption=value] ...] ... | -u | -s } [ -I IncludeDir ] [ -f MakeFile ] [ -v ] SourceFile ...


AIX, Solaris, Tru64, Linux, IRIX and UNICOS systems


f90depend is a tool that scans Fortran 90/95 source code files and determines build dependencies that are introduced by INCLUDE statements and the usage of modules.

If option -u (update) is used, the dependency information will be written to a makefile in such a way that the make command can determine which source files must be recompiled when a include file or an entity in a module has changed. Furthermore, make can find out an appropriate compilation order for all source files from the dependency information written by f90depend.

If the `create makefile' option -c is specified, f90depend automatically creates a simple makefile for compiling the source files, and linking the resulting object files into a program.

When called with the -s option (sort), f90depend prints on standard output the names of all SourceFiles appearing on the command line in an order appropriate for compilation. In this case, no dependency information will be written.


-c[[,suboption=value] ...] Creates a new makefile for your application program. Make sure that all source files that make up your program are specified on the command line. By default, f90depend uses the name makefile for the generated file. An alternate name may be specified with the -f option. If a file named makefile (or MakeFile respectively) already exists, it will be overwritten without a message being displayed.

Valid suboptions are:

pgm=name Names the resultant executable file name instead of a.out.
comp=cmd Specifies the name of the compiler invocation command for compiling Fortran 90/95 programs. The default command name is xlf95 for AIX systems, f95 for Tru64 systems, pgf90 for Linux systems, and f90 for all others.
f90flags=comp_options Specifies options to be passed to the Fortran 90/95 compiler. If whitespace characters appear within comp_options, the string should be enclosed in single quotation marks ('comp_options'). By default, all -I options from the f90depend command line are passed to the compiler.
ldflags=link_options Specifies options to be passed to the linker (e.g.
adds the current working directory to the library search path). The default is to pass no options.
ldlibs=libraries Lists libraries to be linked with your program (e.g.
      -c,ldlibs='-ltools -lm'
selects the library files libtools.a and libm.a). Defaults to an empty list.

Makefiles created by f90depend have the following targets:

name is the first target in the makefile. It builds an up-to-date version of your program, i.e. it updates the executable file name.
clean Removes all object, .mod and core files.
depend Updates the file dependency section of the makefile.
-u Creates or updates the file dependency section of an already existing makefile. A file dependency section created by f90depend always begins with the following two lines:
	       # Everything from here on down is generated ...
If a makefile already contains such a dependency section, this section will be updated. Otherwise a file dependency section is appended to the makefile.

By default, dependency information is written to the file named makefile if it exists, otherwise Makefile. An alternate name may be specified with the -f option.

-s Prints on standard output the names of all SourceFiles appearing on the command line in an order appropriate for compilation. In this case, the -f option has no meaning.
-I IncludeDir Specifies an additional directory in which to search for files that are included using the INCLUDE statement. You can specify up to 20 search directories by repeating this option. IncludeDir can be specified as full path name or relative to the current directory. The current directory is always searched first, then any directories specified by -I options in the order that they appear on the command line.
-f Makefile Enables you to specify an alternate makefile in which to place command output. For information on the default, see the -c and -u options.
-v Displays verbose information on standard error. In detail, -v prints the version number and information about where modules are defined and where they are used. If there are modules that are defined but never used, they will be listed separately. -v also displays a message when opening the output file. (When used with the -s option, only the version number will be displayed.)
SourceFile Specifies the name of a Fortran 90 source file, which must be written in free source form. SourceFile must be a filename with .f90 suffix.


Assume you have three Fortran 90 language files x.f90, y.f90, and z.f90, where the x.f90 and z.f90 files depend on modules defined in y.f90, and where the z.f90 file also depends on a module that is defined in x.f90:
	 x.f90 <----------------- | Z.F90 +--------> y.f90 <-------+ 
  1. To append dependency information to the end of an existing makefile named that does not already contain file dependencies ( may be created by other means, e.g. by using the SDE Program Builder on AIX), enter:
    	  f90depend -u -f x.f90	y.f90 z.f90
    The file dependency section appended to might look like this:
    	  > # Everything from here on down is generated	by f90depend
    	  > # so do NOT	add any	translation rules below	here.
    	  > #--- Module-Dependencies
    	  > x.o: y.o
    	  > z.o: y.o x.o
  2. To create a new makefile for building an executable program named myprog, enter:
    	  f90depend -c,pgm=myprog x.f90	y.f90 z.f90
  3. If you want to produce a makefile that compiles your program for debugging using another compiler (e.g. the NAGware Fortran 95 compiler on AIX), enter:
    	  f90depend -c,pgm=myprog,comp=nagf95,f90flags=-g \
    	     x.f90 y.f90 z.f90
    	  f90depend -c,pgm=myprog -c,comp=nagf95 \
    	     -c,f90flags=-g x.f90 y.f90	z.f90
  4. To compile the source files, and link the resulting object files into an executable program without using a makefile, you could specify:
    	  f90 -o myprog	`f90depend -s x.f90 y.f90 z.f90`
    This command compiles the three source files in the order y.f90, x.f90, z.f90.
  5. If only a file containing the module usage information provided by the -v option should be created, use a command like:
    	  f90depend -v -u -f /dev/null *.f90 2>mxref.txt




Please report any bugs to `'.


Günter Egerer, Juliane Richter, Forschungszentrum Jülich

version 1.2April 2007F90DEPEND(l)

Forschungszentrum Jülich
D-52425 Jülich
Div. Application Support
Key Technologies Imprint
Günter Egerer