1 .\"**************************************************************************
2 .\"* *
3 .\"* OCaml *
4 .\"* *
5 .\"* Xavier Leroy, projet Cristal, INRIA Rocquencourt *
6 .\"* *
7 .\"* Copyright 1996 Institut National de Recherche en Informatique et *
8 .\"* en Automatique. *
9 .\"* *
10 .\"* All rights reserved. This file is distributed under the terms of *
11 .\"* the GNU Lesser General Public License version 2.1, with the *
12 .\"* special exception on linking described in the file LICENSE. *
13 .\"* *
14 .\"**************************************************************************
15 .\"
16 .TH OCAMLDEP 1
17
18 .SH NAME
19 ocamldep \- Dependency generator for OCaml
20
21 .SH SYNOPSIS
22 .B ocamldep
23 [
24 .I options
25 ]
26 .I filename ...
27
28 .SH DESCRIPTION
29
30 The
31 .BR ocamldep (1)
32 command scans a set of OCaml source files
33 (.ml and .mli files) for references to external compilation units,
34 and outputs dependency lines in a format suitable for the
35 .BR make (1)
36 utility. This ensures that make will compile the source files in the
37 correct order, and recompile those files that need to when a source
38 file is modified.
39
40 The typical usage is:
41 .P
42 ocamldep
43 .I options
44 *.mli *.ml > .depend
45 .P
46 where .depend is the file that should contain the
47 dependencies.
48
49 Dependencies are generated both for compiling with the bytecode
50 compiler
51 .BR ocamlc (1)
52 and with the native-code compiler
53 .BR ocamlopt (1).
54
55 .SH OPTIONS
56
57 The following command-line options are recognized by
58 .BR ocamldep (1).
59 .TP
60 .B \-absname
61 Show absolute filenames in error messages.
62 .TP
63 .B \-all
64 Generate dependencies on all required files, rather than assuming
65 implicit dependencies.
66 .TP
67 .B \-allow\-approx
68 Allow falling back on a lexer-based approximation when parsing fails.
69 .TP
70 .B \-as\-map
71 For the following files, do not include delayed dependencies for
72 module aliases.
73 This option assumes that they are compiled using options
74 "\-no\-alias\-deps \-w \-49", and that those files or their interface are
75 passed with the "\-map" option when computing dependencies for other
76 files. Note also that for dependencies to be correct in the
77 implementation of a map file, its interface should not coerce any of
78 the aliases it contains.
79 .TP
80 .B \-debug\-map
81 Dump the delayed dependency map for each map file.
82 .TP
83 .BI \-I \ directory
84 Add the given directory to the list of directories searched for
85 source files. If a source file foo.ml mentions an external
86 compilation unit Bar, a dependency on that unit's interface
87 bar.cmi is generated only if the source for bar is found in the
88 current directory or in one of the directories specified with
89 .BR \-I .
90 Otherwise, Bar is assumed to be a module from the standard library,
91 and no dependencies are generated. For programs that span multiple
92 directories, it is recommended to pass
93 .BR ocamldep (1)
94 the same
95 .B \-I
96 options that are passed to the compiler.
97 .TP
98 .BI \-impl \ file
99 Process
100 .IR file
101 as a .ml file.
102 .TP
103 .BI \-intf \ file
104 Process
105 .IR file
106 as a .mli file.
107 .TP
108 .BI \-map \ file
109 Read an propagate the delayed dependencies for module aliases in
110 .IR file ,
111 so that the following files will depend on the
112 exported aliased modules if they use them.
113 .TP
114 .BI \-ml\-synonym \ .ext
115 Consider the given extension (with leading dot) to be a synonym for .ml.
116 .TP
117 .BI \-mli\-synonym \ .ext
118 Consider the given extension (with leading dot) to be a synonym for .mli.
119 .TP
120 .B \-modules
121 Output raw dependencies of the form
122 .IR filename : \ Module1\ Module2 \ ... \ ModuleN
123 where
124 .IR Module1 ,\ ..., \ ModuleN
125 are the names of the compilation
126 units referenced within the file
127 .IR filename ,
128 but these names are not
129 resolved to source file names. Such raw dependencies cannot be used
130 by
131 .BR make (1),
132 but can be post-processed by other tools such as
133 .BR Omake (1).
134 .TP
135 .BI \-native
136 Generate dependencies for a pure native-code program (no bytecode
137 version). When an implementation file (.ml file) has no explicit
138 interface file (.mli file),
139 .BR ocamldep (1)
140 generates dependencies on the
141 bytecode compiled file (.cmo file) to reflect interface changes.
142 This can cause unnecessary bytecode recompilations for programs that
143 are compiled to native-code only. The flag
144 .B \-native
145 causes dependencies on native compiled files (.cmx) to be generated instead
146 of on .cmo files. (This flag makes no difference if all source files
147 have explicit .mli interface files.)
148 .TP
149 .B \-one-line
150 Output one line per file, regardless of the length.
151 .TP
152 .BI \-open \ module
153 Assume that module
154 .IR module
155 is opened before parsing each of the
156 following files.
157 .TP
158 .BI \-pp \ command
159 Cause
160 .BR ocamldep (1)
161 to call the given
162 .I command
163 as a preprocessor for each source file.
164 .TP
165 .BI \-ppx \ command
166 Pipe abstract syntax tree through preprocessor
167 .IR command .
168 .TP
169 .B \-shared
170 Generate dependencies for native plugin files (.cmxs) in addition to
171 native compiled files (.cmx).
172 .TP
173 .B \-slash
174 Under Unix, this option does nothing.
175 .TP
176 .B \-sort
177 Sort files according to their dependencies.
178 .TP
179 .B \-version
180 Print version string and exit.
181 .TP
182 .B \-vnum
183 Print short version number and exit.
184 .TP
185 .BR \-help \ or \ \-\-help
186 Display a short usage summary and exit.
187
188 .SH SEE ALSO
189 .BR ocamlc (1),
190 .BR ocamlopt (1).
191 .br
192 .IR The\ OCaml\ user's\ manual ,
193 chapter "Dependency generator".
194