From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p7PFUsrq025658 for ; Thu, 25 Aug 2011 17:30:54 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkAIAHtpVk5ZELGagWdsb2JhbABCmDk1jygBARYmJYFAAQEEAScTNBALCyUhRRIrh2ACArp1hWxgBJMZkHw X-IronPort-AV: E=Sophos;i="4.68,281,1312149600"; d="scan'208";a="106623130" Received: from recoil.dh.bytemark.co.uk (HELO dark.recoil.org) ([89.16.177.154]) by mail4-smtp-sop.national.inria.fr with SMTP; 25 Aug 2011 17:30:48 +0200 Received: (qmail 31520 invoked by uid 634); 25 Aug 2011 15:30:48 -0000 X-Spam-Level: * X-Spam-Check-By: dark.recoil.org Received: from no-dns-yet.demon.co.uk (HELO [192.168.14.178]) (62.49.66.12) (smtp-auth username remote@recoil.org, mechanism cram-md5) by dark.recoil.org (qpsmtpd/0.83) with ESMTPA; Thu, 25 Aug 2011 16:30:47 +0100 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1244.3) From: Anil Madhavapeddy In-Reply-To: Date: Thu, 25 Aug 2011 16:30:47 +0100 Message-Id: <4F164365-2231-42EE-9410-BD4ADBD89F80@recoil.org> References: To: caml-list@yquem.inria.fr X-Mailer: Apple Mail (2.1244.3) X-Virus-Checked: Checked by ClamAV on dark.recoil.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id p7PFUsrq025658 Subject: Re: [Caml-list] output-obj rule in ocamlbuild I ended up copying some of the rules out of ocamlbuild/ocaml_specific.ml and replicating it in myocamlbuild.ml. For the archives, a rule "%.m.o" looks like: (* Copied from ocaml/ocamlbuild/ocaml_specific.ml and modified to add the output_obj tag *) let native_output_obj x = link_gen "cmx" "cmxa" !Options.ext_lib [!Options.ext_obj; "cmi"] ocamlopt_link_prog (fun tags -> tags++"ocaml"++"link"++"native"++"output_obj") x let () = (* Copied from ocaml/ocamlbuild/ocaml_specific.ml *) let ext_obj = !Options.ext_obj in let x_o = "%"-.-ext_obj in (* Rule to link a module and output a standalone object file *) rule "ocaml: cmx* & o* -> .m.o" ~tags:["ocaml"; "native"; "output_obj"] ~prod:"%.m.o" ~deps:["%.cmx"; x_o] (native_output_obj "%.cmx" "%.m.o"); -Anil On 25 Aug 2011, at 15:09, Anil Madhavapeddy wrote: > Is there a built-in rule in ocamlbuild to generate the -output-obj output instead of a direct link? > > I note there are these built-in tags in the ocamlbuild source: > > ocaml_specific.ml:flag ["ocaml"; "link"; "native"; "output_obj"] (A"-output-obj");; > ocaml_specific.ml:flag ["ocaml"; "link"; "byte"; "output_obj"] (A"-output-obj");; > > ...but I can't find a built-in target that uses these tags. Is a custom rule in myocamlbuild.ml needed here, or should I do something in my _tags file? > > cheers, > Anil > > -- > 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 >