-qmakedep, -M

Category

Output control

Pragma equivalent

None.

Purpose

Creates an output file containing targets suitable for inclusion in a description file for the make command.

The output file is named with a .u suffix.

Syntax

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

Defaults

Not applicable.

Parameters

gcc (-qmakedep option only)
The format of the generated make rule to matches the GCC format: the description file includes a single target listing all of the main source file's dependencies.

If you specify -qmakedep with no suboption, or -M, the description file specifies a separate rule for each of the main source file's dependencies.

Usage

For each source file with a .c, .C, .cpp, or .i suffix named on the command line, an output file is generated with the same name as the object file and a .u suffix. Output files are not created for any other types of input files. If you use the -o option to rename the object file, the output file uses the name you specified on the -o option. See below for examples.

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

The output file contains a line for the input file and an entry for each include file. It has the general form:
file_name.o:include_file_name
file_name.o:file_name.suffix

You can also use the following option with qmakedep and -M:

-MF=file_path
Sets the name of the output file, where file_path is the full or partial path or file name for the output file. See below for examples.

Include files are listed according to the search order rules for the #include preprocessor directive, described in Directory search sequence for include files. If the include file is not found, it is not added to the .u file.

Files with no include statements produce output files containing one line that lists only the input file name.

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 create an object file named foo_obj.o and an output file named mysource.u, enter:
xlc -c -qmakedep foo_src.c -o foo_obj.o -MF mysource.u
To compile foo_src1.c and foo_src2.c to create two output files, named foo_src1.u and foo_src2.u, respectively, in the c:/tmp/ directory, enter:
xlc -c -qmakedep foo_src1.c foo_src2.c -MF c:/tmp/ 

Related information