File: myocamlbuild.ml

package info (click to toggle)
ocaml-benchmark 0.9-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze, wheezy
  • size: 236 kB
  • ctags: 222
  • sloc: ml: 689; makefile: 151; sh: 57; perl: 12
file content (35 lines) | stat: -rw-r--r-- 892 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
open Ocamlbuild_plugin
open Command
;;

Options.make_links := false;;

dispatch begin function
| After_rules ->
    ocaml_lib "benchmark";

    let pcre = [A"-I"; A"+pcre"] in
    flag ["compile"; "ocaml"; "use_pcre"] (S pcre);
    flag ["link"; "program"; "ocaml"; "byte"; "use_pcre"]
      (S(pcre @ [A"pcre.cma"]));
    flag ["link"; "program"; "ocaml"; "native"; "use_pcre"]
      (S(pcre @ [A"pcre.cmxa"]));

    let examples_rule ext =
      let examples =
        Array.fold_right begin fun f acc ->
          if Pathname.get_extension f = "ml" then
            ("examples" / Pathname.update_extension ext f) :: acc
          else
            acc
        end (Pathname.readdir "examples") [] in
      rule ("All examples " ^ ext)
        ~prod:("examples." ^ ext)
        ~deps:examples
        (fun _ _ -> Nop) in

    examples_rule "byte";
    examples_rule "native";

| _ -> ()
end