1 .\" $XConsortium: mkdepend.man /main/19 1996/09/28 16:15:44 rws $
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.1" "X Version 11"
29 makedepend \- create dependencies in makefiles
33 .BI \-D name\fB=\fPdef
69 in sequence and parses it like a C-preprocessor,
81 directives so that it can correctly tell which
83 directives would be used in a compilation.
86 directives can reference files having other
88 directives, and parsing will occur in these files as well.
93 directly or indirectly,
96 calls a \fIdependency.\fP
97 These dependencies are then written to a
101 will know which object files must be recompiled when a dependency has changed.
105 places its output in the file named
107 if it exists, otherwise
109 An alternate makefile may be specified with the
112 It first searches the makefile for
115 # DO NOT DELETE THIS LINE \-\^\- make depend depends on it.
117 or one provided with the
120 as a delimiter for the dependency output.
121 If it finds it, it will delete everything
122 following this to the end of the makefile
123 and put the output after this line.
124 If it doesn't find it, the program
125 will append the string to the end of the makefile
126 and place the output following that.
129 appearing on the command line,
131 puts lines in the makefile of the form
133 sourcefile.o:\0dfile .\|.\|.
135 Where \fIsourcefile.o\fP is the name from the command
136 line with its suffix replaced with ``.o'',
137 and \fIdfile\fP is a dependency discovered in a
139 directive while parsing
141 or one of the files it included.
145 will be used in a makefile target so that typing ``make depend'' will
146 bring the dependencies up to date for the makefile.
149 SRCS\0=\0file1.c\0file2.c\0.\|.\|.
150 CFLAGS\0=\0\-O\0\-DHACK\0\-I\^.\^.\^/foobar\0\-xyz
152 makedepend\0\-\^\-\0$(CFLAGS)\0\-\^\-\0$(SRCS)
156 will ignore any option that it does not understand so that you may use
157 the same arguments that you would for
160 .B \-D\fIname\fP=\fIdef\fP \fRor\fP \-D\fIname\fP
162 This places a definition for
169 the symbol becomes defined as ``1''.
171 .B \-I\fIincludedir\fP
177 to its list of directories to search when it encounters
183 only searches the standard include directories (usually /usr/include
184 and possibly a compiler-dependent directory).
186 .B \-Y\fIincludedir\fP
187 Replace all of the standard include directories with the single specified
188 include directory; you can omit the
190 to simply prevent searching the standard include directories.
193 Append the dependencies to the end of the file instead of replacing them.
197 This allows you to specify an alternate makefile in which
199 can place its output.
200 Specifying ``\-'' as the file name (i.e., \fB\-f\-\fP) sends the
201 output to standard output instead of modifying an existing file.
203 .B \-o\fIobjsuffix\fP
205 Some systems may have object files whose suffix is something other
207 This option allows you to specify another suffix, such as
215 .B \-p\fIobjprefix\fP
217 The prefix is prepended to the name of the object file. This is
218 usually used to designate a different directory for the object file.
219 The default is the empty string.
222 Starting string delimiter.
223 This option permits you to specify
224 a different string for
226 to look for in the makefile.
232 will ensure that every output line that it writes will be no wider than
233 78 characters for the sake of readability.
234 This option enables you to change this width.
240 to emit the list of files included by each input file on standard output.
243 Warn about multiple inclusion.
246 to produce a warning if any input file includes another file more than
247 once. In previous versions of
249 this was the default behavior; the default has been changed to better
250 match the behavior of the C compiler, which does not consider multiple
251 inclusion to be an error. This option is provided for backward
252 compatibility, and to aid in debugging problems related to multiple
255 .B "\-\^\- \fIoptions\fP \-\^\-"
258 encounters a double hyphen (\-\^\-) in the argument list,
259 then any unrecognized argument following it
260 will be silently ignored; a second double hyphen terminates this
264 can be made to safely ignore esoteric compiler arguments that might
265 normally be found in a CFLAGS
272 recognizes and appear between the pair of double hyphens
273 are processed normally.
275 The approach used in this program enables it to run an order of magnitude
276 faster than any other ``dependency generator'' I have ever seen.
277 Central to this performance are two assumptions:
278 that all files compiled by a single
279 makefile will be compiled with roughly the same
284 and that most files in a single directory will include largely the
287 Given these assumptions,
289 expects to be called once for each makefile, with
290 all source files that are maintained by the
291 makefile appearing on the command line.
292 It parses each source and include
293 file exactly once, maintaining an internal symbol table
295 Thus, the first file on the command line will take an amount of time
296 proportional to the amount of time that a normal C preprocessor takes.
297 But on subsequent files, if it encounters an include file
298 that it has already parsed, it does not parse it again.
301 imagine you are compiling two files,
305 they each include the header file
309 in turn includes the files
313 When you run the command
315 makedepend\0file1.c\0file2.c
326 It then decides that the dependencies for this file are
328 file1.o:\0header.h\0def1.h\0def2.h
330 But when the program parses
332 and discovers that it, too, includes
334 it does not parse the file,
340 to the list of dependencies for
346 parses, but does not currently evaluate, the SVR4
347 #predicate(token-list) preprocessor expression;
348 such expressions are simply assumed to be true.
349 This may cause the wrong
351 directives to be evaluated.
353 Imagine you are parsing two files,
358 each includes the file
360 The list of files that
362 includes might truly be different when
366 than when it is included by
370 arrives at a list of dependencies for a file,
371 it is cast in concrete.
373 Todd Brunhoff, Tektronix, Inc. and MIT Project Athena