-qmakedep

Category

Output control

@PROCESS

None.

Purpose

Produces a dependency output file containing targets suitable for inclusion in a description file for the make command.

The dependency output file is named with a .d suffix.

-qmakedep is the long form of -M.

Syntax

Read syntax diagramSkip visual syntax diagram
>>- -q--makedep--+--------+------------------------------------><
                 '-=--gcc-'   

Defaults

Not applicable.

Parameters

gcc
The format of the generated make rule to match the GCC format: the dependency output file includes a single target that lists all of the source file's dependencies.

If you specify -qmakedep with no suboption, the dependency output file specifies a separate rule for each of the source file's dependencies.

Usage

The make command uses dependency information to determine the compilation order of the files. The make command also uses the dependency information to determine the minimum set of files that must be recompiled when a file is changed.

XL Fortran recognizes the following types of source file dependencies:
  • Dependencies on the files that are included through C preprocessor #include directives.
  • Dependencies on the files that are included through the Fortran INCLUDE directive.
  • Dependencies on the module symbol files in the files that use or extend one or more Fortran modules.
  • Fortran 2008 beginsDependencies on the submodule symbol files in the files that extend one or more Fortran submodules.Fortran 2008 ends

For each source file that is named on the command line, a dependency output file is generated with the same name as the object file but with a .d suffix. Dependency output files are not created for any other types of input files. If you use the -o option to rename the object file, the name of the dependency output file is based on the name specified in the -o option. For more information, see the Examples section.

The dependency output files generated by these options are not make description files; they must be linked before they can be used with the make command. For more information about this command, see your operating system documentation.

If the -qfullpath option is also specified, the absolute path names of the source and include files are recorded in the dependency output file.

You can also use -qmakedep with the following options:

-MF file_path
Sets the name of the dependency output file, where file_path is the full or partial path or file name for the dependency output file. For more information, see -MF.
-MT target
Specifies the target name of the object file in the make rule in the generated dependency file. For more information, see -MT.

Examples

Example 1: To compile mysource.f and create a dependency output file named mysource.d, enter:
xlf -c -qmakedep mysource.f
Example 2: To compile source.f and create an object file named object.o and a dependency output file named object.d, enter:
xlf -c -qmakedep source.f -o object.o
Example 3: If you have the following files in the current working directory:
  • options.h
  • constants.h
  • n.F
  • m.f
The options.h file contains following code:
@PROCESS free(f90)
The constants.h file contains following code:
real(4), parameter :: pi = 3.14
The n.F file contains following code:
#include "options.h"
module n
contains
  subroutine my_print(x)
    real, value :: x
    print *, x
  end subroutine
end module
The m.f file contains following code:
#include "options.h"
module m
  use n
contains
  subroutine sub
    implicit none
    include 'constants.h'
    call my_print(pi)
  end subroutine
end module
To compile n.F and create a dependency output file named n.d in the ./dependencies directory, enter:
xlf -c n.F -qmakedep -MF./dependencies -o n_obj.o
To compile m.f and create a dependency output file named m.d in the ./dependencies directory, and also to include path information /home/user/sample/ as part of the target name of the object file in the m.d file, enter:
xlf -c m.F -qmakedep -MF./dependencies -MT '/home/user/sample/m.o'
The generated n.d file is as follows:
n_obj.o n.mod: options.h
n_obj.o n.mod: n.F
The generated m.d file is as follows:
/home/user/sample/mysource.o m.mod: n.mod
/home/user/sample/mysource.o m.mod: option.h
/home/user/sample/mysource.o m.mod: mysource.f
/home/user/sample/mysource.o m.mod: constants.h

Related information