OCaml Makefile Shell Standard ML
Clone or download
Failed to load latest commit information.
bootstrap consider files starting with '_' as source files Feb 9, 2016
examples typo (fixes #270) Mar 26, 2018
howto minor howto/release change Nov 11, 2017
man Fix missing files in 23f3db8 Dec 1, 2016
manual typo May 12, 2018
misc Changed OCamlbuild's license to LGPL with static linking exception. Jul 28, 2015
samples/complete-example-menhir-support-in-ocamlbuild Move manual/examples to examples/, manual/samples to samples/ Oct 31, 2016
scripts Replace call to cat by cat.ml Dec 27, 2015
src add the "link" tag to "pack" actions (fixes #272) Mar 26, 2018
test fix test/ directory Jan 5, 2016
testsuite add ppopt(arg) and ppxopt(package,arg) when -use-ocamlfind Jan 2, 2018
.depend Standalone compilation Dec 15, 2015
.gitignore Try to bootstrap ocamlbuild on CI. Feb 28, 2017
.mailmap [minor] .mailmap Mar 1, 2017
.merlin add .merlin Jun 18, 2016
.travis.yml Also build packages using certain ocamlbuild plugins on CI. Feb 28, 2017
CONTRIBUTING.adoc restructure manual/CONTRIBUTING to become the root CONTRIBUTING document May 4, 2016
Changes add the "link" tag to "pack" actions (fixes #272) Mar 26, 2018
LICENSE add the LICENSE file -- closes #8 Dec 27, 2015
META first commit after tagging 0.12.0 Nov 11, 2017
Makefile .install: the field name is 'doc', not 'docdir' Jun 23, 2017
Readme.md Fix link to manual. May 4, 2016
VERSION first commit after tagging 0.12.0 Nov 11, 2017
configure.make Only run native tests if ocamlopt is available (#253) Aug 1, 2017
opam Makefile cleanup Dec 26, 2016



OCamlbuild is a generic build tool, that has built-in rules for building OCaml library and programs.

OCamlbuild was distributed as part of the OCaml distribution for OCaml versions between 3.10.0 and 4.02.3. Starting from OCaml 4.03, it is now released separately.

Your should refer to the OCambuild manual for more informations on how to use ocamlbuild.

Automatic Installation

With opam:

opam install ocamlbuild

If you are testing a not yet released version of OCaml, you may need to use the development version of OCamlbuild. With opam:

opam pin add ocamlbuild --kind=git "https://github.com/ocaml/ocamlbuild.git#master"

Compilation from source

We assume GNU make, which may be named gmake on your system.

  1. Configure.
make configure

The installation location is determined by the installation location of the ocaml compiler. You can set the following configuration variables (make configure VAR=foo):

  • OCAMLBUILD_{PREFIX,BINDIR,LIBDIR} will use opam or ocaml/ocamlfind's settings by default; see configure.make for the precise initialization logic.

  • OCAML_NATIVE: should be true if native compilation is available on your machine, false otherwise

  1. Compile the sources.
  1. Install.
make install

You can also clean the compilation results with make clean, and uninstall a manually-installed OCamlbuild with make uninstall.