Oracle® Solaris Studio 12.4: Fortran User's Guide

Exit Print View

Updated: March 2015
 
 

3.4.149 –xM

Generate make dependencies.

This option produces make dependencies for the compiled source file on standard output. The option covers all make dependencies for the source file, both header files and Fortran modules.

For module dependencies, this option uses an object-based module dependency scheme to eliminate the need for explicit build rules to create the module files.

This compilation cannot be used with -c, -S, -Xlist, or any other compilation options that produce different compilation outputs.

The generated dependency output does not contain any build rules, only dependencies for the files. The user will need to specify the build rules for all the files needed for the build. However, for the module files, no explicit build rules are needed, as the module files are created at the same time as the associated object files. Therefore, the module files only need to have a generic build rule:

%.mod:
        @ echo $@ is already up to date.

The module file build rule is only needed to prevent the 'make' process from stripping all the dependencies related to module files if there are no build rules for them. Other than that, the build rule does not do anything, as shown in the example above.

When used with the -keepmod option, the dependencies generated by the -xM option will prevent compilation cascade due to the unnecessarily updated modules files, as well as prevent the problem with recompilation on the same source files due to the use of the -keepmod option to prevent unnecessary updates on the module files.

This option works in conjunction with the -M, -I, and -moddir options to determine the appropriate directories for the module files needed in the build. Pre-compiled module files, for example those shipped by third parties, should be located at a directory pointed to by the -M option so the correct dependencies can be generated.