forked from ocaml/v2.ocaml.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmyocamlbuild.ml
27 lines (23 loc) · 853 Bytes
/
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
(* OASIS_START *)
(* OASIS_STOP *)
let env = BaseEnvLight.load() (* setup.data *)
let has_compiler_libs =
try
Scanf.sscanf (BaseEnvLight.var_get "ocaml_version" env)
"%i" (fun maj -> maj >= 4)
with _ -> false
let my_dispatch = function
| After_rules ->
if has_compiler_libs then
(* <src/app/*.ml{,i}>: pkg_compiler-libs.toplevel *)
let files = ["src/app/code.cmo"; "src/app/code.cmx";
"src/app/build.byte"; "src/app/build.native"] in
List.iter (fun f -> tag_file f ["pkg_compiler-libs.toplevel"]) files
else (
ocaml_lib ~extern:true "toplevellib";
tag_file "src/app/build.byte" ["use_toplevellib"];
)
| _ -> ()
let () =
Ocamlbuild_plugin.dispatch (MyOCamlbuildBase.dispatch_combine
[ dispatch_default; my_dispatch])