-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmyocamlbuild.ml
58 lines (50 loc) · 1.83 KB
/
myocamlbuild.ml
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
open Ocamlbuild_plugin ;;
open Command;;
(* set the version number of the software in the plugin *)
(* let project = "rot" *)
(* let major = 0 *)
(* let minor = 1 *)
(* let patch = 0 (\* patch level *\) *)
(* let tag = "" (\* build tag *\) *)
(* (\* generate src/version.ml in the plugin *\) *)
(* let version_ml = "src/version.ml" *)
(* let version_file_contents = *)
(* let buf = Buffer.create 255 in *)
(* Printf.bprintf buf "(\* This file is automatically generated!\n" ; *)
(* Printf.bprintf buf " To change version numbers, edit myocamlbuild.ml *\)\n" ; *)
(* Printf.bprintf buf "let major = %d;;\n" major ; *)
(* Printf.bprintf buf "let minor = %d;;\n" minor ; *)
(* Printf.bprintf buf "let patch = %d;;\n" patch ; *)
(* Printf.bprintf buf "let tag = \"%s\";;\n" tag ; *)
(* Printf.bprintf buf "let str = \"%d.%d.%d%s%s\";;\n" *)
(* major minor patch *)
(* (if tag = "" then "" else "-") tag ; *)
(* Buffer.contents buf *)
(* let make_version msg = *)
(* Printf.printf "(Re)Generating %S...%!" version_ml ; *)
(* let ch = open_out version_ml in *)
(* output_string ch version_file_contents ; *)
(* close_out ch ; *)
(* Printf.printf " done.\n%!" *)
let () =
Options.use_ocamlfind := true ;
Options.use_menhir := true ;
(* make_version () *)
;;
let alphaCaml = A"alphaCaml";;
(* the entry point of the plugin *)
let _ =
dispatch begin function
| After_rules ->
flag ["ocaml" ; "compile"] (A "-annot") ;
flag ["ocaml" ; "compile"] (A "-g") ;
flag ["ocaml" ; "compile"; "native" ] (S [(A "-inline"); (A "20")]) ;
(* for alphaCaml *)
rule "alphaCaml: mla -> ml & mli"
~prods:["%.ml"; "%.mli"]
~dep:"%.mla"
begin fun env _build ->
Cmd(S[alphaCaml; P(env "%.mla")])
end
| _ -> ()
end