caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* specify include directories with ocamlbuild
@ 2010-08-24  7:31 Hendrik Tews
  2010-08-24 12:14 ` [Caml-list] " Nicolas Pouillard
  0 siblings, 1 reply; 3+ messages in thread
From: Hendrik Tews @ 2010-08-24  7:31 UTC (permalink / raw)
  To: caml-list

Hi,

in 3.11 I used

   <some_file.ml>: I(+camlp4/Camlp4Parsers)

in _tags to specify that ocamlbuild should add 
-I +camlp4/Camlp4Parsers when compiling some_file. In 3.12 this
gives 

    Warning: tag "I" does not expect a parameter, but is used with parameter "+camlp4/Camlp4Parsers"

What is the recommended way to specify an include directory in
3.12?

Thanks,

Hendrik Tews


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] specify include directories with ocamlbuild
  2010-08-24  7:31 specify include directories with ocamlbuild Hendrik Tews
@ 2010-08-24 12:14 ` Nicolas Pouillard
  2010-09-02  9:06   ` Hendrik Tews
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Pouillard @ 2010-08-24 12:14 UTC (permalink / raw)
  To: Hendrik Tews, caml-list

On Tue, 24 Aug 2010 09:31:52 +0200, Hendrik Tews <tews@os.inf.tu-dresden.de> wrote:
> Hi,
Hi,

> in 3.11 I used
> 
>    <some_file.ml>: I(+camlp4/Camlp4Parsers)
> 
> in _tags to specify that ocamlbuild should add 
> -I +camlp4/Camlp4Parsers when compiling some_file. In 3.12 this
> gives 
> 
>     Warning: tag "I" does not expect a parameter, but is used with parameter "+camlp4/Camlp4Parsers"
> 
> What is the recommended way to specify an include directory in
> 3.12?

Can you try to have the following declaration in your myocamlbuild.ml

pflag ["ocaml"] "I" (fun x -> S[A"-I"; A x])

The syntax foo(bar) was implicitely turned into arguments "-foo bar"
for commands involving the matched files, however this was too much
specific (the "-" thing) and too much coarse grained. Indeed there
was no way to choose when to add this flag (linking, compiling,
pre-processing, building doc...).

This is now possible with thes parameterized flags, and almost backward
compatible since we added default pflags:
  pp(_), for-pack(_), inline(_), package(_), predicate(_), syntax(_)

However we didn't thought about I(_)...

-- 
Nicolas Pouillard
http://nicolaspouillard.fr


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] specify include directories with ocamlbuild
  2010-08-24 12:14 ` [Caml-list] " Nicolas Pouillard
@ 2010-09-02  9:06   ` Hendrik Tews
  0 siblings, 0 replies; 3+ messages in thread
From: Hendrik Tews @ 2010-09-02  9:06 UTC (permalink / raw)
  To: caml-list

Nicolas Pouillard <nicolas.pouillard@gmail.com> writes:

   Can you try to have the following declaration in your myocamlbuild.ml

   pflag ["ocaml"] "I" (fun x -> S[A"-I"; A x])

For me

pflag ["ocaml"; "compile"] "I" (fun x -> S[A"-I"; A x])

works. Without "compile" ocamlbuild generates incorrect command lines:

/usr/local/stow/ocaml-3.12.0/bin/ocamldep.opt -I +camlp4/Camlp4Parsers -pp '-I +camlp4/Camlp4Parsers' -modules a.ml > a.ml.depends


For the ocamlbuild-inexperienced like myself: Put the pflag line
into myocamlbuild.ml and add 

open Ocamlbuild_plugin;; (* open the main API module *)

as first line. Then you can specify include directories in the
_tags file with "I", for example

<a.ml>: I(+camlp4/Camlp4Parsers)

Bye,

Hendrik


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-09-02  9:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-24  7:31 specify include directories with ocamlbuild Hendrik Tews
2010-08-24 12:14 ` [Caml-list] " Nicolas Pouillard
2010-09-02  9:06   ` Hendrik Tews

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).