Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ makedepend(cmds) — Sprite KS.390

Media Vault

Software Library

Restoration Projects

Artifacts Sought

MAKEDEPEND  —  User Commands

NAME

makedepend − Generate dependency list for make

SYNOPSIS

makedepend [options] file file ...

OPTIONS

−D defDefine a macro.  This argument has the same meaning as the corresponding argument to cc. 

−f makefileUse makefile as the makefile to modify.  If makefile is “−”, makedepend will simply print dependency information on standard output.  Makefile defaults to makefile if it exists, otherwise Makefile. 

−I includeDirSearch for include files in includeDir before looking in the default system directories.  If there are many −I arguments, the directories are searched in the same order as the arguments. 

−m tmUse tm as the target machine for generating dependencies.  The target machine determines where makedepend looks for machine-dependent header files (see below).  If this option is not specified, the target machine defaults to the value of the $MACHINE environment variable. 

−o suffixUse suffix as the suffix for the “object” files listed in the output.  If this argument is not specified, the suffix defaults to .o. 

−pOutput the full path name for each include file.  If this switch isn’t specified, then only the include file name given in the #include statement is output. 

−s stringIf this switch is given, string specifies the comment string that identifies the beginning of dependencies in the makefile.  String must start with the comment character “#”. 

−vVerbose mode.  For each file included by one of the files, output a sequence of comment lines that list the other include files included by that include file. 

−w widthTry to arrange for output lines not to contain more than width characters total.  If a single file has multiple dependencies then they will be grouped onto a single line in the output file unless this grouping would cause the output line to exceed width characters in length. 
 

DESCRIPTION

Makedepend is a program that generates dependency lines for makefiles.  It reads a collection of C source files given by the file arguments and generates a collection of lines each having the form file.o:   x.h   y.h   /a/b/c.h

These dependency lines describe all of the include files used directly or indirectly in compiling each source file. 

Makedepend normally inserts the dependency lines into the file makefile if it exists, or Makefile otherwise (see the −f option for other alternatives).  To insert the dependencies in a makefile, makedepend searches the makefile for a trigger line.  Usually the trigger line is # DO NOT DELETE THIS LINE -- make depend depends on it.

but a different trigger string may be selected with the −s switch.  Makedepend locates the trigger line, deletes all of the information after the trigger line, and replaces it with the dependency lines.  A backup copy of the original makefile is saved in makefile.bak~, where makefile is the name of the original makefile. 

Makedepend duplicates the actions of cc in determining which include files are required for each file.  It normally checks for include files in the current directory, then in /sprite/lib/include, then in /sprite/lib/include/tm.md (where tm is the target machine being compiled for;  this is either the value of the $MACHINE environment variable or the value given in the −m option).  If −I options are given, then those directories are searched before the standard system directories.  Makedepend processes conditional compilation statements such as #define and #ifdef in a fashion similar to the C preprocessor in order to consider only the include files that would be processed by the C compiler.  You should pass the same −D options to makedepend that you would give to cc.  Makedepend can also deal with #if and #elif directive, except that the only allowable expressions are defined(foo) and !defined(foo).  Any other expression will evaluate to false. 

There are several options that control the formatting of the dependency lines.  Normally, the first field of each output line is x.o, where x is one of the file arguments with the .c or any other suffix stripped off.  However, the −o option may be used to place a suffix other than .o in the output lines.  The −p option controls how completely the include file names are specified in the output.  If −p is given, then the complete path name of each header file is output.  If -p is not given, then only the name from the actual #include statement is output (e.g., sys/file.h instead of /sprite/lib/include/sys/file.h).  This default is useful for Pmake, which manages its own include file search path.  Finally, the −w switch may be used to control the length of the output lines, and the −v switch causes extra information about nested includes to be output in the form of comment lines. 
 

SEE ALSO

mkmf, pmake
 

BUGS

Can’t handle arbitrary expressions following #if or #elif. 

Makedepend’s algorithm can cause problems in some cases.  It only parses each include file once and generates a list of dependencies for that file.  However, if defines are set differently, it could be that an include file will depend on two different sets of files in two different invocations.  In this case, makedepend will return the wrong dependencies for the second case. 
 

KEYWORDS

dependencies, include file, object file

Sprite version 1.0  —  December 02, 1991

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026