Warning, /tools/cyrus-imapd-makedepend/mkdepend.man is written in an unsupported language. File is not indexed.
view on githubraw file Latest commit bf5846c3 on 2004-02-25 18:19:54 UTC
bf5846c3a1 Ed H*0001 .\" $XConsortium: mkdepend.man,v 1.15 94/04/17 20:10:37 gildea Exp $
0002 .\" Copyright (c) 1993, 1994 X Consortium
0003 .\"
0004 .\" Permission is hereby granted, free of charge, to any person obtaining a
0005 .\" copy of this software and associated documentation files (the "Software"),
0006 .\" to deal in the Software without restriction, including without limitation
0007 .\" the rights to use, copy, modify, merge, publish, distribute, sublicense,
0008 .\" and/or sell copies of the Software, and to permit persons to whom the
0009 .\" Software furnished to do so, subject to the following conditions:
0010 .\"
0011 .\" The above copyright notice and this permission notice shall be included in
0012 .\" all copies or substantial portions of the Software.
0013 .\"
0014 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0015 .\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0016 .\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
0017 .\" THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
0018 .\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
0019 .\" OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
0020 .\" SOFTWARE.
0021 .\"
0022 .\" Except as contained in this notice, the name of the X Consortium shall not
0023 .\" be used in advertising or otherwise to promote the sale, use or other
0024 .\" dealing in this Software without prior written authorization from the
0025 .\" X Consortium.
0026 .TH MAKEDEPEND 1 "Release 6" "X Version 11"
0027 .UC 4
0028 .SH NAME
0029 makedepend \- create dependencies in makefiles
0030 .SH SYNOPSIS
0031 .B makedepend
0032 [
0033 .B \-Dname=def
0034 ] [
0035 .B \-Dname
0036 ] [
0037 .B \-Iincludedir
0038 ] [
0039 .B \-Yincludedir
0040 ] [
0041 .B \-a
0042 ] [
0043 .B \-fmakefile
0044 ] [
0045 .B \-oobjsuffix
0046 ] [
0047 .B \-pobjprefix
0048 ] [
0049 .B \-sstring
0050 ] [
0051 .B \-wwidth
0052 ] [
0053 .B \-v
0054 ] [
0055 .B \-m
0056 ] [
0057 \-\^\-
0058 .B otheroptions
0059 \-\^\-
0060 ]
0061 sourcefile .\|.\|.
0062 .br
0063 .SH DESCRIPTION
0064 .B Makedepend
0065 reads each
0066 .I sourcefile
0067 in sequence and parses it like a C-preprocessor,
0068 processing all
0069 .I #include,
0070 .I #define,
0071 .I #undef,
0072 .I #ifdef,
0073 .I #ifndef,
0074 .I #endif,
0075 .I #if
0076 and
0077 .I #else
0078 directives so that it can correctly tell which
0079 .I #include,
0080 directives would be used in a compilation.
0081 Any
0082 .I #include,
0083 directives can reference files having other
0084 .I #include
0085 directives, and parsing will occur in these files as well.
0086 .PP
0087 Every file that a
0088 .I sourcefile
0089 includes,
0090 directly or indirectly,
0091 is what
0092 .B makedepend
0093 calls a "dependency".
0094 These dependencies are then written to a
0095 .I makefile
0096 in such a way that
0097 .B make(1)
0098 will know which object files must be recompiled when a dependency has changed.
0099 .PP
0100 By default,
0101 .B makedepend
0102 places its output in the file named
0103 .I makefile
0104 if it exists, otherwise
0105 .I Makefile.
0106 An alternate makefile may be specified with the
0107 .B \-f
0108 option.
0109 It first searches the makefile for
0110 the line
0111 .sp
0112 # DO NOT DELETE THIS LINE \-\^\- make depend depends on it.
0113 .sp
0114 or one provided with the
0115 .B \-s
0116 option,
0117 as a delimiter for the dependency output.
0118 If it finds it, it will delete everything
0119 following this to the end of the makefile
0120 and put the output after this line.
0121 If it doesn't find it, the program
0122 will append the string to the end of the makefile
0123 and place the output following that.
0124 For each
0125 .I sourcefile
0126 appearing on the command line,
0127 .B makedepend
0128 puts lines in the makefile of the form
0129 .sp
0130 sourcefile.o:\0dfile .\|.\|.
0131 .sp
0132 Where "sourcefile.o" is the name from the command
0133 line with its suffix replaced with ".o",
0134 and "dfile" is a dependency discovered in a
0135 .I #include
0136 directive while parsing
0137 .I sourcefile
0138 or one of the files it included.
0139 .SH EXAMPLE
0140 Normally,
0141 .B makedepend
0142 will be used in a makefile target so that typing "make depend" will
0143 bring the dependencies up to date for the makefile.
0144 For example,
0145 .nf
0146 SRCS\0=\0file1.c\0file2.c\0.\|.\|.
0147 CFLAGS\0=\0\-O\0\-DHACK\0\-I\^.\^.\^/foobar\0\-xyz
0148 depend:
0149 makedepend\0\-\^\-\0$(CFLAGS)\0\-\^\-\0$(SRCS)
0150 .fi
0151 .SH OPTIONS
0152 .B Makedepend
0153 will ignore any option that it does not understand so that you may use
0154 the same arguments that you would for
0155 .B cc(1).
0156 .TP 5
0157 .B \-Dname=def or \-Dname
0158 Define.
0159 This places a definition for
0160 .I name
0161 in
0162 .B makedepend's
0163 symbol table.
0164 Without
0165 .I =def
0166 the symbol becomes defined as "1".
0167 .TP 5
0168 .B \-Iincludedir
0169 Include directory.
0170 This option tells
0171 .B makedepend
0172 to prepend
0173 .I includedir
0174 to its list of directories to search when it encounters
0175 a
0176 .I #include
0177 directive.
0178 By default,
0179 .B makedepend
0180 only searches the standard include directories (usually /usr/include
0181 and possibly a compiler-dependent directory).
0182 .TP 5
0183 .B \-Yincludedir
0184 Replace all of the standard include directories with the single specified
0185 include directory; you can omit the
0186 .I includedir
0187 to simply prevent searching the standard include directories.
0188 .TP 5
0189 .B \-a
0190 Append the dependencies to the end of the file instead of replacing them.
0191 .TP 5
0192 .B \-fmakefile
0193 Filename.
0194 This allows you to specify an alternate makefile in which
0195 .B makedepend
0196 can place its output.
0197 .TP 5
0198 .B \-oobjsuffix
0199 Object file suffix.
0200 Some systems may have object files whose suffix is something other
0201 than ".o".
0202 This option allows you to specify another suffix, such as
0203 ".b" with
0204 .I -o.b
0205 or ":obj"
0206 with
0207 .I -o:obj
0208 and so forth.
0209 .TP 5
0210 .B \-pobjprefix
0211 Object file prefix.
0212 The prefix is prepended to the name of the object file. This is
0213 usually used to designate a different directory for the object file.
0214 The default is the empty string.
0215 .TP 5
0216 .B \-sstring
0217 Starting string delimiter.
0218 This option permits you to specify
0219 a different string for
0220 .B makedepend
0221 to look for in the makefile.
0222 .TP 5
0223 .B \-wwidth
0224 Line width.
0225 Normally,
0226 .B makedepend
0227 will ensure that every output line that it writes will be no wider than
0228 78 characters for the sake of readability.
0229 This option enables you to change this width.
0230 .TP 5
0231 .B \-v
0232 Verbose operation.
0233 This option causes
0234 .B makedepend
0235 to emit the list of files included by each input file on standard output.
0236 .TP 5
0237 .B \-m
0238 Warn about multiple inclusion.
0239 This option causes
0240 .B makedepend
0241 to produce a warning if any input file includes another file more than
0242 once. In previous versions of
0243 .B makedepend
0244 this was the default behavior; the default has been changed to better
0245 match the behavior of the C compiler, which does not consider multiple
0246 inclusion to be an error. This option is provided for backward
0247 compatibility, and to aid in debugging problems related to multiple
0248 inclusion.
0249 .TP 5
0250 .B "\-\^\- options \-\^\-"
0251 If
0252 .B makedepend
0253 encounters a double hyphen (\-\^\-) in the argument list,
0254 then any unrecognized argument following it
0255 will be silently ignored; a second double hyphen terminates this
0256 special treatment.
0257 In this way,
0258 .B makedepend
0259 can be made to safely ignore esoteric compiler arguments that might
0260 normally be found in a CFLAGS
0261 .B make
0262 macro (see the
0263 .B EXAMPLE
0264 section above).
0265 All options that
0266 .B makedepend
0267 recognizes and appear between the pair of double hyphens
0268 are processed normally.
0269 .SH ALGORITHM
0270 The approach used in this program enables it to run an order of magnitude
0271 faster than any other "dependency generator" I have ever seen.
0272 Central to this performance are two assumptions:
0273 that all files compiled by a single
0274 makefile will be compiled with roughly the same
0275 .I -I
0276 and
0277 .I -D
0278 options;
0279 and that most files in a single directory will include largely the
0280 same files.
0281 .PP
0282 Given these assumptions,
0283 .B makedepend
0284 expects to be called once for each makefile, with
0285 all source files that are maintained by the
0286 makefile appearing on the command line.
0287 It parses each source and include
0288 file exactly once, maintaining an internal symbol table
0289 for each.
0290 Thus, the first file on the command line will take an amount of time
0291 proportional to the amount of time that a normal C preprocessor takes.
0292 But on subsequent files, if it encounter's an include file
0293 that it has already parsed, it does not parse it again.
0294 .PP
0295 For example,
0296 imagine you are compiling two files,
0297 .I file1.c
0298 and
0299 .I file2.c,
0300 they each include the header file
0301 .I header.h,
0302 and the file
0303 .I header.h
0304 in turn includes the files
0305 .I def1.h
0306 and
0307 .I def2.h.
0308 When you run the command
0309 .sp
0310 makedepend\0file1.c\0file2.c
0311 .sp
0312 .B makedepend
0313 will parse
0314 .I file1.c
0315 and consequently,
0316 .I header.h
0317 and then
0318 .I def1.h
0319 and
0320 .I def2.h.
0321 It then decides that the dependencies for this file are
0322 .sp
0323 file1.o:\0header.h\0def1.h\0def2.h
0324 .sp
0325 But when the program parses
0326 .I file2.c
0327 and discovers that it, too, includes
0328 .I header.h,
0329 it does not parse the file,
0330 but simply adds
0331 .I header.h,
0332 .I def1.h
0333 and
0334 .I def2.h
0335 to the list of dependencies for
0336 .I file2.o.
0337 .SH "SEE ALSO"
0338 cc(1), make(1)
0339 .SH BUGS
0340 .B makedepend
0341 parses, but does not currently evaluate, the SVR4
0342 #predicate(token-list) preprocessor expression;
0343 such expressions are simply assumed to be true.
0344 This may cause the wrong
0345 .I #include
0346 directives to be evaluated.
0347 .PP
0348 Imagine you are parsing two files,
0349 say
0350 .I file1.c
0351 and
0352 .I file2.c,
0353 each includes the file
0354 .I def.h.
0355 The list of files that
0356 .I def.h
0357 includes might truly be different when
0358 .I def.h
0359 is included by
0360 .I file1.c
0361 than when it is included by
0362 .I file2.c.
0363 But once
0364 .B makedepend
0365 arrives at a list of dependencies for a file,
0366 it is cast in concrete.
0367 .SH AUTHOR
0368 Todd Brunhoff, Tektronix, Inc. and MIT Project Athena