English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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: 2007-09-18 (18:00)
From: Jake Donham <jake.donham@s...>
Subject: ocamlbuild: args to tags?

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)


   <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