1OCAMLDEP(1) General Commands Manual OCAMLDEP(1)
2
3
4
6 ocamldep - Dependency generator for OCaml
7
8
10 ocamldep [ options ] filename ...
11
12
14 The ocamldep(1) command scans a set of OCaml source files (.ml and .mli
15 files) for references to external compilation units, and outputs depen‐
16 dency lines in a format suitable for the make(1) utility. This ensures
17 that make will compile the source files in the correct order, and
18 recompile those files that need to when a source file is modified.
19
20 The typical usage is:
21
22 ocamldep options *.mli *.ml > .depend
23
24 where .depend is the file that should contain the dependencies.
25
26 Dependencies are generated both for compiling with the bytecode com‐
27 piler ocamlc(1) and with the native-code compiler ocamlopt(1).
28
29
31 The following command-line options are recognized by ocamldep(1).
32
33 -absname
34 Show absolute filenames in error messages.
35
36 -all Generate dependencies on all required files, rather than assum‐
37 ing implicit dependencies.
38
39 -allow-approx
40 Allow falling back on a lexer-based approximation when parsing
41 fails.
42
43 -as-map
44 For the following files, do not include delayed dependencies for
45 module aliases. This option assumes that they are compiled
46 using options "-no-alias-deps -w -49", and that those files or
47 their interface are passed with the "-map" option when computing
48 dependencies for other files. Note also that for dependencies to
49 be correct in the implementation of a map file, its interface
50 should not coerce any of the aliases it contains.
51
52 -debug-map
53 Dump the delayed dependency map for each map file.
54
55 -I directory
56 Add the given directory to the list of directories searched for
57 source files. If a source file foo.ml mentions an external com‐
58 pilation unit Bar, a dependency on that unit's interface bar.cmi
59 is generated only if the source for bar is found in the current
60 directory or in one of the directories specified with -I. Oth‐
61 erwise, Bar is assumed to be a module from the standard library,
62 and no dependencies are generated. For programs that span multi‐
63 ple directories, it is recommended to pass ocamldep(1) the same
64 -I options that are passed to the compiler.
65
66 -impl file
67 Process file as a .ml file.
68
69 -intf file
70 Process file as a .mli file.
71
72 -map file
73 Read an propagate the delayed dependencies for module aliases in
74 file, so that the following files will depend on the exported
75 aliased modules if they use them.
76
77 -ml-synonym .ext
78 Consider the given extension (with leading dot) to be a synonym
79 for .ml.
80
81 -mli-synonym .ext
82 Consider the given extension (with leading dot) to be a synonym
83 for .mli.
84
85 -modules
86 Output raw dependencies of the form filename: Module1 Mod‐
87 ule2 ... ModuleN where Module1, ..., ModuleN are the names of
88 the compilation units referenced within the file filename, but
89 these names are not resolved to source file names. Such raw
90 dependencies cannot be used by make(1), but can be post-pro‐
91 cessed by other tools such as Omake(1).
92
93 -native
94 Generate dependencies for a pure native-code program (no byte‐
95 code version). When an implementation file (.ml file) has no
96 explicit interface file (.mli file), ocamldep(1) generates
97 dependencies on the bytecode compiled file (.cmo file) to
98 reflect interface changes. This can cause unnecessary bytecode
99 recompilations for programs that are compiled to native-code
100 only. The flag -native causes dependencies on native compiled
101 files (.cmx) to be generated instead of on .cmo files. (This
102 flag makes no difference if all source files have explicit .mli
103 interface files.)
104
105 -one-line
106 Output one line per file, regardless of the length.
107
108 -open module
109 Assume that module module is opened before parsing each of the
110 following files.
111
112 -plugin plugin
113 Dynamically load the code of the given plugin (a .cmo, .cma or
114 .cmxs file) in ocamldep(1). The plugin must exist in the same
115 kind of code as the tool ( ocamldep.byte must load bytecode
116 plugins, while ocamldep.opt must load native code plugins), and
117 extension adaptation is done automatically for .cma files (to
118 .cmxs files if ocamldep(1) is compiled in native code).
119
120 -pp command
121 Cause ocamldep(1) to call the given command as a preprocessor
122 for each source file.
123
124 -ppx command
125 Pipe abstract syntax tree through preprocessor command.
126
127 -shared
128 Generate dependencies for native plugin files (.cmxs) in addi‐
129 tion to native compiled files (.cmx).
130
131 -slash Under Unix, this option does nothing.
132
133 -sort Sort files according to their dependencies.
134
135 -version
136 Print version string and exit.
137
138 -vnum Print short version number and exit.
139
140 -help or --help
141 Display a short usage summary and exit.
142
143
145 ocamlc(1), ocamlopt(1).
146 The OCaml user's manual, chapter "Dependency generator".
147
148
149
150 OCAMLDEP(1)