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=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id D51DEBBAF for ; Tue, 30 Sep 2008 18:55:48 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkwDAHf34UjAXQIniGdsb2JhbACTQgEBARUiqyGBZw X-IronPort-AV: E=Sophos;i="4.33,338,1220220000"; d="scan'208";a="17515301" Received: from concorde.inria.fr ([192.93.2.39]) by mail3-smtp-sop.national.inria.fr with ESMTP; 30 Sep 2008 18:55:41 +0200 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id m8UGtfmK011782 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Tue, 30 Sep 2008 18:55:41 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkoDABP34UjCpx6vamdsb2JhbACTQg0LCgYSqwiBZw X-IronPort-AV: E=Sophos;i="4.33,338,1220220000"; d="scan'208";a="29755275" Received: from smtpka.univ-orleans.fr (HELO ka.univ-orleans.fr) ([194.167.30.175]) by mail4-smtp-sop.national.inria.fr with ESMTP; 30 Sep 2008 18:55:40 +0200 Received: from smtps.univ-orleans.fr (localhost [127.0.0.1]) by ka.univ-orleans.fr (Postfix) with ESMTP id BA63612AD4D; Tue, 30 Sep 2008 18:55:40 +0200 (CEST) Received: from [192.168.0.12] (ras75-4-82-235-58-110.fbx.proxad.net [82.235.58.110]) by smtps.univ-orleans.fr (Postfix) with ESMTP id 6DD9C36E60; Tue, 30 Sep 2008 18:55:43 +0200 (CEST) Subject: Re: OCamlBuild question From: David Teller To: Nicolas Pouillard Cc: caml-list In-Reply-To: <1222770687-sup-2064@ausone.local> References: <1222759631.6764.4.camel@Blefuscu> <1222770687-sup-2064@ausone.local> Content-Type: text/plain; charset=utf-8 Date: Tue, 30 Sep 2008 17:12:17 +0200 Message-Id: <1222787537.13637.14.camel@Blefuscu> Mime-Version: 1.0 X-Mailer: Evolution 2.12.1 Content-Transfer-Encoding: 8bit X-Miltered: at concorde with ID 48E25A0D.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; univ-orleans:01 mli:01 compilation:01 remplace:01 mli:01 0200,:01 statically:01 deps:01 deps:01 dirs:01 pathname:01 dirs:01 pathname:01 dirname:01 ocaml:01 Merci, avec ces explications, je suis enfin arrivé à faire fonctionner [build]. Maintenant, reste un problème que je n'arrive pas à comprendre : mon fichier disparaît. Pour être plus précis, j'écris le contenu de mon .mli dans un fichier que j'ai créé pour l'occasion, à l'intérieur de _build -- mais pour des raisons qui m'échappent, ocamlbuild trouve moyen de l'effacer avant la fin de la compilation. J'ai vérifié, une fois que j'ai écrit mon fichier, il existe bien. J'ai aussi vérifié, si je place mon fichier dans /tmp au lieu de _build, ça marche. J'ai aussi vérifié, si je remplace l'extension de mon .mli par .mlpack.mli, ça ne change rien. J'ai essayé de l'ouvrir avec [open_out] et avec [with_output_file], avec la même absence de résultats. Ah, et pour compliquer les choses, ça ne marche pas quand j'appelle ocamlbuild une seule fois. Mais il arrive que, si j'invoque ocamlbuild deux fois de suite, ça se mette à marcher. C'est assez frustrant. Des idées ? Merci, David On Tue, 2008-09-30 at 12:40 +0200, Nicolas Pouillard wrote: > If you need (depend) on files that you statically know then the ~deps argument > is fine (~deps:["%.mli.depends"; "%.mli"]). If you need files that you only > know dynamically then the 'build' argument function is for that purpose. > > > As for part 1, it requires the ability to find which source .ml / .mli > > correspond to a given module. I can only assume OCamlBuild offers some > > kind of API for this purpose, because I'd rather avoid folding through > > the whole tree, resolving [include] directives myself to find a .ml or > > a .mli which may be the right file. > > Yes the function is called expand_module it takes 3 arguments, the include > directories, the module name, the extensions. > > Example: let include_dirs = Pathname.include_dirs_of (Pathname.dirname mlpack) > in build (expand_module include_dirs module_name ["mli"; "mli.depends"]) > > Have a look to the ocamlbuild/ocaml_tools.ml file for a similar function > (import_mlypack). > -- David Teller-Rajchenbach Security of Distributed Systems http://www.univ-orleans.fr/lifo/Members/David.Teller Angry researcher: French Universities need reforms, but the LRU act brings liquidations.