From: Romain Bardou <Romain.Bardou@lri.fr>
To: Josh Berdine <jjb@microsoft.com>
Cc: "caml-list@yquem.inria.fr" <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] ocamlbuild: ml -> cmx & cmi & o ?
Date: Thu, 16 Oct 2008 10:30:49 +0200 [thread overview]
Message-ID: <48F6FBB9.7030107@lri.fr> (raw)
In-Reply-To: <857DD0FDAC042B4485F9F5F4EA6751041E4CEEEDBC@EA-EXMSG-C332.europe.corp.microsoft.com>
> I observe that ocamlbuild does not build cmx cmi and o files from a ml
> file (which has no associated mli) directly. Do others see different
> behavior? Instead it builds cmo and cmi from the ml using ocamlc, and
> then builds the cmx and o files from there using ocamlopt. Is there a
> reason I’m missing that ocamlbuild does not have a default rule for this
> case, using only one call to ocamlopt? If so, is there an easy way to
> do this with a plugin?
I observe the same behavior. I think it's just a matter of reordering
the rules in ocaml_specific.ml, as the following plug-in solves the
problem thanks to "~insert: `top":
open Ocamlbuild_plugin
let () = dispatch begin function
| After_rules ->
rule "ml -> cmx"
~dep: "%.ml"
~prods: ["%.cmx"; "%.o"; "%.cmi"]
~insert: `top
begin fun env _ ->
let ml = env "%.ml" in
Cmd(S[!Options.ocamlopt; A "-c"; P ml])
end
| _ -> ()
end
--
Romain Bardou
next prev parent reply other threads:[~2008-10-16 8:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-15 11:00 Josh Berdine
2008-10-16 8:30 ` Romain Bardou [this message]
2008-10-16 8:43 ` [Caml-list] " Nicolas Pouillard
2008-10-16 8:53 ` Romain Bardou
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=48F6FBB9.7030107@lri.fr \
--to=romain.bardou@lri.fr \
--cc=caml-list@yquem.inria.fr \
--cc=jjb@microsoft.com \
/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