From mboxrd@z Thu Jan 1 00:00:00 1970 X-Sympa-To: caml-list@inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p6KEkRY7018245 for ; Wed, 20 Jul 2011 16:46:27 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Am0BAFjpJk6AsuDbkWdsb2JhbAAoK5gnNY8bAQEBAQkLCwcUBSCIfCa/aIVeXwSjTQ X-IronPort-AV: E=Sophos;i="4.67,235,1309730400"; d="scan'208";a="98895289" Received: from smtp0.epfl.ch ([128.178.224.219]) by mail2-smtp-roc.national.inria.fr with SMTP; 20 Jul 2011 16:46:22 +0200 Received: (qmail 31420 invoked by uid 107); 20 Jul 2011 14:46:21 -0000 X-Virus-Scanned: ClamAV Received: from vpn-b-195-136.epfl.ch (HELO discarded) (128.178.195.136) (authenticated) by smtp0.epfl.ch (AngelmatoPhylax SMTP proxy) with ESMTPA; Wed, 20 Jul 2011 16:46:21 +0200 Date: Wed, 20 Jul 2011 16:46:30 +0200 From: Guillaume Hennequin To: caml-list@inria.fr Message-ID: <20110720144630.GC21796@guillaume-laptop> References: <20110720124800.GA21796@guillaume-laptop> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Validation-by: guillaume.hennequin@epfl.ch Subject: Re: [Caml-list] ocamlbuild and cflags On Wed, Jul 20, 2011 at 03:06:34PM +0200, xclerc wrote: > > Le 20 juil. 2011 à 14:48, Guillaume Hennequin a écrit : > > > Hello, > > > > I came across two ocamlbuild issues today: > > > > 1) how can one give a cflag that requires an argument, like > > ocamlbuild -cflag -inline 2 target.native > > Backtrace: > > - failed to build the target 2 > > To overcome this problem you can execute either > ocamlbuild -cflag -inline -cflag 2 target.native > or > ocamlbuild -cflags -inline,2 target.native > thanks! > > 2) I don't understand why ocamlbuild target.cmx would need to compile > > target.cmo on the way... this actually prevents me from using any of the > > ocamlopt-specific flags: > > ocamlbuild -cflag -S target.cmx > > (ocamlc itself complains it doesn't have a -S option) > > > > any way around that? > > This is a reported bug [1]; in your case, a workaround is to write the > following "myocamlbuild.ml" file: > open Ocamlbuild_plugin > > let () = > dispatch begin function > | After_rules -> > tag_file "target.ml" ["myoption"]; > flag ["ocaml"; "compile"; "native"; "myoption"] (A"-S"); > | _ -> () > end thanks for pointing to [1], which also tells me that the .cmo is built because the .cmi becomes a target for the .cmx, and that .cmi targets can only be built with ocamlc, not also with ocamlopt, for some reason. conclusion, writing my .mli file is also an option. Now, for simple files for which an interface would just be copy/paste, I can also probably just add a line in my Makefile to generate them automatically with ocamlc -i (before running ocamlbuild). thanks Guillaume > Hope this helps, > > Xavier Clerc > > > [1] http://caml.inria.fr/mantis/view.php?id=5282 > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa-roc.inria.fr/wws/info/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs