makedepend - Generate source dependency information

Format

  • makedepend [-S directory] [-W m,option[,option]...]... sourcefile [(sourcefiles)]...
  • makedepend [-s directory]
  • makedepend [-W m,a]
  • makedepend [-W m,c89 | -W m,cc]
  • makedepend [-W m,file(MakeFile) | -W m,f(MakeFile)]
  • makedepend [-W m,list(FileName) | -W m,lis (FileName)]
  • makedepend [-W m,o(ObjSuffix)]
  • makedepend [-W m,p(ObjPrefix)]
  • makedepend [-W m,s(String)]
  • makedepend [-W m,showinc | -W m,show]
  • makedepend [-W m,type(c|C(t1,t2,...)) | -W m,t(c|C(t1,t2,...))]
  • makedepend [-W m,V(OSVvRr) | -W m,V(zOSVvRr)]
  • makedepend [-W m,w(Width)]

For z/OS® UNIX makedepend [c89|cc|c++options]:

  • makedepend [+-]
  • makedepend [-D name[=value]]
  • makedepend [-Idir1[,dir2]...]
  • makedepend [-0, -O (-1), -2, -3]
  • makedepend [-U name]
  • makedepend [-W phase,option[,option]...]

Description

As of z/OS V1R11, consider using the z/OS XL C/C++ -qmakedep compiler option instead of the makedepend tool. The -qmakedep compiler option improves the accuracy of source dependency information and is intended to replace the stand-alone makedepend tool. For more information about -qmakedep, see z/OS XL C/C++ User's Guide.

The makedepend tool is used to analyze source files and determine source dependencies. makedepend calls files, which are directly or indirectly included by a source file, "dependencies." If the makedepend W m,-list option is specified, this tool produces a listing file with the following topics:
  • The list of compiler options and variables applied to all C source.
  • The list of compiler options and variables that are applied to all C++ source.
  • The list of makedepend options applied.
  • The list of include and source search paths.
  • Messages.
  • Message summary.
  • Statistics (in other words, total number of source files processed, number of ignored sources files, and so forth).

Options

