Version française
Home     About     Download     Resources     Contact us    
Browse thread
ocamlbuild: args to tags?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jake Donham <jake.donham@s...>
Subject: ocamlbuild: args to tags?
Hi,

Is there a way to pass arguments to a preprocessor via the _tags file? 
(In particular, I have added a -classes option to Deriving to give 
default classes to all the types in a file.). Following the recent 
discussion, I have this in myocamlbuild.ml:

   dispatch begin function
     | After_rules ->
         flag ["ocaml"; "pp"; "deriving"] (A"deriving");
         flag ["ocaml"; "pp"; "Show"] (S[A"-classes"; A"Show"]);

So now if I put

   <foo.ml> : deriving,Show

in _tags I get -pp 'deriving -classes Show' in the command line. What I 
would like, however, is to be able to write

   <foo.ml> : deriving(Show,Typeable)

or

   <foo.ml> : deriving,classes(Show,Typeable)

i.e. to be able to pass some arbitrary args rather than hard-coding Show 
as a tag. Is there any way to do this? I don't understand how Ocamlbuild 
decides whether flags should be associated with the main command or with 
the preprocessor command; if I write classes(Foo) in _tags I get 
-classes Foo in the main command, no matter what I have tried in 
myocamlbuild.ml.

Thanks,

Jake