1 .\" $XConsortium: mkdepend.man,v 1.15 94/04/17 20:10:37 gildea Exp $
2 .\" Copyright (c) 1993, 1994 X Consortium
4 .\" Permission is hereby granted, free of charge, to any person obtaining a
5 .\" copy of this software and associated documentation files (the "Software"),
6 .\" to deal in the Software without restriction, including without limitation
7 .\" the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 .\" and/or sell copies of the Software, and to permit persons to whom the
9 .\" Software furnished to do so, subject to the following conditions:
11 .\" The above copyright notice and this permission notice shall be included in
12 .\" all copies or substantial portions of the Software.
14 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 .\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 .\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 .\" THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
18 .\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
19 .\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 .\" Except as contained in this notice, the name of the X Consortium shall not
23 .\" be used in advertising or otherwise to promote the sale, use or other
24 .\" dealing in this Software without prior written authorization from the
26 .TH MAKEDEPEND 1 "Release 6" "X Version 11"
29 makedepend \- create dependencies in makefiles
67 in sequence and parses it like a C-preprocessor,
78 directives so that it can correctly tell which
80 directives would be used in a compilation.
83 directives can reference files having other
85 directives, and parsing will occur in these files as well.
90 directly or indirectly,
94 These dependencies are then written to a
98 will know which object files must be recompiled when a dependency has changed.
102 places its output in the file named
104 if it exists, otherwise
106 An alternate makefile may be specified with the
109 It first searches the makefile for
112 # DO NOT DELETE THIS LINE \-\^\- make depend depends on it.
114 or one provided with the
117 as a delimiter for the dependency output.
118 If it finds it, it will delete everything
119 following this to the end of the makefile
120 and put the output after this line.
121 If it doesn't find it, the program
122 will append the string to the end of the makefile
123 and place the output following that.
126 appearing on the command line,
128 puts lines in the makefile of the form
130 sourcefile.o:\0dfile .\|.\|.
132 Where "sourcefile.o" is the name from the command
133 line with its suffix replaced with ".o",
134 and "dfile" is a dependency discovered in a
136 directive while parsing
138 or one of the files it included.
142 will be used in a makefile target so that typing "make depend" will
143 bring the dependencies up to date for the makefile.
146 SRCS\0=\0file1.c\0file2.c\0.\|.\|.
147 CFLAGS\0=\0\-O\0\-DHACK\0\-I\^.\^.\^/foobar\0\-xyz
149 makedepend\0\-\^\-\0$(CFLAGS)\0\-\^\-\0$(SRCS)
153 will ignore any option that it does not understand so that you may use
154 the same arguments that you would for
157 .B \-Dname=def or \-Dname
159 This places a definition for
166 the symbol becomes defined as "1".
174 to its list of directories to search when it encounters
180 only searches the standard include directories (usually /usr/include
181 and possibly a compiler-dependent directory).
184 Replace all of the standard include directories with the single specified
185 include directory; you can omit the
187 to simply prevent searching the standard include directories.
190 Append the dependencies to the end of the file instead of replacing them.
194 This allows you to specify an alternate makefile in which
196 can place its output.
200 Some systems may have object files whose suffix is something other
202 This option allows you to specify another suffix, such as
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 "\-\^\- options \-\^\-"
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 encounter's 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