forked from DerellLicht/makedepend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakedepend.man
251 lines (207 loc) · 11.5 KB
/
makedepend.man
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
MAKEDEPEND(1) MAKEDEPEND(1)
NAME
makedepend - create dependencies in makefiles
SYNOPSIS
makedepend [ -Dname=def ] [ -Dname ] [ -Iincludedir ]
[ -a ] [ -b ] [ -c ] [ -e ] [ -fmakefile ]
[ -h ] [ -include file ] [ -m ] [-oobjsuffix ]
[ -pobjprefix ] [ -sstring ] [-v ] [ -wwidth ]
[ -- otheroptions -- ] sourcefile ...
DESCRIPTION
The makedepend program reads each sourcefile in sequence
and parses it like a C-preprocessor, processing all
#include, #define, #undef, #ifdef, #ifndef, #endif, #if,
#elif and #else directives so that it can correctly tell
which #include, directives would be used in a compilation.
Any #include, directives can reference files having other
#include directives, and parsing will occur in these files
as well.
Every file that a sourcefile includes, directly or indi-
rectly, is what makedepend calls a dependency. These
dependencies are then written to a makefile in such a way
that make(1) will know which object files must be recom-
piled when a dependency has changed.
By default, makedepend places its output in the file named
makefile if it exists, otherwise Makefile. An alternate
makefile may be specified with the -f option. It first
searches the makefile for the line
# GENERATED DEPENDENCIES. DO NOT DELETE.
or one provided with the -s option, as a delimiter for the
dependency output. If it finds it, it will delete all
rules following this to the end of the makefile and put
the output after this line (the -a option changes this be-
havior). If it doesn't find it, the program will append
the string to the end of the makefile and place the output
following that. For each sourcefile appearing on the com-
mand line, makedepend puts lines in the makefile of the
form
sourcefile.o: dfile ...
Where sourcefile.o is the name from the command line with
its suffix replaced with ``.o'', and dfile is a dependency
discovered in a #include directive while parsing source-
file or one of the files it included.
EXAMPLE
Normally, makedepend will be used in a makefile target so
that typing ``make depend'' will bring the dependencies up
to date for the makefile. For example,
SRCS = file1.c file2.c ...
CFLAGS = -O -DHACK -I../foobar -xyz
depend:
makedepend -- $(CFLAGS) -- $(SRCS)
OPTIONS
The program will ignore any option that it does not under-
stand so that you may use the same arguments that you
would for cc(1).
-Dname=def or -Dname
Define. This places a definition for name in makede
pend's symbol table. Without =def the symbol becomes
defined as ``1''.
-Iincludedir
Include directory. This option tells makedepend to
prepend includedir to its list of directories to
search when it encounters a #include directive. By
default, makedepend appends the standard include
directories at the end of the directory list. In
Linux, Unix and OS/2, makedepend evaluates the
C_INCLUDE_PATH environment variable for the standard
includes; in Microsoft Windows, makedepend evaluates
the INCLUDE environment variable. When the option -I-
is set, makedepend does not append the standard in-
clude directories (and thus prevents makedepend from
searching the standard include directories).
-Uname
Undefines a symbol. This is mostly useful to remove a
predefined symbol.
-a Accumulates the dependencies in the output file
instead of removing the dependencies for files that
are not listed on the command line of makedepend.
With this option, you can call makedepend multiple
times with different filename lists, and obtaining
the accumulated dependencies of all those calls.
Note that dependencies for files that are listed on
the command line are replaced in the output file. The
-a option is not a simple "append".
-b No backups. By default, makedepend copies the
makefile to one with a .bak extension before
modifying it. When this option is set, makedepend
deletes the backup file.
-c Includes the C/C++ source file in the list of depen-
dencies. By default, makedepend only lists all files
included by the source file on the dependency line.
-e Excludes system includes from the list of dependen-
cies. System includes are files that are between
angle brackets (after the #include). These are less
relevant to list as dependecies; the system include
files can be considered stable.
-fmakefile
Filename. This allows you to specify an alternate
makefile in which makedepend can place its output.
Specifying ``-'' as the file name (i.e., -f-) sends
the output to standard output instead of modifying an
existing file.
-h Shows brief usage information for makedepend. When
verbose output is enabled (see -v), the list of pre-
defined variables is listed too.
-i Ignore include files that cannot be located. That is,
do not warn about any include files that cannot be
found. Note that include files that are not found,
are never added as a dependency to the target. This
option silences the warning about missing files.
-include file
Process file as input, and include all the resulting
output before processing the regular input file. This
has the same affect as if the specified file is an
include statement that appears before the very first
line of the regular input file.
-m Warn about multiple inclusion. This option causes
makedepend to produce a warning if any input file
includes another file more than once. In previous
versions of makedepend this was the default behavior;
the default has been changed to better match the
behavior of the C compiler, which does not consider
multiple inclusion to be an error. This option is
provided for backward compatibility, and to aid in
debugging problems related to multiple inclusion.
-oobjsuffix
Object file suffix. Some systems may have object
files whose suffix is something other than ``.o''.
This option allows you to specify another suffix,
such as ``.b'' with -o.b or ``:obj'' with -o:obj and
so forth.
-pobjprefix
Object file prefix. The prefix is prepended to the
name of the object file. This is usually used to des-
ignate a different directory for the object file.
If the prefix pattern starts with a minus ("-"), that
prefix is removed from the object filename if it
matches.
The default is the empty string.
-sstring
Starting string delimiter. This option permits you
to specify a different string for makedepend to look
for in the makefile.
-v Verbose operation. This option causes makedepend to
emit the list of files included by each input file.
-wwidth
Line width. Normally, makedepend will ensure that
every output line that it writes will be no wider
than 78 characters for the sake of readability. This
option enables you to change this width.
-- options --
If makedepend encounters a double hyphen (--) in the
argument list, then any unrecognized argument follow
ing it will be silently ignored; a second double
hyphen terminates this special treatment. In this
way, makedepend can be made to safely ignore esoteric
compiler arguments that might normally be found in a
CFLAGS make macro (see the EXAMPLE section above).
All options that makedepend recognizes and appear
between the pair of double hyphens are processed nor
mally.
ALGORITHM
The approach used in this program enables it to run an
order of magnitude faster than any other ``dependency gen
erator'' I have ever seen. Central to this performance
are two assumptions: that all files compiled by a single
makefile will be compiled with roughly the same -I and -D
options; and that most files in a single directory will
include largely the same files.
Given these assumptions, makedepend expects to be called
once for each makefile, with all source files that are
maintained by the makefile appearing on the command line.
It parses each source and include file exactly once, main
taining an internal symbol table for each. Thus, the
first file on the command line will take an amount of time
proportional to the amount of time that a normal C prepro
cessor takes. But on subsequent files, if it encounters
an include file that it has already parsed, it does not
parse it again.
For example, imagine you are compiling two files, file1.c
and file2.c, they each include the header file header.h,
and the file header.h in turn includes the files def1.h
and def2.h. When you run the command
makedepend file1.c file2.c
makedepend will parse file1.c and consequently, header.h
and then def1.h and def2.h. It then decides that the
dependencies for this file are
file1.o: header.h def1.h def2.h
But when the program parses file2.c and discovers that it,
too, includes header.h, it does not parse the file, but
simply adds header.h, def1.h and def2.h to the list of
dependencies for file2.o.
SEE ALSO
cc(1), make(1)
BUGS
makedepend parses, but does not currently evaluate, the
SVR4 #predicate(token-list) preprocessor expression; such
expressions are simply assumed to be true. This may cause
the wrong #include directives to be evaluated.
Imagine you are parsing two files, say file1.c and
file2.c, each includes the file def.h. The list of files
that def.h includes might truly be different when def.h is
included by file1.c than when it is included by file2.c.
But once makedepend arrives at a list of dependencies for
a file, it is cast in concrete.
AUTHOR
Todd Brunhoff, Tektronix, Inc. and MIT Project Athena
__xorgversion__ MAKEDEPEND(1)