Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "Grégoire Sutre" <gregoire.sutre@labri.fr>
To: caml-list@inria.fr
Subject: ocamlbuild - which source files for tag declarations?
Date: Wed, 30 Jun 2010 16:47:10 +0200	[thread overview]
Message-ID: <4C2B58EE.6090603@labri.fr> (raw)

Hi,

I'm having difficulties understanding on which files I should declare 
tags: *.ml, or *.cmo/cmx?

For instance, with normal (non-parameterized) tags, declaring the tag
on the .cmo/.cmx seems to have no effect on the compilation, for
instance:

$ cat _tags
<*.cmo>: annot
<*.cmx>: annot
$ ocamlbuild -classic-display A.cmo A.cmx
/usr/pkg/bin/ocamldep.opt -modules A.ml > A.ml.depends
/usr/pkg/bin/ocamlc.opt -c -o A.cmo A.ml
/usr/pkg/bin/ocamlopt.opt -c -o A.cmx A.ml

Here, tagging *.cmo/cmx has no effect.  The _build/_log says:

# Target: A.cmo, tags: { byte, compile, extension:ml, file:A.ml, implem, 
ocaml, quiet, traverse }

The tag annot is not there.  But if *.ml is used instead of *.cmo in
_tags, then the tag appears in the above target.  Does this mean that
tags to customize compilation commands should be declared on the *.ml
files?  (Hence they necessarily apply to both .cmo and .cmx files?)

The situation looks a bit different with parameterized tags, for
instance :

$ cat _tags
<*.cmo>: pp(foo)
<*.cmx>: pp(foo)
$ ocamlbuild -classic-display A.cmo A.cmx
/usr/pkg/bin/ocamldep.opt -modules A.ml > A.ml.depends
/usr/pkg/bin/ocamlc.opt -c -o A.cmo A.ml
/usr/pkg/bin/ocamlopt.opt -c -pp foo -o A.cmx A.ml

Here, the pp(foo) tag is ignored for the *.cmo declaration, but it is
used for the *.cmx declaration.  Is this behavior intended?  The code
says (ocaml_specific.ml):

pflag ["ocaml"; "compile"] "pp"
     (fun param -> S [A "-pp"; A param]);

So I wonder why pp(foo) only applies to *.cmx.

Thanks for your help,

Grégoire


                 reply	other threads:[~2010-06-30 14:47 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=4C2B58EE.6090603@labri.fr \
    --to=gregoire.sutre@labri.fr \
    --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