From: Kakadu <kakadu.hafanana@gmail.com>
To: Caml List <caml-list@inria.fr>
Subject: [Caml-list] [OCamlbuild] Getting cmo's dependencies for linking
Date: Wed, 16 Mar 2016 01:57:01 +0300 [thread overview]
Message-ID: <CAGmVoG0FmjjZS7f968vqoXx9mYZh5Pv3bx_CS65FyzqX=XOgmQ@mail.gmail.com> (raw)
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
reply other threads:[~2016-03-15 22:57 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAGmVoG0FmjjZS7f968vqoXx9mYZh5Pv3bx_CS65FyzqX=XOgmQ@mail.gmail.com' \
--to=kakadu.hafanana@gmail.com \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox