From: Pietro Abate <Pietro.Abate@pps.jussieu.fr>
To: caml-list@inria.fr
Subject: [Caml-list] for-pack, ocamlbuild and polluted namespace
Date: Fri, 3 Jun 2011 12:14:36 +0200 [thread overview]
Message-ID: <20110603101436.GB19919@pps.jussieu.fr> (raw)
Hello,
I'm trying to fix the build system of my project to fit the
debian policy, but I having few problems with ocamlbuild...
I'm using the ocaml 3.12.
suppose I've 3 modules. A, B, C where
A does not have any dependencies
B depends on A
and C depends on A and B.
assume further that B and C use the same file name for a submodule.
the situation looks like :
A/a.ml
B/aa.ml B/b1.ml
C/aa.ml C/c1.ml
I want to build three libraries avoiding name space clashes using
for-pack. So at the end of the compilation I will have.
A.cmxa (containing A/A.cmx)
B.cmxa (containing B/Aa.cmx , B/B1.cmx)
C.cmxa (containing C/Aa.cmx , C/C1.cmx)
now using ocamlbuild I set up a _tags file with
<b/*.ml> or <b/*.mli>: use_a
<c/*.ml> or <c/*.mli>: use_a, use_b
<a/*.cmx> : for-pack(A)
<b/*.cmx> : for-pack(B)
<c/*.cmx> : for-pack(C)
-------
and my myocmamlbuild looks like :
open Ocamlbuild_plugin;;
ocaml_lib ~dir:"a" "a/a";
ocaml_lib ~dir:"b" "b/b";
ocaml_lib ~dir:"c" "c/c";
-----
so far so good.
A.cmxa is ok, no dependencies.
B.cmxa is also ok. The problem is with C.cmxa that tries to resolve its
dependencies with the interface of the wrong module in b (b/Aa.cmi)
instead of the module in c (this is because of the -I b added by the
ocaml_lib directive). Of course this is just a leftover of the
compilation since everything is already packed. I don't need the cmi of
the individual submodules. If I remove _build/b/Aa.* by hand everything
works as expected...
my question is : How can write an ocamlbuild rule to remove all the
submodules leftover in the directory _build/b leaving only the cmi of
the packed module ? Or more generally, would not be a good idea to
remove these leftovers automatically is -for-pack is used to put all
submodules together ?
Reg the first question what I need is a way to get the list of all the
submodules and then issuing a rm_f command after packing the library...
but how can I get this list ?
thanks,
pietro
--
----
http://en.wikipedia.org/wiki/Posting_style
reply other threads:[~2011-06-03 10:14 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=20110603101436.GB19919@pps.jussieu.fr \
--to=pietro.abate@pps.jussieu.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