Refactor module organisation and build process.
[tatoo.git] / myocamlbuild.ml
1 open Ocamlbuild_plugin
2 open Command
3
4 let ocamlfind_packages = "unix,ulex,expat,camlp4,camlp4.lib,camlp4.macro"
5
6 let ocamlfind x = S[ T (Tags.singleton "ocamlfind");
7                      A "ocamlfind"; x ;
8                      A "-package";
9                      A ocamlfind_packages;
10                      A "-syntax";
11                      A "camlp4o";
12                      A "-ppopt"; A "-I"; A"-ppopt"; A"include"
13                    ]
14
15 let () = dispatch begin
16   function
17     | Before_rules ->
18       Options.ocamlc := ocamlfind  (A"ocamlc");
19       Options.ocamlopt := ocamlfind (A"ocamlopt");
20       Options.ocamldep := ocamlfind (A"ocamldep");
21       Options.ocamldoc := ocamlfind (A"ocamldoc");
22       Options.ocamlmktop := ocamlfind (A"ocamlmktop");
23       dep [ "extension:ml" ]
24         (List.map (fun s -> "include/" ^ s )
25            (Array.to_list (Pathname.readdir "include")));
26       flag [ "ocaml"; "link" ] (A"-linkpkg")
27     | _ -> ()
28 end