1OCAMLBUILD(1) General Commands Manual OCAMLBUILD(1)
2
3
4
6 ocamlbuild - The OCaml 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 --version
63 same as -version
64
65 -vnum Display the version number
66
67 --vnum same as -vnum
68
69 -quiet Make as quiet as possible
70
71 -verbose <level>
72 Set the verbosity level on a scale from 0 to 8 (included)
73
74 -documentation
75 Show rules and flags
76
77 -log <file>
78 Set log file
79
80 -no-log
81 No log file
82
83 -clean Remove build directory and other files, then exit
84
85 -r Traverse directories by default (true: traverse)
86
87 -I <path>
88 Add to include directories
89
90 -Is <path,...>
91 (same as above, but accepts a (comma or blank)-separated list)
92
93 -X <path>
94 Directory to ignore
95
96 -Xs <path,...>
97 (idem)
98
99 -lib <flag>
100 Link to this ocaml library
101
102 -libs <flag,...>
103 (idem)
104
105 -mod <module>
106 Link to this ocaml module
107
108 -mods <module,...>
109 (idem)
110
111 -pkg <package>
112 Link to this ocaml findlib package
113
114 -pkgs <package,...>
115 (idem)
116
117 -package <package>
118 (idem)
119
120 -syntax <syntax>
121 Specify syntax using ocamlfind
122
123 -lflag <flag>
124 Add to ocamlc link flags
125
126 -lflags <flag,...>
127 (idem)
128
129 -cflag <flag>
130 Add to ocamlc compile flags
131
132 -cflags <flag,...>
133 (idem)
134
135 -docflag <flag>
136 Add to ocamldoc flags
137
138 -docflags <flag,...>
139 (idem)
140
141 -yaccflag <flag>
142 Add to ocamlyacc flags
143
144 -yaccflags <flag,...>
145 (idem)
146
147 -lexflag <flag>
148 Add to ocamllex flags
149
150 -lexflags <flag,...>
151 (idem)
152
153 -ppflag <flag>
154 Add to ocaml preprocessing flags
155
156 -pp <flag,...>
157 (idem)
158
159 -tag <tag>
160 Add to default tags
161
162 -tags <tag,...>
163 (idem)
164
165 -plugin-tag <tag>
166 Use this tag when compiling the myocamlbuild.ml plugin
167
168 -plugin-tags <tag,...>
169 (idem)
170
171 -tag-line <tag>
172 Use this line of tags (as in _tags)
173
174 -show-tags <path>
175 Show tags that applies on that pathname
176
177 -ignore <module,...>
178 Don't try to build these modules
179
180 -no-links
181 Don't make links of produced final targets
182
183 -no-skip
184 Don't skip modules that are requested by ocamldep but cannot be
185 built
186
187 -no-hygiene
188 Don't apply sanity-check rules
189
190 -no-plugin
191 Don't build myocamlbuild.ml
192
193 -no-stdlib
194 Don't ignore stdlib modules
195
196 -dont-catch-errors
197 Don't catch and display exceptions (useful to display the call
198 stack)
199
200 -just-plugin
201 Just build myocamlbuild.ml
202
203 -byte-plugin
204 Don't use a native plugin but bytecode
205
206 -plugin-option
207 Use the option only when plugin is run
208
209 -sanitization-script
210 Change the file name for the generated sanitization script
211
212 -no-sanitize
213 Do not generate sanitization script
214
215 -nothing-should-be-rebuilt
216 Fail if something needs to be rebuilt
217
218 -classic-display
219 Display executed commands the old-fashioned way
220
221 -use-menhir
222 Use menhir instead of ocamlyacc
223
224 -use-jocaml
225 Use jocaml compilers instead of ocaml ones
226
227 -use-ocamlfind
228 Use the 'ocamlfind' wrapper instead of using Findlib directly to
229 determine command-line arguments. Use -no-ocamlfind to disable.
230 Implies -plugin-use-ocamlfind.
231
232 -no-ocamlfind
233 Don't use ocamlfind. Implies -plugin-no-ocamlfind.
234
235 -plugin-use-ocamlfind
236 Use the 'ocamlfind' wrapper for building myocamlbuild.ml
237
238 -plugin-no-ocamlfind
239 Don't use ocamlfind for building myocamlbuild.ml
240
241 -toolchain <toolchain>
242 Set the Findlib toolchain to use. The default toolchain is
243 always used for building myocamlbuild.ml.
244
245 -j <N> Allow N jobs at once (0 for unlimited)
246
247 -build-dir <path>
248 Set build directory (implies no-links)
249
250 -install-lib-dir <path>
251 Set the install library directory
252
253 -install-bin-dir <path>
254 Set the install binary directory
255
256 -where Display the install library directory
257
258 -which <command>
259 Display path to the tool command
260
261 -ocamlc <command>
262 Set the OCaml bytecode compiler
263
264 -plugin-ocamlc <command>
265 Set the OCaml bytecode compiler used when building myocaml‐
266 build.ml (only)
267
268 -ocamlopt <command>
269 Set the OCaml native compiler
270
271 -plugin-ocamlopt <command>
272 Set the OCaml native compiler used when building myocamlbuild.ml
273 (only)
274
275 -ocamldep <command>
276 Set the OCaml dependency tool
277
278 -ocamldoc <command>
279 Set the OCaml documentation generator
280
281 -ocamlyacc <command>
282 Set the ocamlyacc tool
283
284 -menhir <command>
285 Set the menhir tool (use it after -use-menhir)
286
287 -ocamllex <command>
288 Set the ocamllex tool
289
290 -ocamlmklib <command>
291 Set the ocamlmklib tool
292
293 -ocamlmktop <command>
294 Set the ocamlmktop tool
295
296 -ocamlrun <command>
297 Set the ocamlrun tool
298
299 -- Stop argument processing, remaining arguments are given to the
300 user program
301
302 -help Display this list of options
303
304 --help Display this list of options
305
306
308 The ocamlbuild manual, ocaml(1), make(1).
309 The OCaml user's manual, chapter Batch compilation .
310
311
312
313 OCAMLBUILD(1)