From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id D33D0BB83 for ; Fri, 21 Jul 2006 14:48:46 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k6LCmkre029154 for ; Fri, 21 Jul 2006 14:48:46 +0200 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id OAA20255 for ; Fri, 21 Jul 2006 14:48:45 +0200 (MET DST) Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.171]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k6LCmjJL029149 for ; Fri, 21 Jul 2006 14:48:45 +0200 Received: by ug-out-1314.google.com with SMTP id c2so1290174ugf for ; Fri, 21 Jul 2006 05:48:45 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=S+teQikHzwbRXff954HWdNa9Vw8N1OPlcFVCONM+jkfDQYZLmFMcpBJQdmVs+AyIfwEa/1+p/JtAKw9TkfU0fY3fGZ3sjyMZfGHHRN6Y7+ZtvZI3VH8rxFpMwPDE3PMuzmKajWzEQ2Lm47YpiuDhDgubA2HudORX3/Dr2WFlse0= Received: by 10.78.167.12 with SMTP id p12mr325421hue; Fri, 21 Jul 2006 05:48:44 -0700 (PDT) Received: by 10.78.13.17 with HTTP; Fri, 21 Jul 2006 05:48:44 -0700 (PDT) Message-ID: Date: Fri, 21 Jul 2006 14:48:44 +0200 From: "Nicolas Pouillard" To: "Jozef Kosoru" Subject: Re: [Caml-list] How to define submodules Cc: "Jean-Christophe Filliatre" , caml-list@inria.fr In-Reply-To: <20060721124247.GT3653@osiris.uid0.sk> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20060721115325.GS3653@osiris.uid0.sk> <17600.49686.673895.1832@pc9-152.lri.fr> <20060721124247.GT3653@osiris.uid0.sk> X-j-chkmail-Score: MSGID : 44C0CD2D.000 on nez-perce : j-chkmail score : X : 0/20 1 X-Miltered: at nez-perce with ID 44C0CD2E.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 44C0CD2D.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; submodules:01 filliatre:01 ocamlc:01 parser:01 ocamlc:01 parser:01 cmo:01 compiler:01 cmi:01 ocaml:01 -pack:01 -for-pack:01 compiler:01 submodules:01 -for-pack:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_BY_IP autolearn=disabled version=3.0.3 On 7/21/06, Jozef Kosoru wrote: > On Fri, Jul 21, 2006 at 14:01:26 +0200, Jean-Christophe Filliatre wrote: > > Jozef Kosoru writes: > > > OK, and then I want to compile it (within a root directory): > > > > > > $ ocamlc -c Kernel/Parser/pdf.ml > > > $ ocamlc -I . Kernel/Parser/pdf.cmo main.ml -o app > > > > > > File "main.ml", line 1, characters 0-22: > > > Unbound value Kernel.Parser.Pdf.init > > > > > > Is this supposed to work somehow? > > > > No. > > > > First, to compile main.ml you need to pass "-I Kernel/Parser" to the > > compiler, because it needs to find the file pdf.cmi. > > > > Second, in main.ml you have to write "Pdf.init" instead of > > "Kernel.Parser.Pdf.init" because the directory structure is not turned > > into a module structure in ocaml. > > Yes, that was my second example. That's not exactly what I want. > > > However, you can use the option -pack and -for-pack of the compiler to > > pack several files as submodules of a new module; see the manual at > > http://caml.inria.fr/pub/docs/manual-ocaml/manual025.html > > Thank you! > For the above example it's: > > $ ocamlc -for-pack Kernel.Parser -c Kernel/Parser/pdf.ml > $ ocamlc -pack -o Parser.cmo -for-pack Kernel Kernel/Parser/pdf.cmo > $ ocamlc -pack -o Kernel.cmo Parser.cmo > $ ocamlc Kernel.cmo main.ml -o ap > > Now the last thing is how to convince my OMakefile to do it > automatically. > You can try YaM (http://perso.ens-lyon.fr/damien.pous/shared/ocaml/YaM/) It handles directories and subdirectories very well using -pack options. -- Nicolas Pouillard