1 .\" Copyright (c) 1993, 1994, 1998 The Open Group
3 .\" Permission to use, copy, modify, distribute, and sell this software and its
4 .\" documentation for any purpose is hereby granted without fee, provided that
5 .\" the above copyright notice appear in all copies and that both that
6 .\" copyright notice and this permission notice appear in supporting
9 .\" The above copyright notice and this permission notice shall be included in
10 .\" all copies or substantial portions of the Software.
12 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13 .\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14 .\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
15 .\" THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
16 .\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
17 .\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 .\" Except as contained in this notice, the name of The Open Group shall not
21 .\" be used in advertising or otherwise to promote the sale, use or other
22 .\" dealing in this Software without prior written authorization from The
26 .TH MAKEDEPEND 1 __xorgversion__
29 makedepend \- create dependencies in makefiles
33 .BI \-D name\fB=\fPdef
71 in sequence and parses it like a C-preprocessor,
83 directives so that it can correctly tell which
85 directives would be used in a compilation.
88 directives can reference files having other
90 directives, and parsing will occur in these files as well.
95 directly or indirectly,
98 calls a \fIdependency.\fP
99 These dependencies are then written to a
103 will know which object files must be recompiled when a dependency has changed.
107 places its output in the file named
109 if it exists, otherwise
111 An alternate makefile may be specified with the
114 It first searches the makefile for
117 \& # DO NOT DELETE THIS LINE \-\^\- make depend depends on it.
119 or one provided with the
122 as a delimiter for the dependency output.
123 If it finds it, it will delete everything
124 following this to the end of the makefile
125 and put the output after this line.
126 If it doesn't find it, the program
127 will append the string to the end of the makefile
128 and place the output following that.
131 appearing on the command line,
133 puts lines in the makefile of the form
135 sourcefile.o:\0dfile .\|.\|.
137 Where \fIsourcefile.o\fP is the name from the command
138 line with its suffix replaced with ``.o'',
139 and \fIdfile\fP is a dependency discovered in a
141 directive while parsing
143 or one of the files it included.
147 will be used in a makefile target so that typing ``make depend'' will
148 bring the dependencies up to date for the makefile.
151 SRCS\0=\0file1.c\0file2.c\0.\|.\|.
152 CFLAGS\0=\0\-O\0\-DHACK\0\-I\^.\^.\^/foobar\0\-xyz
154 makedepend\0\-\^\-\0$(CFLAGS)\0\-\^\-\0$(SRCS)
158 will ignore any option that it does not understand so that you may use
159 the same arguments that you would for
162 .B \-D\fIname\fP=\fIdef\fP \fRor\fP \-D\fIname\fP
164 This places a definition for
171 the symbol becomes defined as ``1''.
173 .B \-I\fIincludedir\fP
179 to its list of directories to search when it encounters
185 only searches the standard include directories (usually /usr/include
186 and possibly a compiler-dependent directory).
188 .B \-Y\fIincludedir\fP
189 Replace all of the standard include directories with the single specified
190 include directory; you can omit the
192 to simply prevent searching the standard include directories.
195 Append the dependencies to the end of the file instead of replacing them.
199 This allows you to specify an alternate makefile in which
201 can place its output.
202 Specifying ``\-'' as the file name (i.e., \fB\-f\-\fP) sends the
203 output to standard output instead of modifying an existing file.
205 .B \-include \fIfile\fP
206 Process file as input, and include all the resulting output
207 before processing the regular input file. This has the same
208 affect as if the specified file is an include statement that
209 appears before the very first line of the regular input file.
211 .B \-o\fIobjsuffix\fP
213 Some systems may have object files whose suffix is something other
215 This option allows you to specify another suffix, such as
223 .B \-p\fIobjprefix\fP
225 The prefix is prepended to the name of the object file. This is
226 usually used to designate a different directory for the object file.
227 The default is the empty string.
230 Starting string delimiter.
231 This option permits you to specify
232 a different string for
234 to look for in the makefile.
240 will ensure that every output line that it writes will be no wider than
241 78 characters for the sake of readability.
242 This option enables you to change this width.
248 to emit the list of files included by each input file.
251 Warn about multiple inclusion.
254 to produce a warning if any input file includes another file more than
255 once. In previous versions of
257 this was the default behavior; the default has been changed to better
258 match the behavior of the C compiler, which does not consider multiple
259 inclusion to be an error. This option is provided for backward
260 compatibility, and to aid in debugging problems related to multiple
263 .B "\-\^\- \fIoptions\fP \-\^\-"
266 encounters a double hyphen (\-\^\-) in the argument list,
267 then any unrecognized argument following it
268 will be silently ignored; a second double hyphen terminates this
272 can be made to safely ignore esoteric compiler arguments that might
273 normally be found in a CFLAGS
280 recognizes and appear between the pair of double hyphens
281 are processed normally.
283 The approach used in this program enables it to run an order of magnitude
284 faster than any other ``dependency generator'' I have ever seen.
285 Central to this performance are two assumptions:
286 that all files compiled by a single
287 makefile will be compiled with roughly the same
292 and that most files in a single directory will include largely the
295 Given these assumptions,
297 expects to be called once for each makefile, with
298 all source files that are maintained by the
299 makefile appearing on the command line.
300 It parses each source and include
301 file exactly once, maintaining an internal symbol table
303 Thus, the first file on the command line will take an amount of time
304 proportional to the amount of time that a normal C preprocessor takes.
305 But on subsequent files, if it encounters an include file
306 that it has already parsed, it does not parse it again.
309 imagine you are compiling two files,
313 they each include the header file
317 in turn includes the files
321 When you run the command
323 makedepend\0file1.c\0file2.c
334 It then decides that the dependencies for this file are
336 file1.o:\0header.h\0def1.h\0def2.h
338 But when the program parses
340 and discovers that it, too, includes
342 it does not parse the file,
348 to the list of dependencies for
354 parses, but does not currently evaluate, the SVR4 #predicate(token-list)
355 preprocessor expression; such expressions are simply assumed to be true.
356 This may cause the wrong
358 directives to be evaluated.
360 Imagine you are parsing two files,
365 each includes the file
367 The list of files that
369 includes might truly be different when
373 than when it is included by
377 arrives at a list of dependencies for a file,
378 it is cast in concrete.
380 Todd Brunhoff, Tektronix, Inc. and MIT Project Athena