Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "Nicolas Pouillard" <nicolas.pouillard@gmail.com>
To: Romain Bardou <romain.bardou@lri.fr>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] ocamlbuild and packs
Date: Thu, 31 Jan 2008 14:01:41 +0100	[thread overview]
Message-ID: <1201784124-sup-1877@ausone.inria.fr> (raw)
In-Reply-To: <47A1B728.1070200@lri.fr>

[-- Attachment #1: Type: text/plain, Size: 2475 bytes --]

Excerpts from Romain Bardou's message of Thu Jan 31 12:55:20 +0100 2008:
> Hello,
Hello,

> I have this big project I work on, which could be summarized like this:
> 
>     module A
>     module bla/A
>     module bla/B
>     module Main
> 
> The module B in the bla directory depends on the module A of the bla 
> directory. The module Main depends on both modules A and on module B. 
> For some reasons I cannot rename either of the modules.
> 
> So what I do is pack A and B in a Bla module, so I can write Bla.A and 
> Bla.B, using the -pack command line option. It works with my Makefile.
> 
> Now I try to use ocamlbuild, because I really like its approach (I come 
> from the Pascal world where no makefile is needed). So I made this file 
> bla.mlpack containing the lines:
> 
>     A
>     B

bla.mlpack should not be in the bla/ directory, and should contain:

bla/A
bla/B

Because you don't want to expose bla to all your modules since you have a name clash.

> Now if I compile using:
> 
>     ocamlbuild Main.byte

Does it works now?

[...]

> I can't compile using:
> 
>     ocamlbuild -I bla Main.byte
> 
> Because now the module A is defined twice.

Yes

> So I tried to compile using two steps: first, compile bla.cmo, and then, 
> compile Main.byte, but ocamlbuild doesn't seem to be good at that (and 
> actually that's not a bad thing imo). Indeed, if I do:
>
>     ocamlbuild bla.cmo

You  won't  trick  ocamlbuild  with  this  technique,  but  it's a good way to
specifically found what's should be buildable and is not.

[...]

> Now for the questions:
> 1) What is the best way to compile my project? By "best" I mean: with no 
> plugin if possible, with a small _tags file, and as few command line 
> options as possible, while still keeping the spirit of ocamlbuild (for 
> instance, compiling everything in one single call to ocamlbuild if 
> possible).

In  most of cases it will works. However precise directory scopes and packages
contents and scope can be done in a plugin.

> 2) Why doesn't ocamlbuild compile my file bla.mlpack into bla.cmo? In 
> the manual I can read that "%.mlpack" has target "%.cmo".

Yes there is such a rule.

> 3) If ocamlbuild actually did compile bla.cmo, could it use it to 
> compile main.byte or must I build a library bla.cma first?

Yes it will use it.

> Thanks. I would be glad to contribute to the wiki, but I have to 
> understand ocamlbuild first ;)

I would be thankful.

-- 
Nicolas Pouillard aka Ertai

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 186 bytes --]

  reply	other threads:[~2008-01-31 13:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-31 11:55 Romain Bardou
2008-01-31 13:01 ` Nicolas Pouillard [this message]
2008-01-31 13:42   ` [Caml-list] " Romain Bardou
2008-01-31 13:50     ` Nicolas Pouillard
2008-01-31 14:04       ` Romain Bardou
2008-01-31 14:11         ` Romain Bardou
2008-01-31 14:13           ` Nicolas Pouillard
2008-01-31 14:14         ` Nicolas Pouillard
2008-01-31 14:35           ` Romain Bardou
2008-01-31 14:42             ` Nicolas Pouillard

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=1201784124-sup-1877@ausone.inria.fr \
    --to=nicolas.pouillard@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=romain.bardou@lri.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