caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] [OCamlbuild] Getting cmo's dependencies for linking
@ 2016-03-15 22:57 Kakadu
  0 siblings, 0 replies; only message in thread
From: Kakadu @ 2016-03-15 22:57 UTC (permalink / raw)
  To: Caml List

Hey, folks.

I'm experimenting with ocamlbuild to generate js_of_ocaml toplevel
from my .cmo file. More precisely I'm rewriting js_of_ocaml toplevel
demo [2] to use ocamlbuild as build system.

The issue is that I can't understand how to get local cmos on which my
main.cmo file depends. For example, the following rule definition
doesn't link all dependent cmos to the .byte target

  let f env (_:builder) =
    let dep = env dep in
    let prod = env prod in
    let link_opts = link_opts prod in
    let tags = tags_of_pathname prod ++ "js_of_ocaml" in
    Cmd (S [A "jsoo_mktop"; (* T tags; *) (* S link_opts; *) A "-o";
Px prod; P dep])
  in
  rule "js_of_ocaml toplevel: *.cmo -> .js" ~dep ~prod    f;

I looked a bit at ocamlbuild's sources for cmo -> byte target and it
seems that it does some dark magic about reading  dependencies
generated by ocamldep and filtering only ones which have local cmo
file or something like that [1]. I probably could copy and paste some
functions from there to myocamlbuild.ml... but maybe there is more
cleaner way?


Regards,
Kakadu

[1] https://github.com/ocaml/ocamlbuild/blob/master/src/ocaml_compiler.ml#L264
[2] https://github.com/ocsigen/js_of_ocaml/tree/master/toplevel

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-03-15 22:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-15 22:57 [Caml-list] [OCamlbuild] Getting cmo's dependencies for linking Kakadu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).