2017-05-26 14:30:34 +00:00
|
|
|
open Ocamlbuild_plugin
|
|
|
|
|
|
|
|
let to_opt = List.fold_left (fun acc x -> [A "-ccopt"; A x] @ acc) []
|
|
|
|
let ccopt = to_opt [ "-O3" ; "-Wall" ]
|
|
|
|
|
2017-08-17 17:53:36 +00:00
|
|
|
let os = Ocamlbuild_pack.My_unix.run_and_read "uname -s"
|
|
|
|
|
|
|
|
let vmm_lib = match os with
|
|
|
|
| "FreeBSD\n" -> [A "-cclib"; A "-lvmmapi"]
|
|
|
|
| _ -> []
|
|
|
|
|
|
|
|
|
2017-05-26 14:30:34 +00:00
|
|
|
let () =
|
|
|
|
dispatch begin function
|
|
|
|
| After_rules ->
|
|
|
|
flag ["c"; "compile"] (S ccopt) ;
|
|
|
|
flag ["link"; "library"; "ocaml"; "byte"; "use_vmm_stats"]
|
|
|
|
(S ([A "-dllib"; A "-lvmm_stats_stubs"]));
|
|
|
|
flag ["link"; "library"; "ocaml"; "native"; "use_vmm_stats"]
|
|
|
|
(S ([A "-cclib"; A "-lvmm_stats_stubs"]));
|
2017-08-17 17:53:36 +00:00
|
|
|
flag ["link"; "ocaml"; "link_vmm_stats"]
|
2018-10-25 14:55:54 +00:00
|
|
|
(S ([A "app/libvmm_stats_stubs.a"] @ vmm_lib));
|
|
|
|
dep ["link"; "ocaml"; "use_vmm_stats"] ["app/libvmm_stats_stubs.a"];
|
|
|
|
dep ["link"; "ocaml"; "link_vmm_stats"] ["app/libvmm_stats_stubs.a"];
|
2017-05-26 14:30:34 +00:00
|
|
|
| _ -> ()
|
|
|
|
end
|