~ubuntu-branches/ubuntu/hardy/ocaml-doc/hardy

« back to all changes in this revision

Viewing changes to ocaml.html/manual027.html

  • Committer: Bazaar Package Importer
  • Author(s): Samuel Mimram
  • Date: 2007-09-08 01:49:22 UTC
  • mfrom: (0.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070908014922-lvihyehz0ndq7suu
Tags: 3.10-1
* New upstream release.
* Removed camlp4 documentation since it is not up-to-date.
* Updated to standards version 3.7.2, no changes needed.
* Updated my email address.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
<HTML>
4
4
<HEAD>
5
5
 
6
 
 
7
 
 
8
6
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
9
 
<META name="GENERATOR" content="hevea 1.08">
 
7
<META name="GENERATOR" content="hevea 1.09">
10
8
<LINK rel="stylesheet" type="text/css" href="manual.css">
11
 
<TITLE>
12
 
Dependency generator (ocamldep)
13
 
</TITLE>
 
9
<TITLE>Dependency generator (ocamldep)</TITLE>
14
10
</HEAD>
15
11
<BODY >
16
 
<A HREF="manual026.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
17
 
<A HREF="index.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
18
 
<A HREF="manual028.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
 
12
<A HREF="manual026.html"><IMG SRC="previous_motif.gif" ALT="Previous"></A>
 
13
<A HREF="index.html"><IMG SRC="contents_motif.gif" ALT="Up"></A>
 
14
<A HREF="manual028.html"><IMG SRC="next_motif.gif" ALT="Next"></A>
19
15
<HR>
20
 
 
21
 
<H1 CLASS="chapter"><A NAME="htoc146">Chapter&nbsp;13</A>&nbsp;&nbsp;Dependency generator (ocamldep)</H1> <A NAME="c:camldep"></A>
22
 
 
23
 
The <TT>ocamldep</TT> command scans a set of Objective Caml source files
 
16
<H1 CLASS="chapter"><A NAME="htoc146">Chapter�13</A>��Dependency generator (ocamldep)</H1><P> <A NAME="c:camldep"></A>
 
17
</P><P>The <TT>ocamldep</TT> command scans a set of Objective Caml source files
24
18
(<TT>.ml</TT> and <TT>.mli</TT> files) for references to external compilation units,
25
19
and outputs dependency lines in a format suitable for the <TT>make</TT>
26
20
utility. This ensures that <TT>make</TT> will compile the source files in the
27
21
correct order, and recompile those files that need to when a source
28
 
file is modified.<BR>
29
 
<BR>
30
 
The typical usage is:
31
 
<PRE>
 
22
file is modified.</P><P>The typical usage is:
 
23
</P><PRE>
32
24
        ocamldep <I>options</I> *.mli *.ml &gt; .depend
33
 
</PRE>
 
25
</PRE><P>
34
26
where <TT>*.mli *.ml</TT> expands to all source files in the current
35
27
directory and <TT>.depend</TT> is the file that should contain the
36
 
dependencies. (See below for a typical <TT>Makefile</TT>.)<BR>
37
 
<BR>
38
 
Dependencies are generated both for compiling with the bytecode
39
 
compiler <TT>ocamlc</TT> and with the native-code compiler <TT>ocamlopt</TT>.<BR>
40
 
<BR>
41
 
 
42
 
<H2 CLASS="section"><A NAME="htoc147">13.1</A>&nbsp;&nbsp;Options</H2>
43
 
The following command-line option is recognized by <TT>ocamldep</TT>.
44
 
<DL CLASS="description" COMPACT=compact><DT CLASS="dt-description"><B><TT>-I</TT> <I>directory</I></B><DD CLASS="dd-description">
 
28
dependencies. (See below for a typical <TT>Makefile</TT>.)</P><P>Dependencies are generated both for compiling with the bytecode
 
29
compiler <TT>ocamlc</TT> and with the native-code compiler <TT>ocamlopt</TT>.</P><H2 CLASS="section"><A NAME="htoc147">13.1</A>��Options</H2><P>The following command-line option is recognized by <TT>ocamldep</TT>.</P><DL CLASS="description"><DT CLASS="dt-description"><B><TT>-I</TT> <I>directory</I></B></DT><DD CLASS="dd-description">
45
30
Add the given directory to the list of directories searched for
46
31
source files. If a source file <TT>foo.ml</TT> mentions an external
47
32
compilation unit <TT>Bar</TT>, a dependency on that unit's interface
50
35
Otherwise, <TT>Bar</TT> is assumed to be a module from the standard library,
51
36
and no dependencies are generated. For programs that span multiple
52
37
directories, it is recommended to pass <TT>ocamldep</TT> the same <TT>-I</TT> options
53
 
that are passed to the compiler.<BR>
54
 
<BR>
55
 
<DT CLASS="dt-description"><TT><B>-native</B></TT><DD CLASS="dd-description">
 
38
that are passed to the compiler.</DD><DT CLASS="dt-description"><TT><B>-native</B></TT></DT><DD CLASS="dd-description">
56
39
Generate dependencies for a pure native-code program (no bytecode
57
40
version). When an implementation file (<TT>.ml</TT> file) has no explicit
58
41
interface file (<TT>.mli</TT> file), <TT>ocamldep</TT> generates dependencies on the
61
44
are compiled to native-code only. The flag <TT>-native</TT> causes
62
45
dependencies on native compiled files (<TT>.cmx</TT>) to be generated instead
63
46
of on <TT>.cmo</TT> files. (This flag makes no difference if all source files
64
 
have explicit <TT>.mli</TT> interface files.)<BR>
65
 
<BR>
66
 
<DT CLASS="dt-description" style="background-color:yellow; color:red"><TT><B>-version</B></TT><DD CLASS="dd-description" style="background-color:yellow; color:red">
67
 
Print version and exit.</DL>
68
 
 
69
 
<H2 CLASS="section"><A NAME="htoc148">13.2</A>&nbsp;&nbsp;A typical Makefile</H2>
70
 
Here is a template <TT>Makefile</TT> for a Objective Caml program.
71
 
<PRE CLASS="verbatim">
72
 
OCAMLC=ocamlc
 
47
have explicit <TT>.mli</TT> interface files.)</DD><DT CLASS="dt-description"><TT><B>-version</B></TT></DT><DD CLASS="dd-description">
 
48
Print version and exit.</DD></DL><H2 CLASS="section"><A NAME="htoc148">13.2</A>��A typical Makefile</H2><P>Here is a template <TT>Makefile</TT> for a Objective Caml program.</P><PRE CLASS="verbatim">OCAMLC=ocamlc
73
49
OCAMLOPT=ocamlopt
74
50
OCAMLDEP=ocamldep
75
51
INCLUDES=                 # all relevant -I options here
116
92
        $(OCAMLDEP) $(INCLUDES) *.mli *.ml &gt; .depend
117
93
 
118
94
include .depend
119
 
</PRE>
120
 
 
121
 
 
122
 
<HR>
123
 
<A HREF="manual026.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
124
 
<A HREF="index.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
125
 
<A HREF="manual028.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
 
95
</PRE><HR>
 
96
<A HREF="manual026.html"><IMG SRC="previous_motif.gif" ALT="Previous"></A>
 
97
<A HREF="index.html"><IMG SRC="contents_motif.gif" ALT="Up"></A>
 
98
<A HREF="manual028.html"><IMG SRC="next_motif.gif" ALT="Next"></A>
126
99
</BODY>
127
100
</HTML>