1 .\" $Xorg: mkdepend.man,v 1.5 2001/02/09 02:03:16 xorgcvs Exp $
2 .\" Copyright (c) 1993, 1994, 1998 The Open Group
4 .\" Permission to use, copy, modify, distribute, and sell this software and its
5 .\" documentation for any purpose is hereby granted without fee, provided that
6 .\" the above copyright notice appear in all copies and that both that
7 .\" copyright notice and this permission notice appear in supporting
10 .\" The above copyright notice and this permission notice shall be included in
11 .\" all copies or substantial portions of the Software.
13 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 .\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 .\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16 .\" THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17 .\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
18 .\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 .\" Except as contained in this notice, the name of The Open Group shall not
22 .\" be used in advertising or otherwise to promote the sale, use or other
23 .\" dealing in this Software without prior written authorization from The
26 .\" $XFree86: xc/config/makedepend/mkdepend.man,v 1.7 2002/12/14 02:39:45 dawes Exp $
28 .TH MAKEDEPEND 1 __xorgversion__
31 makedepend \- create dependencies in makefiles
35 .BI \-D name\fB=\fPdef
73 in sequence and parses it like a C-preprocessor,
85 directives so that it can correctly tell which
87 directives would be used in a compilation.
90 directives can reference files having other
92 directives, and parsing will occur in these files as well.
97 directly or indirectly,
100 calls a \fIdependency.\fP
101 These dependencies are then written to a
105 will know which object files must be recompiled when a dependency has changed.
109 places its output in the file named
111 if it exists, otherwise
113 An alternate makefile may be specified with the
116 It first searches the makefile for
119 \& # DO NOT DELETE THIS LINE \-\^\- make depend depends on it.
121 or one provided with the
124 as a delimiter for the dependency output.
125 If it finds it, it will delete everything
126 following this to the end of the makefile
127 and put the output after this line.
128 If it doesn't find it, the program
129 will append the string to the end of the makefile
130 and place the output following that.
133 appearing on the command line,
135 puts lines in the makefile of the form
137 sourcefile.o:\0dfile .\|.\|.
139 Where \fIsourcefile.o\fP is the name from the command
140 line with its suffix replaced with ``.o'',
141 and \fIdfile\fP is a dependency discovered in a
143 directive while parsing
145 or one of the files it included.
149 will be used in a makefile target so that typing ``make depend'' will
150 bring the dependencies up to date for the makefile.
153 SRCS\0=\0file1.c\0file2.c\0.\|.\|.
154 CFLAGS\0=\0\-O\0\-DHACK\0\-I\^.\^.\^/foobar\0\-xyz
156 makedepend\0\-\^\-\0$(CFLAGS)\0\-\^\-\0$(SRCS)
160 will ignore any option that it does not understand so that you may use
161 the same arguments that you would for
164 .B \-D\fIname\fP=\fIdef\fP \fRor\fP \-D\fIname\fP
166 This places a definition for
173 the symbol becomes defined as ``1''.
175 .B \-I\fIincludedir\fP
181 to its list of directories to search when it encounters
187 only searches the standard include directories (usually /usr/include
188 and possibly a compiler-dependent directory).
190 .B \-Y\fIincludedir\fP
191 Replace all of the standard include directories with the single specified
192 include directory; you can omit the
194 to simply prevent searching the standard include directories.
197 Append the dependencies to the end of the file instead of replacing them.
201 This allows you to specify an alternate makefile in which
203 can place its output.
204 Specifying ``\-'' as the file name (i.e., \fB\-f\-\fP) sends the
205 output to standard output instead of modifying an existing file.
207 .B \-include \fIfile\fP
208 Process file as input, and include all the resulting output
209 before processing the regular input file. This has the same
210 affect as if the specified file is an include statement that
211 appears before the very first line of the regular input file.
213 .B \-o\fIobjsuffix\fP
215 Some systems may have object files whose suffix is something other
217 This option allows you to specify another suffix, such as
225 .B \-p\fIobjprefix\fP
227 The prefix is prepended to the name of the object file. This is
228 usually used to designate a different directory for the object file.
229 The default is the empty string.
232 Starting string delimiter.
233 This option permits you to specify
234 a different string for
236 to look for in the makefile.
242 will ensure that every output line that it writes will be no wider than
243 78 characters for the sake of readability.
244 This option enables you to change this width.
250 to emit the list of files included by each input file.
253 Warn about multiple inclusion.
256 to produce a warning if any input file includes another file more than
257 once. In previous versions of
259 this was the default behavior; the default has been changed to better
260 match the behavior of the C compiler, which does not consider multiple
261 inclusion to be an error. This option is provided for backward
262 compatibility, and to aid in debugging problems related to multiple
265 .B "\-\^\- \fIoptions\fP \-\^\-"
268 encounters a double hyphen (\-\^\-) in the argument list,
269 then any unrecognized argument following it
270 will be silently ignored; a second double hyphen terminates this
274 can be made to safely ignore esoteric compiler arguments that might
275 normally be found in a CFLAGS
282 recognizes and appear between the pair of double hyphens
283 are processed normally.
285 The approach used in this program enables it to run an order of magnitude
286 faster than any other ``dependency generator'' I have ever seen.
287 Central to this performance are two assumptions:
288 that all files compiled by a single
289 makefile will be compiled with roughly the same
294 and that most files in a single directory will include largely the
297 Given these assumptions,
299 expects to be called once for each makefile, with
300 all source files that are maintained by the
301 makefile appearing on the command line.
302 It parses each source and include
303 file exactly once, maintaining an internal symbol table
305 Thus, the first file on the command line will take an amount of time
306 proportional to the amount of time that a normal C preprocessor takes.
307 But on subsequent files, if it encounters an include file
308 that it has already parsed, it does not parse it again.
311 imagine you are compiling two files,
315 they each include the header file
319 in turn includes the files
323 When you run the command
325 makedepend\0file1.c\0file2.c
336 It then decides that the dependencies for this file are
338 file1.o:\0header.h\0def1.h\0def2.h
340 But when the program parses
342 and discovers that it, too, includes
344 it does not parse the file,
350 to the list of dependencies for
356 parses, but does not currently evaluate, the SVR4 #predicate(token-list)
357 preprocessor expression; such expressions are simply assumed to be true.
358 This may cause the wrong
360 directives to be evaluated.
362 Imagine you are parsing two files,
367 each includes the file
369 The list of files that
371 includes might truly be different when
375 than when it is included by
379 arrives at a list of dependencies for a file,
380 it is cast in concrete.
382 Todd Brunhoff, Tektronix, Inc. and MIT Project Athena