From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.1 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 48800BC6C for ; Thu, 31 Jan 2008 14:51:32 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAABNhoUfAXQImh2dsb2JhbACQKwEBAQgKKZoA X-IronPort-AV: E=Sophos;i="4.25,285,1199660400"; d="asc'?scan'208";a="7472527" Received: from discorde.inria.fr ([192.93.2.38]) by mail1-smtp-roc.national.inria.fr with ESMTP; 31 Jan 2008 14:51:32 +0100 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id m0VDpVVU001698 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Thu, 31 Jan 2008 14:51:31 +0100 X-IronPort-AV: E=Sophos;i="4.25,285,1199660400"; d="asc'?scan'208";a="8573872" Received: from peray.inria.fr (HELO ausone.inria.fr) ([128.93.8.98]) by mail3-relais-sop.national.inria.fr with SMTP; 31 Jan 2008 14:51:31 +0100 Received: by ausone.inria.fr (sSMTP sendmail emulation); Thu, _d Jan 2008 14:50:26 +0100 From: "Nicolas Pouillard" Cc: caml-list Subject: Re: [Caml-list] ocamlbuild and packs To: Romain Bardou References: <47A1B728.1070200@lri.fr> <1201784124-sup-1877@ausone.inria.fr> <47A1D046.2040908@lri.fr> In-Reply-To: <47A1D046.2040908@lri.fr> Date: Thu, 31 Jan 2008 14:50:26 +0100 Message-Id: <1201787059-sup-9108@ausone.inria.fr> User-Agent: Sup/git Content-Type: multipart/signed; protocol="application/pgp-signature"; boundary="=-1201787426-627812-54679-2549-11-="; micalg="pgp-sha1" MIME-Version: 1.0 X-Miltered: at discorde with ID 47A1D263.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; utils:01 ocaml:01 fine-grained:01 cmx:01 -for-pack:01 -for-pack:01 summarized:01 -pack:01 makefile:01 makefile:01 byte:01 byte:01 cmo:01 cmo:01 wiki:01 X-Attachments: cset="UTF-8" type="application/pgp-signature" name="signature.asc" name="signature.asc" --=-1201787426-627812-54679-2549-11-= Content-Type: text/plain; charset=UTF-8 Excerpts from Romain Bardou's message of Thu Jan 31 14:42:30 +0100 2008: > Thanks for your help! > > Now it still doesn't compile, but the error is different and shows that > I'm getting closer. > > What I didn't tell you is that I actually have several directories > "bla", so it is more like this: > > module A > module C > module bla/A > module bla/B > module bli/C > module Main > > You can view the "bla" and "bli" directories as the "parsing" and > "utils" directories of the OCaml source. > > The module bla/A depends on the module bli/C. There is no clash between > names in the directories bla and bli, and I want to pack bla and bli > together in a big module Blabli so Main can access Blabli.A, Blabli.B > and Blabli.C. So I have a file blabli.mlpack: > > bla/A > bla/B > bli/C If there is no name clash due to bli/ you can expose it (-I bli). If not, your last option is fine-grained directory scoping using a plugin. [...] > However, the following command doesn't work: > > ocamlbuild bla.cmx > > Because the files aren't compiled with the -for-pack option. I have to > add "-cflags -for-pack,Bla". I guess it shouldn't be hard to use the > _tags file to make it use the flag only on the files of bla, so I'll try > and investigate that (couldn't it be automatic though?). Using -for-pack is a pain. If your project is not too complex, I can advise to use your _tags that way: $ cat _tags : for-pack(Blabli) # This is to avoid -I bli "bli": include If you need more precise scoping, plugin is your last option. > Nicolas Pouillard a écrit : > > 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. > > > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Caml-list mailing list. Subscription management: > > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > > Archives: http://caml.inria.fr > > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > > Bug reports: http://caml.inria.fr/bin/caml-bugs -- Nicolas Pouillard aka Ertai --=-1201787426-627812-54679-2549-11-= Content-Disposition: attachment; filename="signature.asc" Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (Darwin) iD8DBQFHodIij+FCNw9dwLkRAri5AJ49OoeT6IbS+MNpUeEBgGXv7ezsywCfUaaK s9WP4LPpYiHGm0oop3dDK94= =tv0z -----END PGP SIGNATURE----- --=-1201787426-627812-54679-2549-11-=--