Merge commit 'ocaml3102'
[ocaml.git] / man / ocamldep.m
blob7b24082afec02e8417efd4a4dd3f335e5cbd0c9e
1 .TH OCAMLDEP 1
3 .SH NAME
4 ocamldep \- Dependency generator for Objective Caml
6 .SH SYNOPSIS
7 .B ocamldep 
9 .BI \-I \ lib-dir
11 .I filename ...
13 .SH DESCRIPTION
15 The 
16 .BR ocamldep (1)
17 command scans a set of Objective Caml source files
18 (.ml and .mli files) for references to external compilation units,
19 and outputs dependency lines in a format suitable for the
20 .BR make (1)
21 utility. This ensures that make will compile the source files in the
22 correct order, and recompile those files that need to when a source
23 file is modified.
25 The typical usage is:
27 ocamldep 
28 .I options
29 *.mli *.ml > .depend
31 where .depend is the file that should contain the
32 dependencies.
34 Dependencies are generated both for compiling with the bytecode
35 compiler 
36 .BR ocamlc (1)
37 and with the native-code compiler 
38 .BR ocamlopt (1).
40 .SH OPTIONS
42 The following command-line option is recognized by 
43 .BR ocamldep (1).
45 .TP
46 .BI \-I \ directory
47 Add the given directory to the list of directories searched for
48 source files. If a source file foo.ml mentions an external
49 compilation unit Bar, a dependency on that unit's interface
50 bar.cmi is generated only if the source for bar is found in the
51 current directory or in one of the directories specified with 
52 .BR -I .
53 Otherwise, Bar is assumed to be a module from the standard library,
54 and no dependencies are generated. For programs that span multiple
55 directories, it is recommended to pass 
56 .BR ocamldep (1)
57 the same -I options that are passed to the compiler.
59 .TP
60 .BI \-native
61 Generate dependencies for a pure native-code program (no bytecode
62 version).  When an implementation file (.ml file) has no explicit
63 interface file (.mli file),
64 .BR ocamldep (1)
65 generates dependencies on the
66 bytecode compiled file (.cmo file) to reflect interface changes.
67 This can cause unnecessary bytecode recompilations for programs that
68 are compiled to native-code only.  The flag
69 .BR -native
70 causes dependencies on native compiled files (.cmx) to be generated instead
71 of on .cmo files.  (This flag makes no difference if all source files
72 have explicit .mli interface files.)
74 .SH SEE ALSO
75 .BR ocamlc (1),
76 .BR ocamlopt (1).
77 .br
78 .I The Objective Caml user's manual,
79 chapter "Dependency generator".