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 mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 6BC6FBBAF for ; Thu, 16 Oct 2008 10:30:16 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ag8DALKX9kiBrw8EiGdsb2JhbACTZAEBARUirUSBbA X-IronPort-AV: E=Sophos;i="4.33,422,1220220000"; d="scan'208";a="30398184" Received: from ext.lri.fr ([129.175.15.4]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/ADH-AES256-SHA; 16 Oct 2008 10:30:16 +0200 Received: from localhost (localhost [127.0.0.1]) by ext.lri.fr (Postfix) with ESMTP id E88E6A4711; Thu, 16 Oct 2008 10:30:15 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at lri.fr Received: from ext.lri.fr ([127.0.0.1]) by localhost (ext.lri.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mzJtAVIXjXdS; Thu, 16 Oct 2008 10:30:15 +0200 (CEST) Received: from smtp.lri.fr (vhost3-23 [129.175.3.23]) by ext.lri.fr (Postfix) with ESMTP id CA532A46EE; Thu, 16 Oct 2008 10:30:15 +0200 (CEST) Received: from [129.175.4.107] (lri4-107 [129.175.4.107]) by smtp.lri.fr (Postfix) with ESMTP id B9866E0559; Thu, 16 Oct 2008 10:30:15 +0200 (CEST) Message-ID: <48F6FBB9.7030107@lri.fr> Date: Thu, 16 Oct 2008 10:30:49 +0200 From: Romain Bardou User-Agent: Thunderbird 2.0.0.17 (X11/20080925) MIME-Version: 1.0 To: Josh Berdine Cc: "caml-list@yquem.inria.fr" Subject: Re: [Caml-list] ocamlbuild: ml -> cmx & cmi & o ? References: <857DD0FDAC042B4485F9F5F4EA6751041E4CEEEDBC@EA-EXMSG-C332.europe.corp.microsoft.com> In-Reply-To: <857DD0FDAC042B4485F9F5F4EA6751041E4CEEEDBC@EA-EXMSG-C332.europe.corp.microsoft.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Spam: no; 0.00; lri:01 cmx:01 cmi:01 cmx:01 cmi:01 mli:01 cmo:01 ocamlc:01 ocamlopt:01 ocamlopt:01 ocaml:01 plug-in:98 caml-list:01 env:03 env:03 > I observe that ocamlbuild does not build cmx cmi and o files from a ml > file (which has no associated mli) directly. Do others see different > behavior? Instead it builds cmo and cmi from the ml using ocamlc, and > then builds the cmx and o files from there using ocamlopt. Is there a > reason I’m missing that ocamlbuild does not have a default rule for this > case, using only one call to ocamlopt? If so, is there an easy way to > do this with a plugin? I observe the same behavior. I think it's just a matter of reordering the rules in ocaml_specific.ml, as the following plug-in solves the problem thanks to "~insert: `top": open Ocamlbuild_plugin let () = dispatch begin function | After_rules -> rule "ml -> cmx" ~dep: "%.ml" ~prods: ["%.cmx"; "%.o"; "%.cmi"] ~insert: `top begin fun env _ -> let ml = env "%.ml" in Cmd(S[!Options.ocamlopt; A "-c"; P ml]) end | _ -> () end -- Romain Bardou