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 -nocwd Do not add current working directory to the list of include
67 directories.
68
69 -impl file
70 Process file as a .ml file.
71
72 -intf file
73 Process file as a .mli file.
74
75 -map file
76 Read an propagate the delayed dependencies for module aliases in
77 file, so that the following files will depend on the exported
78 aliased modules if they use them.
79
80 -ml-synonym .ext
81 Consider the given extension (with leading dot) to be a synonym
82 for .ml.
83
84 -mli-synonym .ext
85 Consider the given extension (with leading dot) to be a synonym
86 for .mli.
87
88 -modules
89 Output raw dependencies of the form filename: Module1 Mod‐
90 ule2 ... ModuleN where Module1, ..., ModuleN are the names of
91 the compilation units referenced within the file filename, but
92 these names are not resolved to source file names. Such raw
93 dependencies cannot be used by make(1), but can be post-pro‐
94 cessed by other tools such as Omake(1).
95
96 -native
97 Generate dependencies for a pure native-code program (no byte‐
98 code version). When an implementation file (.ml file) has no
99 explicit interface file (.mli file), ocamldep(1) generates
100 dependencies on the bytecode compiled file (.cmo file) to
101 reflect interface changes. This can cause unnecessary bytecode
102 recompilations for programs that are compiled to native-code
103 only. The flag -native causes dependencies on native compiled
104 files (.cmx) to be generated instead of on .cmo files. (This
105 flag makes no difference if all source files have explicit .mli
106 interface files.)
107
108 -one-line
109 Output one line per file, regardless of the length.
110
111 -open module
112 Assume that module module is opened before parsing each of the
113 following files.
114
115 -pp command
116 Cause ocamldep(1) to call the given command as a preprocessor
117 for each source file.
118
119 -ppx command
120 Pipe abstract syntax tree through preprocessor command.
121
122 -shared
123 Generate dependencies for native plugin files (.cmxs) in addi‐
124 tion to native compiled files (.cmx).
125
126 -slash Under Unix, this option does nothing.
127
128 -sort Sort files according to their dependencies.
129
130 -version
131 Print version string and exit.
132
133 -vnum Print short version number and exit.
134
135 -help or --help
136 Display a short usage summary and exit.
137
138
140 ocamlc(1), ocamlopt(1).
141 The OCaml user's manual, chapter "Dependency generator".
142
143
144
145 OCAMLDEP(1)