1 .TH MAKEDEPEND 1 "26 October 1988" "X Version 11"
4 makedepend \- create dependencies in makefiles
32 in sequence and parses it like a C-preprocessor,
43 directives so that it can correctly tell which
45 directives would be used in a compilation.
48 directives can reference files having other
50 directives, and parsing will occur in these files as well.
55 directly or indirectly,
59 These dependencies are then written to a
63 will know which object files must be recompiled when a dependency has changed.
67 places its output in the file named
69 if it exists, otherwise
71 An alternate makefile may be specified with the
74 It first searches the makefile for
77 # DO NOT DELETE THIS LINE -- make depend depends on it.
79 or one provided with the
82 as a delimiter for the dependency output.
83 If it finds it, it will delete everything
84 following this to the end of the makefile
85 and put the output after this line.
86 If it doesn't find it, the program
87 will append the string to the end of the makefile
88 and place the output following that.
91 appearing on the command line,
93 puts lines in the makefile of the form
95 sourcefile.o: dfile ...
97 Where "sourcefile.o" is the name from the command
98 line with its suffix replaced with ".o",
99 and "dfile" is a dependency discovered in a
101 directive while parsing
103 or one of the files it included.
107 will be used in a makefile target so that typing "make depend" will
108 bring the dependencies up to date for the makefile.
111 SRCS = file1.c file2.c ...
112 CFLAGS = -O -DHACK -I../foobar -xyz
114 makedepend -- $(CFLAGS) -- $(SRCS)
118 will ignore any option that it does not understand so that you may use
119 the same arguments that you would for
122 .B \-Dname=def or \-Dname
124 This places a definition for
131 the symbol becomes defined as "1".
139 to its list of directories to search when it encounters
145 only searches /usr/include.
149 This allows you to specify an alternate makefile in which
151 can place its output.
155 Some systems may have object files whose suffix is something other
157 This option allows you to specify another suffix, such as
166 Starting string delimiter.
167 This option permits you to specify
168 a different string for
170 to look for in the makefile.
176 will ensure that every output line that it writes will be no wider than
177 78 characters for the sake of readability.
178 This option enables you to change this width.
180 .B "\-\ \- options \-\ \-"
183 encounters a double hyphen (\-\ \-) in the argument list,
184 then any unrecognized argument following it
185 will be silently ignored; a second double hyphen terminates this
189 can be made to safely ignore esoteric compiler arguments that might
190 normally be found in a CFLAGS
197 recognizes and appear between the pair of double hyphens
198 are processed normally.
200 The approach used in this program enables it to run an order of magnitude
201 faster than any other "dependency generator" I have ever seen.
202 Central to this performance are two assumptions:
203 that all files compiled by a single
204 makefile will be compiled with roughly the same
209 and that most files in a single directory will include largely the
212 Given these assumptions,
214 expects to be called once for each makefile, with
215 all source files that are maintained by the
216 makefile appearing on the command line.
217 It parses each source and include
218 file exactly once, maintaining an internal symbol table
220 Thus, the first file on the command line will take an amount of time
221 proportional to the amount of time that a normal C preprocessor takes.
222 But on subsequent files, if it encounter's an include file
223 that it has already parsed, it does not parse it again.
226 imagine you are compiling two files,
230 they each include the header file
234 in turn includes the files
238 When you run the command
240 makedepend file1.c file2.c
251 It then decides that the dependencies for this file are
253 file1.o: header.h def1.h def2.h
255 But when the program parses
257 and discovers that it, too, includes
259 it does not parse the file,
265 to the list of dependencies for
270 If you do not have the source for cpp, the Berkeley Unix C preprocessor,
273 will be compiled in such a way that all
275 directives will evaluate to "true" regardless of their actual value.
276 This may cause the wrong
278 directives to be evaluated.
280 should simply have its own parser written for
284 Imagine you are parsing two files,
289 each includes the file
291 The list of files that
293 includes might truly be different when
297 than when it is included by
301 arrives at a list of dependencies for a file,
302 it is cast in concrete.
304 Todd Brunhoff, Tektronix, Inc. and MIT Project Athena