Commit 7a125bbf authored by Stephane Glondu's avatar Stephane Glondu

Revisit ocamlbuild plugin for native/js platform switch

Both variants are declared as internal libs, and we now just have to
tag each executable with the desired version.
parent 5d4fc819
<**/*.{ml,mli,byte,native,odoc}>: debug, annot, thread, package(zarith), package(calendar), package(uuidm), package(cryptokit), package(atdgen), package(yojson)
<**/*.{ml,mli,byte,native,odoc}>: debug, annot, thread, package(uuidm), package(atdgen), package(yojson)
<src/platform/native/*>: package(zarith), package(calendar), package(cryptokit)
<demo/**/*.{ml,mli,byte,native,odoc}>: package(lwt.unix), syntax(camlp4o), package(lwt.syntax)
<src/web/*.{ml,mli,byte,native,odoc}>: package(eliom.server), syntax(camlp4o), package(lwt.syntax), package(csv)
<src/tool/*>: binary, package(cmdliner)
<src/tool/tool_main.*>: package(zarith), package(calendar), package(cryptokit), use_platform-native
<stuff/*>: binary
......@@ -23,21 +23,20 @@ let ( / ) = Filename.concat
let platform_rules kind =
let lib = "src" / "lib" in
let platform = "src" / "platform" / kind / "platform" in
let ml = platform ^ ".ml" in
let mli = platform ^ ".mli" in
let platform_dir = "src" / "platform" in
let platform_mod = platform_dir / kind / "platform" in
let platform_lib = platform_dir / "platform-" ^ kind in
let ml = platform_mod ^ ".ml" in
let mli = platform_mod ^ ".mli" in
let mllib = platform_lib ^ ".mllib" in
rule mllib ~deps:[ml] ~prods:[mllib] (fun _ _ ->
(* technically, there is no dependency, but we need the directory to
exist for the following *)
Echo ([platform_dir / kind / "Platform"; "\n"], mllib)
);
dep ["file:" ^ ml] [mli];
copy_rule mli (lib / "platform.mli") mli
let tool_rules platform =
let platform = "src" / "platform" / platform / "platform" in
let lib = "src" / "lib" / "serializable_builtin_t" in
let lib_native = lib ^ ".cmx" in
let lib_byte = lib ^ ".cmo" in
let cmo = platform ^ ".cmo" in
let cmx = platform ^ ".cmx" in
dep ["file:" ^ lib_native] [cmx];
dep ["file:" ^ lib_byte] [cmo]
copy_rule mli (lib / "platform.mli") mli;
ocaml_lib platform_lib
let () = dispatch & function
......@@ -73,7 +72,6 @@ let () = dispatch & function
platform_rules "native";
platform_rules "js";
tool_rules "native";
copy_rule "belenios-tool" ("src/tool/tool_main" ^ exe_suffix) "belenios-tool";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment