1RMKDEPEND(1) General Commands Manual RMKDEPEND(1)
2
3
4
6 rmkdepend - create dependencies in makefiles (ROOT Version)
7
9 rmkdepend [ -Dname=def ] [ -Dname ] [ -Iincludedir ] [ -Yincludedir ] [
10 -a ] [ -fmakefile ] [ -oobjsuffix ] [ -pobjprefix ] [ -sstring ] [
11 -wwidth ] [ -v ] [ -m ] [ -- otheroptions -- ] sourcefile [ -ttarget‐
12 filename ] ...
13
15 The rmkdepend program reads each sourcefile in sequence and parses it
16 like a C-preprocessor, processing all #include, #define, #undef,
17 #ifdef, #ifndef, #endif, #if, #elif and #else directives so that it can
18 correctly tell which #include, directives would be used in a compila‐
19 tion. Any #include, directives can reference files having other
20 #include directives, and parsing will occur in these files as well.
21
22 Every file that a sourcefile includes, directly or indirectly, is what
23 rmkdepend calls a dependency. These dependencies are then written to a
24 makefile in such a way that make(1) will know which object files must
25 be recompiled when a dependency has changed.
26
27 By default, rmkdepend places its output in the file named makefile if
28 it exists, otherwise Makefile. An alternate makefile may be specified
29 with the -f option. It first searches the makefile for the line
30
31 # DO NOT DELETE THIS LINE -- make depend depends on it.
32
33 or one provided with the -s option, as a delimiter for the dependency
34 output. If it finds it, it will delete everything following this to
35 the end of the makefile and put the output after this line. If it
36 doesn't find it, the program will append the string to the end of the
37 makefile and place the output following that. For each sourcefile
38 appearing on the command line, rmkdepend puts lines in the makefile of
39 the form
40
41 sourcefile.o: dfile ...
42
43 Where sourcefile.o is the name from the command line with its suffix
44 replaced with ``.o'', and dfile is a dependency discovered in a
45 #include directive while parsing sourcefile or one of the files it
46 included.
47
49 The rmkdepend application is based on makedepend(1) from the X Consor‐
50 tium, but modified slightly to fit the needs of the ROOT system. This
51 man(1) page is more or less identical to the manpage for makedepend(1),
52 except for this notice, and the SEE ALSO and AUTHORS sections.
53
55 Normally, rmkdepend will be used in a makefile target so that typing
56 ``make depend'' will bring the dependencies up to date for the make‐
57 file. For example,
58 SRCS = file1.c file2.c ...
59 CFLAGS = -O -DHACK -I../foobar -xyz
60 depend:
61 rmkdepend -- $(CFLAGS) -- $(SRCS)
62
64 The program will ignore any option that it does not understand so that
65 you may use the same arguments that you would for cc(1).
66
67 -Dname=def or -Dname
68 Define. This places a definition for name in rmkdepend's symbol
69 table. Without =def the symbol becomes defined as ``1''.
70
71 -Iincludedir
72 Include directory. This option tells rmkdepend to prepend
73 includedir to its list of directories to search when it encounters
74 a #include directive. By default, rmkdepend only searches the
75 standard include directories (usually /usr/include and possibly a
76 compiler-dependent directory).
77
78 -Yincludedir
79 Replace all of the standard include directories with the single
80 specified include directory; you can omit the includedir to simply
81 prevent searching the standard include directories.
82
83 -a Append the dependencies to the end of the file instead of replac‐
84 ing them.
85
86 -fmakefile
87 Filename. This allows you to specify an alternate makefile in
88 which rmkdepend can place its output. Specifying ``-'' as the
89 file name (i.e., -f-) sends the output to standard output instead
90 of modifying an existing file.
91
92 -oobjsuffix
93 Object file suffix. Some systems may have object files whose suf‐
94 fix is something other than ``.o''. This option allows you to
95 specify another suffix, such as ``.b'' with -o.b or ``:obj'' with
96 -o:obj and so forth.
97
98 -pobjprefix
99 Object file prefix. The prefix is prepended to the name of the
100 object file. This is usually used to designate a different direc‐
101 tory for the object file. The default is the empty string.
102
103 -sstring
104 Starting string delimiter. This option permits you to specify a
105 different string for rmkdepend to look for in the makefile.
106
107 -wwidth
108 Line width. Normally, rmkdepend will ensure that every output
109 line that it writes will be no wider than 78 characters for the
110 sake of readability. This option enables you to change this
111 width.
112
113 -v Verbose operation. This option causes rmkdepend to emit the list
114 of files included by each input file on standard output.
115
116 -m Warn about multiple inclusion. This option causes rmkdepend to
117 produce a warning if any input file includes another file more
118 than once. In previous versions of rmkdepend this was the default
119 behavior; the default has been changed to better match the behav‐
120 ior of the C compiler, which does not consider multiple inclusion
121 to be an error. This option is provided for backward compatibil‐
122 ity, and to aid in debugging problems related to multiple inclu‐
123 sion.
124
125 -- options --
126 If rmkdepend encounters a double hyphen (--) in the argument list,
127 then any unrecognized argument following it will be silently
128 ignored; a second double hyphen terminates this special treatment.
129 In this way, rmkdepend can be made to safely ignore esoteric com‐
130 piler arguments that might normally be found in a CFLAGS make
131 macro (see the EXAMPLE section above). All options that rmkdepend
132 recognizes and appear between the pair of double hyphens are pro‐
133 cessed normally.
134
135 -ttargetfilename
136 Filename. This allows you to specify an alternate target filename
137 to be use for the preceding file. For example if you call
138
139 rmkdepend -sobj -pbuild file.cxx -tlibrary.so
140
141 rather than inserting the line
142
143 build/file.obj: ...
144
145 rmkdepend will insert:
146
147 library.so: ...
148
149
151 The approach used in this program enables it to run an order of magni‐
152 tude faster than any other ``dependency generator'' I have ever seen.
153 Central to this performance are two assumptions: that all files com‐
154 piled by a single makefile will be compiled with roughly the same -I
155 and -D options; and that most files in a single directory will include
156 largely the same files.
157
158 Given these assumptions, rmkdepend expects to be called once for each
159 makefile, with all source files that are maintained by the makefile
160 appearing on the command line. It parses each source and include file
161 exactly once, maintaining an internal symbol table for each. Thus, the
162 first file on the command line will take an amount of time proportional
163 to the amount of time that a normal C preprocessor takes. But on sub‐
164 sequent files, if it encounters an include file that it has already
165 parsed, it does not parse it again.
166
167 For example, imagine you are compiling two files, file1.c and file2.c,
168 they each include the header file header.h, and the file header.h in
169 turn includes the files def1.h and def2.h. When you run the command
170
171 rmkdepend file1.c file2.c
172
173 rmkdepend will parse file1.c and consequently, header.h and then def1.h
174 and def2.h. It then decides that the dependencies for this file are
175
176 file1.o: header.h def1.h def2.h
177
178 But when the program parses file2.c and discovers that it, too,
179 includes header.h, it does not parse the file, but simply adds
180 header.h, def1.h and def2.h to the list of dependencies for file2.o.
181
183 cc(1), make(1), root(1), root-cint(1)
184
185 See also the ROOT webpages: http://root.cern.ch
186
188 rmkdepend parses, but does not currently evaluate, the SVR4 #predi‐
189 cate(token-list) preprocessor expression; such expressions are simply
190 assumed to be true. This may cause the wrong #include directives to be
191 evaluated.
192
193 Imagine you are parsing two files, say file1.c and file2.c, each
194 includes the file def.h. The list of files that def.h includes might
195 truly be different when def.h is included by file1.c than when it is
196 included by file2.c. But once rmkdepend arrives at a list of dependen‐
197 cies for a file, it is cast in concrete.
198
200 Todd Brunhoff, Tektronix, Inc. and MIT Project Athena. Modified by
201 Christian Holm Christensen <cholm@nbi.dk> for the ROOT distribution.
202
203
204
2054th Berkeley Distribution Version 3 RMKDEPEND(1)