1 .\" $TOG: mkdepend.man /main/20 1998/02/06 11:10:18 kaleb $
2 .\" Copyright (c) 1993, 1994, 1998 The Open Group
4 .\" All Rights Reserved.
6 .\" The above copyright notice and this permission notice shall be included in
7 .\" all copies or substantial portions of the Software.
9 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
10 .\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
11 .\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
12 .\" THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
13 .\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
14 .\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17 .\" Except as contained in this notice, the name of The Open Group shall not
18 .\" be used in advertising or otherwise to promote the sale, use or other
19 .\" dealing in this Software without prior written authorization from The
21 .TH MAKEDEPEND 1 "Release 6.4" "X Version 11"
24 makedepend \- create dependencies in makefiles
28 .BI \-D name\fB=\fPdef
64 in sequence and parses it like a C-preprocessor,
76 directives so that it can correctly tell which
78 directives would be used in a compilation.
81 directives can reference files having other
83 directives, and parsing will occur in these files as well.
88 directly or indirectly,
91 calls a \fIdependency.\fP
92 These dependencies are then written to a
96 will know which object files must be recompiled when a dependency has changed.
100 places its output in the file named
102 if it exists, otherwise
104 An alternate makefile may be specified with the
107 It first searches the makefile for
110 # DO NOT DELETE THIS LINE \-\^\- make depend depends on it.
112 or one provided with the
115 as a delimiter for the dependency output.
116 If it finds it, it will delete everything
117 following this to the end of the makefile
118 and put the output after this line.
119 If it doesn't find it, the program
120 will append the string to the end of the makefile
121 and place the output following that.
124 appearing on the command line,
126 puts lines in the makefile of the form
128 sourcefile.o:\0dfile .\|.\|.
130 Where \fIsourcefile.o\fP is the name from the command
131 line with its suffix replaced with ``.o'',
132 and \fIdfile\fP is a dependency discovered in a
134 directive while parsing
136 or one of the files it included.
140 will be used in a makefile target so that typing ``make depend'' will
141 bring the dependencies up to date for the makefile.
144 SRCS\0=\0file1.c\0file2.c\0.\|.\|.
145 CFLAGS\0=\0\-O\0\-DHACK\0\-I\^.\^.\^/foobar\0\-xyz
147 makedepend\0\-\^\-\0$(CFLAGS)\0\-\^\-\0$(SRCS)
151 will ignore any option that it does not understand so that you may use
152 the same arguments that you would for
155 .B \-D\fIname\fP=\fIdef\fP \fRor\fP \-D\fIname\fP
157 This places a definition for
164 the symbol becomes defined as ``1''.
166 .B \-I\fIincludedir\fP
172 to its list of directories to search when it encounters
178 only searches the standard include directories (usually /usr/include
179 and possibly a compiler-dependent directory).
181 .B \-Y\fIincludedir\fP
182 Replace all of the standard include directories with the single specified
183 include directory; you can omit the
185 to simply prevent searching the standard include directories.
188 Append the dependencies to the end of the file instead of replacing them.
192 This allows you to specify an alternate makefile in which
194 can place its output.
195 Specifying ``\-'' as the file name (i.e., \fB\-f\-\fP) sends the
196 output to standard output instead of modifying an existing file.
198 .B \-o\fIobjsuffix\fP
200 Some systems may have object files whose suffix is something other
202 This option allows you to specify another suffix, such as
210 .B \-p\fIobjprefix\fP
212 The prefix is prepended to the name of the object file. This is
213 usually used to designate a different directory for the object file.
214 The default is the empty string.
217 Starting string delimiter.
218 This option permits you to specify
219 a different string for
221 to look for in the makefile.
227 will ensure that every output line that it writes will be no wider than
228 78 characters for the sake of readability.
229 This option enables you to change this width.
235 to emit the list of files included by each input file on standard output.
238 Warn about multiple inclusion.
241 to produce a warning if any input file includes another file more than
242 once. In previous versions of
244 this was the default behavior; the default has been changed to better
245 match the behavior of the C compiler, which does not consider multiple
246 inclusion to be an error. This option is provided for backward
247 compatibility, and to aid in debugging problems related to multiple
250 .B "\-\^\- \fIoptions\fP \-\^\-"
253 encounters a double hyphen (\-\^\-) in the argument list,
254 then any unrecognized argument following it
255 will be silently ignored; a second double hyphen terminates this
259 can be made to safely ignore esoteric compiler arguments that might
260 normally be found in a CFLAGS
267 recognizes and appear between the pair of double hyphens
268 are processed normally.
270 The approach used in this program enables it to run an order of magnitude
271 faster than any other ``dependency generator'' I have ever seen.
272 Central to this performance are two assumptions:
273 that all files compiled by a single
274 makefile will be compiled with roughly the same
279 and that most files in a single directory will include largely the
282 Given these assumptions,
284 expects to be called once for each makefile, with
285 all source files that are maintained by the
286 makefile appearing on the command line.
287 It parses each source and include
288 file exactly once, maintaining an internal symbol table
290 Thus, the first file on the command line will take an amount of time
291 proportional to the amount of time that a normal C preprocessor takes.
292 But on subsequent files, if it encounters an include file
293 that it has already parsed, it does not parse it again.
296 imagine you are compiling two files,
300 they each include the header file
304 in turn includes the files
308 When you run the command
310 makedepend\0file1.c\0file2.c
321 It then decides that the dependencies for this file are
323 file1.o:\0header.h\0def1.h\0def2.h
325 But when the program parses
327 and discovers that it, too, includes
329 it does not parse the file,
335 to the list of dependencies for
341 parses, but does not currently evaluate, the SVR4
342 #predicate(token-list) preprocessor expression;
343 such expressions are simply assumed to be true.
344 This may cause the wrong
346 directives to be evaluated.
348 Imagine you are parsing two files,
353 each includes the file
355 The list of files that
357 includes might truly be different when
361 than when it is included by
365 arrives at a list of dependencies for a file,
366 it is cast in concrete.
368 Todd Brunhoff, Tektronix, Inc. and MIT Project Athena