Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: xclerc <xavier.clerc@inria.fr>
To: caml users <caml-list@inria.fr>
Cc: xclerc Clerc <xavier.clerc@inria.fr>
Subject: Re: [Caml-list] ocamlbuild and cflags
Date: Wed, 20 Jul 2011 15:06:34 +0200	[thread overview]
Message-ID: <B4761F80-7768-4D2D-9B33-F45C2B99D1BC@inria.fr> (raw)
In-Reply-To: <20110720124800.GA21796@guillaume-laptop>


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


> 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


Hope this helps,

Xavier Clerc


[1] http://caml.inria.fr/mantis/view.php?id=5282

  reply	other threads:[~2011-07-20 13:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-20 12:48 Guillaume Hennequin
2011-07-20 13:06 ` xclerc [this message]
2011-07-20 14:46   ` Guillaume Hennequin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B4761F80-7768-4D2D-9B33-F45C2B99D1BC@inria.fr \
    --to=xavier.clerc@inria.fr \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox