-qmakedep, -MD (-qmakedep=gcc)
Category
Pragma equivalent
None.
Purpose
Produces the dependency files that are used by the make tool for each source file.
The dependency output file is named with a .d suffix.
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 main source file's dependencies.
- This suboption is equivalent to -MD.
If you specify -qmakedep with no suboption, the dependency output 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 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.
file_name.o:include_file_name
file_name.o:file_name.suffix
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 .d file.
Files with no include statements produce dependency output files that contain one line listing only the input file name.
Predefined macros
None.
Examples
xlc -c -qmakedep mysource.c
xlc -c -qmakedep foo_src.c -MF mysource.d
xlc -c -qmakedep foo_src.c -MF deps/mysource.d
xlc -c -qmakedep foo_src.c -o foo_obj.o
xlc -c -qmakedep foo_src.c -o foo_obj.o -MF mysource.d
xlc -c -qmakedep foo_src1.c foo_src2.c
Related information
- -o
- Directory search sequence for include files
- The -M, -MD, -MF, -MG, -MM, -MMD, -MP, -MQ, and -MT options that GCC provides. For details, see the GCC online documentation at http://gcc.gnu.org/onlinedocs/.