MAKEDEP

Category

Compiler output

Pragma equivalent

None.

Purpose

Produces the dependency files that are used by the make utility for each source file.

Note: This option is only supported using -q syntax. Specifying -qmakedep without suboptions is equivalent to the -M option, but it behaves differently when specified with a suboption. For more information about the -M option, see Flag options syntax.

Syntax

Read syntax diagramSkip visual syntax diagram-qmakedep =gccpponly

Defaults

Not applicable.

Parameters

gcc
Instructs the compiler to produce make dependencies file format with a single make rule for all dependencies.
pponly
Instructs the compiler to produce only the make dependencies file without generating an object file, with the same make file format as the format produced with the gcc suboption.

Usage

For each C/C++ source file specified on the command line, an output file is generated with the same name as the object file and the suffix replaced with the suffix for the make dependencies file. The default suffix for the make dependencies file is .u. It can be customized using the usuffix attribute in the xlc utility configuration file.

The option only applies to C/C++ sources in z/OS® UNIX files, because MVS™ data sets do not have a time stamp required for make utility processing.

If the -o option is used to rename the object file, the output file uses the name you specified on the -o option.

When -M or -qmakedep without suboption is specified, the description file contains multiple make rules, one for each dependency. It has the general form:
file_name.o: file_name.suffix
file_name.o: include_file_name
When -qmakedep=gcc or -qmakedep=pponly is specified, the description file contains a single make rule for all dependencies. It has the form:
file_name.o: file_name.suffix \
 include_file_name 

Include files are listed according to the search order rules for the #include preprocessor directive. If an include file is not found, it is not added to the .u file, but if the -MG flag option is used, it includes the missing file into the output file. Files with no include statements produce output files containing one line that lists only the input file name.

You can use the -qmakedep or -M option with the following flag options:
-MF <file_name>
Sets the name of the make dependencies file, where file_name is the file name, full path, or partial path for the make dependencies file.
-MG
When used with the -qmakedep=pponly option, -MG instructs the compiler to include missing header files into the make dependencies file and suppress diagnostic messages about missing header files.
-MT <target_name>
Sets the target to the <target_name> rather than the object file name.
-MQ <target_name>
-MQ is the same as -MT except that -MQ escapes any characters that have special meaning in make.

For more information about the -MF, -MG, -MT, and -MQ options, see Flag options syntax.

IPA effects

None.

Predefined macros

None.

Examples

To compile mysource.c and create an output file named mysource.u, enter:
xlc -c -qmakedep mysource.c
To compile foo_src.c and create an output file named mysource.u, enter:
xlc -c -qmakedep foo_src.c -MF mysource.u
To compile foo_src.c and create an output file named mysource.u in the deps/ directory, enter:
xlc -c -qmakedep foo_src.c -MF deps/mysource.u
To compile foo_src.c and create an object file named foo_obj.o and an output file named foo_obj.u, enter:
xlc -c -qmakedep foo_src.c -o foo_obj.o
To compile foo_src.c and produce a dependency output file format with a single make rule for all dependencies, enter:
xlc -c -qmakedep=gcc foo_src.c
To compile foo_src.c and produce only the dependency output file without generating an object file, enter:
xlc -c -qmakedep=pponly foo_src.c