Using alphaCaml with ocamlbuild

From Gallium

Jump to: navigation, search

Here is a plugin to use alphaCaml:

$ cat myocamlbuild.ml
open Ocamlbuild_plugin;;
open Command;;

let alphaCaml = A"alphaCaml";;

dispatch begin function
  | After_rules ->
      rule "alphaCaml: mla -> ml & mli"
        ~prods:["%.ml"; "%.mli"]
        ~dep:"%.mla"
      begin fun env _build ->
        Cmd(S[alphaCaml; P(env "%.mla")])
      end
  | _ -> ()
end

Then one can either use ocamlfind (see Using ocamlfind with ocamlbuild), or let ocamlbuild link everything itself.

The second method can be achieved this way.

# This link should be created by your ./configure script
# The pointed directory contains the compiled files (.cmo, .cmi).
$ ln -s /path/to/your/alphaCaml/directory/ alphaLib

$ cat _tags
"alphaLib": include, precious
Personal tools
Espace privé