1
2
3OCAMLDEP(1) General Commands Manual OCAMLDEP(1)
4
5
6
8 ocamldep - Dependency generator for Objective Caml
9
10
12 ocamldep [ options ] filename ...
13
14
16 The ocamldep(1) command scans a set of Objective Caml source files (.ml
17 and .mli files) for references to external compilation units, and out‐
18 puts dependency lines in a format suitable for the make(1) utility.
19 This ensures that make will compile the source files in the correct
20 order, and recompile those files that need to when a source file is
21 modified.
22
23 The typical usage is:
24
25 ocamldep options *.mli *.ml > .depend
26
27 where .depend is the file that should contain the dependencies.
28
29 Dependencies are generated both for compiling with the bytecode com‐
30 piler ocamlc(1) and with the native-code compiler ocamlopt(1).
31
32
34 The following command-line options are recognized by ocamldep(1).
35
36 -I directory
37 Add the given directory to the list of directories searched for
38 source files. If a source file foo.ml mentions an external com‐
39 pilation unit Bar, a dependency on that unit's interface bar.cmi
40 is generated only if the source for bar is found in the current
41 directory or in one of the directories specified with -I. Oth‐
42 erwise, Bar is assumed to be a module from the standard library,
43 and no dependencies are generated. For programs that span multi‐
44 ple directories, it is recommended to pass ocamldep(1) the same
45 -I options that are passed to the compiler.
46
47 -modules
48 Output raw dependencies of the form filename: Module1 Mod‐
49 ule2 ... ModuleN where Module1, ..., ModuleN are the names of
50 the compilation units referenced within the file filename, but
51 these names are not resolved to source file names. Such raw
52 dependencies cannot be used by make(1), but can be post-pro‐
53 cessed by other tools such as Omake(1).
54
55 -native
56 Generate dependencies for a pure native-code program (no byte‐
57 code version). When an implementation file (.ml file) has no
58 explicit interface file (.mli file), ocamldep(1) generates
59 dependencies on the bytecode compiled file (.cmo file) to
60 reflect interface changes. This can cause unnecessary bytecode
61 recompilations for programs that are compiled to native-code
62 only. The flag -native causes dependencies on native compiled
63 files (.cmx) to be generated instead of on .cmo files. (This
64 flag makes no difference if all source files have explicit .mli
65 interface files.)
66
67 -pp command
68 Cause ocamldep(1) to call the given command as a preprocessor
69 for each source file.
70
71 -slash Under Unix, this option does nothing.
72
73 -version
74 Print version and exit.
75
76 -help or --help
77 Display a short usage summary and exit.
78
79
81 ocamlc(1), ocamlopt(1).
82 The Objective Caml user's manual, chapter "Dependency generator".
83
84
85
86 OCAMLDEP(1)