1OCAMLBUILD(1) General Commands Manual OCAMLBUILD(1)
2
3
4
6 ocamlbuild - The Objective Caml project compilation tool
7
8
9
11 ocamlbuild [ -Is dir1,... ] [ -libs lib1,... ] [ -lflags flag1,...
12 ] [ -pp flags ] [ -tags tag1,... ] [ -j parallel-jobs ] target.native
13 [ -- arg1 arg2 ... ]
14
15 (same options)
16
17
19 ocamlbuild(1) orchestrates the compilation process of your OCaml
20 project. It is similar in function to make(1) except that it is tai‐
21 lor-made to automatically compile most OCaml projects with very little
22 user input.
23
24 ocamlbuild should be invoked in the root of a clean project tree (e.g.,
25 with no leftover compilation files). Given one or more targets to com‐
26 pile, it scans the required subdirectories to gather information about
27 the various files present, running tools such as ocamldep(1) to extract
28 dependency information, and gathering optional files that fine-tune its
29 behaviour. Target names are very significant.
30
31
33 ocamlbuild uses a set of target naming conventions to select the kind
34 of objects to produce. Target names are of the form base.extension
35 where base is usually the name of the underlying Ocaml module and
36 extension denotes the kind of object to produce from that file -- a
37 byte code executable, a native executable, documentation... Of course
38 extensions such as .cmo, .cma, .cmi... map to their usual counter‐
39 parts. Here is a list of the most important ocamlbuild-specific exten‐
40 sions:
41
42
43 .native Native code executable
44
45
46 .byte Byte code executable
47
48
49 .inferred.mli Interface inferred with ocamlc-i
50
51
52 .docdir/index.html HTML documentation generated with ocamldoc
53
54
56 The following command-line options are recognized by ocamlbuild(1).
57
58
59 -version
60 Display the version
61
62 -quiet Make as quiet as possible
63
64 -verbose <level>
65 Set the verbose level
66
67 -documentation
68 Show rules and flags
69
70 -log <file>
71 Set log file
72
73 -no-log
74 No log file
75
76 -clean Remove build directory and other files, then exit
77
78 -I <path>
79 Add to include directories
80
81 -Is <path,...>
82 (same as above, but accepts a comma-separated list)
83
84 -X <path>
85 Directory to ignore
86
87 -Xs <path,...>
88 (idem)
89
90 -lib <flag>
91 Link to this ocaml library
92
93 -libs <flag,...>
94 (idem)
95
96 -lflag <flag>
97 Add to ocamlc link flags
98
99 -lflags <flag,...>
100 (idem)
101
102 -cflag <flag>
103 Add to ocamlc compile flags
104
105 -cflags <flag,...>
106 (idem)
107
108 -yaccflag <flag>
109 Add to ocamlyacc flags
110
111 -yaccflags <flag,...>
112 (idem)
113
114 -lexflag <flag>
115 Add to ocamllex flags
116
117 -lexflags <flag,...>
118 (idem)
119
120 -ppflag <flag>
121 Add to ocaml preprocessing flags
122
123 -pp <flag,...>
124 (idem)
125
126 -tag <tag>
127 Add to default tags
128
129 -tags <tag,...>
130 (idem)
131
132 -ignore <module,...>
133 Don't try to build these modules
134
135 -no-links
136 Don't make links of produced final targets
137
138 -no-skip
139 Don't skip modules that are requested by ocamldep but cannot be
140 built
141
142 -no-hygiene
143 Don't apply sanity-check rules
144
145 -no-plugin
146 Don't build myocamlbuild.ml
147
148 -no-stdlib
149 Don't ignore stdlib modules
150
151 -just-plugin
152 Just build myocamlbuild.ml
153
154 -byte-plugin
155 Don't use a native plugin but bytecode
156
157 -no-sanitize
158 Do not enforce sanity-check rules
159
160 -nothing-should-be-rebuilt
161 Fail if something needs to be rebuilt
162
163 -classic-display
164 Display executed commands the old-fashioned way
165
166 -j <N> Allow N jobs at once (0 for unlimited)
167
168 -build-dir <path>
169 Set build directory
170
171 -install-dir <path>
172 Set the install directory
173
174 -where Display the install directory
175
176 -ocamlc <command>
177 Set the OCaml bytecode compiler
178
179 -ocamlopt <command>
180 Set the OCaml native compiler
181
182 -ocamldep <command>
183 Set the OCaml dependency tool
184
185 -ocamlyacc <command>
186 Set the ocamlyacc tool
187
188 -ocamllex <command>
189 Set the ocamllex tool
190
191 -ocamlrun <command>
192 Set the ocamlrun tool
193
194 -- Stop argument processing, remaining arguments are given to the
195 user program
196
197 -help Display the list of options
198
199 --help Display the list of options
200
202 The ocamlbuild manual, ocaml(1), make(1).
203 The Objective Caml user's manual, chapter Batch compilation .
204
205
206
207 OCAMLBUILD(1)