-S directory
Specifies the directory or directories where you can locate the source files. The default location for source files is the current directory, "./".
-W m,a
Instructs makedepend to append the source dependencies to the end of the makefile rather than replacing any existing ones. If -W m,a is not specified, then makedepend will erase any source dependencies after the marker line and write the new determined source dependencies instead. If there are no existing makefiles, then this option is ignored.
-W m,c89 | -W m,cc
Instructs makedepend to use either the c89 or the cc compiler mode for the c source files. The c89 mode is the default. The c89/cc mode is overridden if the c++ [+-] option is specified.
-W m,file(MakeFile) | -W m,f(MakeFile)
Specifies the name of the makefile to which makedepend writes the determined source dependencies. If this option is specified on the makedepend command line, then the string value of the MakeFile is used as the name for the makefile. Otherwise, makedepend will search in the current directory for a file named "makefile". If no "makefile" exists, then makedepend searches for a file named "Makefile". If no "Makefile" exists, then makedepend creates a new file with the name "makefile" in the current directory and writes the default marker string (see -W m, s(String)) at the beginning of the new file. If file (./) is specified, the option is ignored silently.
-W m,list(FileName) | -W m,lis (FileName)
Instructs makedepend to generate a listing file with the specified FileName name. The name depend.1st is the default file name if FileName is not specified with the -W m,list option. If -W m,list(./) is specified, the default listing file name (depend.lst) is used. If the -W m,list option is not specified, listings are not generated.
-W m,o(ObjSuffix)
Specifies a suffix (file name extension) for the object file names in the source file dependencies. If the environment variable {_OSUFFIX} is defined, then its value will be the default. If it is not defined, the default suffix is o.
-W m,p(ObjPrefix)
Prefixes object file names in the source dependencies with a path name. The default object file name prefix is an empty string.
-W m,s(String)
Specifies a new string literal to be used as a marker in the output makefile. All source dependencies are placed after that marker. The default marker string value is "# DO NOT DELETE THIS LINE, makedepend depends on it." If the -W m,s(String) is specified on the makedepend command line, then the marker line and anything after it will be erased from the output makefile, the new marker string literal will be written instead, and the newly determined source dependencies will be written after the new marker line. If both -W m,a and -W m,s(String) are specified on the makedepend command line, then -W m,s(String) will be ignored if a makefile exists.
-W m,showinc | -W m,show
Instructs makedepend to report on the include files for each source file. The include files are reported in the includes topic of the listing file. If the -W m,showinc option is specified, the list option is automatically turned on. If the -W m,showinc option is not specified, the include file list will not be reported.
-W m,type(c|C(t1,t2,...)) | -W m,t(c|C(t1,t2,...))
Instructs makedepend to treat source files with any file name type that belong to the set {t1,t2,...} as either c source files if the c is used with the type, or as C++ source files if the C is used. Default types are as follows:
  • Any source file with a file name extension of c will be treated as a c source file. If the -W m,type(c(t1,t2,...)) option is specified on the makedepend command line, then any source file with a file name extension that belongs to the set {c, t1, t2,...} will be treated as a c file. Notice that the types {t1,t2,...} that are specified with the -W m,type option are added to the default c file name extension type.
  • Any source file with a file name extension of C, cpp, or cxx will be treated as a C++ source file. If the -W m,type(C(t1,t2,...)) option is specified on the makedepend command line, then any source file with a file name extension that belongs to the set {C, CPP, cpp, CXX, cxx, t1, t2,...} is treated as a C++ file. Notice that the types {t1,t2,...} that are specified with the -W m,type option are added to the default {C,CPP,cpp,CXX,cxx} file name extension types.
  • If both -W m,type(c(...)) and -W m,type(C(...)) options are specified on the makedepend command line with conflicting file name types, then whichever option is specified last becomes the overriding value, including the default file types. For example, when both -W m,type(c(t1,t2)) and -W m,type(C(c,t1,t3) are specified, only files with extension t2 will be treated as c files and files with extensions {c, C, cpp, Cpp, cxx, CXX, t1, t3} will be treated as C++ files. When -W m,type(c(cpp,t1,t2)) and -W m,type(C(t1,t2)) options are specified, files with extensions {c, cpp} will be treated as c source files and files with extensions {C, CPP, cxx, CXX, t1, t2} will be treated as C++ source files.
For C source files, if the environment variables {_CSUFFIX} and {_CSUFFIX_HOST} are defined, the variable value updates the default value. The default C source file extension is c.

For C++ source file, if the environment variables {_CXXSUFFIX} and {_CXXSUFFIX_HOST} are defined, its value updates the default value. The default C++ source file extensions are {C, CPP, cpp, CXX, cxx}. For example, if {_CXXSUFFIX} is defined as {cdd} and the default C++ source file extensions are {C, CPP, cpp, CXX, cxx}, then the resulting set would be {C, CPP, cpp, CXX, cxx, cdd}.

-W m,V(OSVvRr) | -W m,V(zOSVvRr)
Specifies the compiler version that will be used, where v and r represent the compiler's version and release respectively. The default version is the current C/C++ compiler version if {_CVERSION} is not defined. If {_CVERSION} is defined, then its value is used as the default compiler version. This option is used to set the _COMPILER_VER_ macro.
-W m,w(Width)
Sets the maximum line width of the output source dependencies lines. The default value is 78.

The following options correspond to the z/OS UNIX c89,cc,c++ compiler options.

-+
Specifies that all source files are to be recognized as C++ source files. All file.s, file.o, and file.a files will continue to be recognized as assembler source, object, and archive files respectively. However, any C file.c or file.i files will be processed as corresponding C++ file.C or file.i files, and any other file suffix which would otherwise be unrecognized will be processed as a file.C file.
-D name[=value]
Defines a C or C++ macro for use in compilation. If only name is provided, a value of 1 is used for the macro it specifies.
-Idir1[,dir2] ...
Note: The -I option is an uppercase i, not a lowercase L.
-I specifies the directories to be used during compilation in searching for include files (also called header files).

Absolute path names specified on #include directives are searched exactly as specified. The directories specified using the -I option or from the usual places are not searched.

If absolute path names are not specified on #include directives, then the search order is as follows:

  1. Include files enclosed in double quotes (") are first searched for in the directory of the file containing the #include directive. Include files enclosed in angle-brackets (< >) skip this initial search.
  2. The include files are then searched for in all directories specified by the -I option, in the order specified.
  3. Finally, the include files are searched for in the usual places. (See Usage Note 1 for a description of the usual places.)
You can specify an MVS data set name as an include file search directory. Also, MVS data set names can explicitly be specified on #include directives. You can indicate both by specifying a leading double slash (//). For example, to include the include file DEF that is a member of the MVSPDS ABC.HDRS, code your C or C++ source as follows:
#include <//'abc.hdrs(def)'>
MVS data set include files are handled according to z/OS XL C/C++ compiler conversion rules (see Usage Note 1).. When specifying an #include directive with a leading double slash (in a format other than #include<//'dsname'> and #include<//dd:ddname>), the specified name is paired only with MVS data set names specified on the -I option. That is, when you explicitly specify an MVS data set name, any hierarchical file system directory names specified on the -I option are ignored.
-0, -O (-1), -2, -3
Specifies the level of compiler optimization (including inlining) to be used. The level -1 (number one) is equivalent to -O (letter capital O). The level -3 gives the highest level of optimization. The default is -0 (level zero), no optimization and no inlining, when not using IPA (Interprocedural Analysis).
-Uname
Undefines a C or C++ macro specified with name. This option affects only macros defined by the -D option, including those automatically specified by c89/cc/c++.
-Wphase,option[,option]...
Specifies options to be passed to the steps associated with the compile, assemble, or link-editing phases of c89/cc/c++. The valid phase codes are:
0
Specifies the compile phase (used for both non-IPA and IPA compilation).
c
Same as phase code 0.
I
Enables IPA (Interprocedural Analysis) optimization.
Note: I is an uppercase i, not a lowercase L.
Unlike other phase codes, the IPA phase code I does not require that any additional options be specified, but it does allow them. In order to pass IPA suboptions, specify those suboptions using the IPA phase code. For example, to specify that an IPA compile should save source line number information, without writing a listing file, specify:
c89 -W I,list file.c
To specify that an IPA link-edit should write the map file to stdout, specify:
c89 -W I,map file.o
Note: c89/cc/c++ options other than the ones listed are ignored by makedepend.

Any compiler option can be passed to makedepend through the -W option. For more information about the compiler options, see z/OS XL C/C++ User's Guide.

Examples

  1. makedepend file1.c file2.c
    Imagine you are compiling two files, file1.c and file2.c, and each includes the header file header.h. The header.h file includes the files def1.h and def2.h. When you run the command makedepend file1.c file2.c, makedepend parses file1.c and consequently, header.h, and then def1.h and def2.h. It then decides that the dependencies for this file are:
    • file1.o: header.h def1.h def2.h
    • file2.o: header.h def1.h def2.h
  2. Imagine you are compiling a file, file1.c, and it includes the header file header.h. The header.h file includes the files def1.h and def2.h. When you run the command makedepend file1.c, makedepend parses file1.c and consequently, header.h, and then def1.h and def2.h. It then decides that the dependencies for this file are:
    file1.o: header.h def1.h def2.h

Environment variables

makedepend uses the following environment variables.

{_ACCEPTABLE_RC}
Used by c89/cc/c++ to determine the maximum allowed return code (result) of any step (compile, assemble, IPA link, prelink, or link-edit). If the result is between zero and this value (inclusive), then it is treated internally by makedepend exactly as if it were a zero result. The default value is 4.
{_CLASSLIB_PREFIX}
Provides a prefix for the data sets used during the compilation and execution phases. For makedepend, the focus is the {_CLASSLIB_PREFIX}.SCLBH.+ data set that contains the z/OS C/C++ Class Library include files.
{_CSUFFIX}
Used by c89/cc/c++ to recognize a C source file. The default value is c.
{_CSUFFIX_HOST}
Used by c89/cc/c++ to recognize a C source file. The default value is C.
{_CXXSUFFIX}
Used by c++ to recognize a C++ source file. The default is C. This variable is only supported by the c++ command.
{_CXXSUFFIX_HOST}
Used by c++ to recognize a C++ source data set. The default is CXX. This variable is only supported by the c++ command.
{_CSYSLIB}
Used for system library data set concatenation, which resolves #include directives during compilation.
{_INCDIRS}
Provides directories used by c89/cc/c++ as a default place to search for include files during compilation (after searching {_INCDIRS} and before searching {_CSYSLIB}).
{_INCLIBS}
The directories used by c89/cc/c++ as a default place to search for include files during compilation (after searching {_INCDIRS} and before searching {_INCLIBS} and {_CSYSLIB}).
{_OSUFFIX}
Provides a suffix by which c89/cc/c++ recognizes an object file.
{_CVERSION}
The version of the C/C++ compiler to be invoked by c89/cc/c++. The setting of this variable allows c89/cc/c++ to control which C/C++ compiler program is invoked. It also sets default values for other environment variables. The format of this variable is the same as the result of the Language Environment® C/C++ Run-Time Library function _librel(). The default value is the result of the C/C++ Run-Time library _librel() function. Actual variable names are: _C89_CVERSION, _CC_CVERSION, _CXX_CVERSION
{NO_CMDOPTS}
Controls how the compiler processes the default options set by c89. Setting this variable to 1 reverts the compiler to the behavior that was available prior to z/OS V1R5, when the compiler was unable to distinguish between the c89 defaults and the user-specified options. Setting this variable to 0 (zero) results in the default behavior where the compiler is now able to recognize c89 defaults. The default value is: 0 (zero). Actual variable names are: _C89_NO_CMDOPTS, _CC_NO_CMDOPTS, _CXX_NO_CMDOPTS

Localization

makedepend uses the LC_ALL localization environment variable, which specifies the locale to be used to override any values for locale categories specified by LANG or certain LC_ variables.

Usage notes

  1. MVS data sets may be used as the usual place to resolve C and C++ #include directives during compilation.

    Such data sets are installed with Language EnvironmentLanguage Environment. When it is allocated, searching for these include files can be specified on the -I option as //DD:SYSLIB. (See the description of environment variable {_CSYSLIB} for information.

    When include files are MVS PDS members, z/OS XL C/C++ uses conversion rules to transform the include (header) file name on a #include preprocessor directive into a member name. If the "//'dataset_prefix.+'" syntax is not used for the MVS data set which is being searched for the include file, then this transformation strips any directory name on the #include directive, and then takes the first 8 or fewer characters up to the first dot (.).

    If the "//'dataset_prefix.+'" syntax is used for the MVS data set which is being searched for the include file, then this transformation uses any directory name on the #include directive, and the characters following the first dot (.), and substitutes the "+" of the data set being searched with these qualifiers.

    In both cases the data set name and member name are converted to uppercase and underscores (_) are changed to at signs (@).

    If the include (header) files provided by Language EnvironmentLanguage Environment are installed into the hierarchical file system in the default location (in accordance with the {_INCDIRS} environment variable), then the compiler will use those files to resolve #include directives during compilation. c89/cc/c++ by default searches the directory /usr/include as the usual place, just before searching the data sets just described. See the description of environment variables {CSYSLIB}, {_INCDIRS}, and {_INCLIBS} for information about customizing the default directories to search.

  2. Feature test macros control which symbols are made visible in a source file (typically a header file). c89/cc/c++ automatically defines the following feature test macros along with the errno macro, according to whether or not cc was invoked.
    • Other than cc
      • -D "errno=(*__errno())"
      • -D _OPEN_DEFAULT=1
    • cc
      • -D "errno=(*__errno())"
      • -D _OPEN_DEFAULT=0
      • -D _NO_PROTO=1

    c89/cc/c++ add these macro definitions only after processing the command string. Therefore, you can override these macros by specifying -D or -U options for them on the command string.

  3. For options that have option-arguments, the meaning of multiple specifications of the options is as follows:
    -D
    All specifications are used. If the same name is specified on more than one -D option, only the first definition is used.
    -I
    All specifications are used. If the same directory is specified on more than one -I option, the directory is searched only the first time.
    -U
    All specifications are used. The name is not defined, regardless of the position of this option relative to any -D option specifying the same name.
    -W
    All specifications are used. All options specified for a phase are passed to it, as if they were concatenated together in the order specified.

Exit values

0
Successful completion
4
Warning error detected

Related information

c89, cc, c++, make