caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Romain Bardou <Romain.Bardou@lri.fr>
To: caml-list@inria.fr
Subject: ocamlbuild and packs
Date: Thu, 31 Jan 2008 12:55:20 +0100	[thread overview]
Message-ID: <47A1B728.1070200@lri.fr> (raw)

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

Now if I compile using:

	ocamlbuild Main.byte

I get the following error:

	Unbound module Bla.A

I can't compile using:

	ocamlbuild -I bla Main.byte

Because now the module A is defined twice.

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

I get the following error:

	Solver failed:
	  Ocamlbuild cannot find or build bla.ml.

(but the file bla.mlpack does exist).
Actually at first I did that from a parent directory, so the command I 
used looked more like:

	ocamlbuild -I dir dir/bla.cmo

And the error was different:

	Solver failed:
	  Ocamlbuild knows of no rules that apply to a target named dir/bla.mly.

There is no such file as dir/bla.mly anywhere on my drive, although the 
project does contain some other mly files.

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

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

-- 
Romain Bardou


             reply	other threads:[~2008-01-31 11:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-31 11:55 Romain Bardou [this message]
2008-01-31 13:01 ` [Caml-list] " Nicolas Pouillard
2008-01-31 13:42   ` 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
2010-11-18 15:10 Thomas Gazagnaire
2010-11-19  8:59 ` Sylvain Le Gall
2010-11-18 15:29 Thomas Gazagnaire

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=47A1B728.1070200@lri.fr \
    --to=romain.bardou@lri.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;
as well as URLs for NNTP newsgroup(s).