caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* ocamlbuild - which source files for tag declarations?
@ 2010-06-30 14:47 Grégoire Sutre
  0 siblings, 0 replies; only message in thread
From: Grégoire Sutre @ 2010-06-30 14:47 UTC (permalink / raw)
  To: caml-list

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


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

only message in thread, other threads:[~2010-06-30 14:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-30 14:47 ocamlbuild - which source files for tag declarations? Grégoire Sutre

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).