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 rules generating multiple files
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-02-10 (22:35)
From: Hezekiah M. Carty <hcarty@a...>
Subject: Re: [Caml-list] ocamlbuild rules generating multiple files
On Tue, Feb 10, 2009 at 5:15 PM, Daniel BĂĽnzli
<daniel.buenzli@erratique.ch> wrote:
> If in a rule a command generates multiple files (which don't necessary have
> the same basename as the dep), how can I make ocamlbuild understand that
> these files now exist in _build ?

I've used the following rule under After_rules in myocamlbuild.ml for
camlidl .idl files:

      (* Handle *.idl files properly... I think *)
      rule "camlidl processing"
        ~prods:["%.mli"; "%.ml"; "%_stubs.c"]
        begin fun env _build ->
          let idl = env "%.idl" in
          let tags = tags_of_pathname idl++"compile"++"camlidl" in
          let cmd = Cmd(S[camlidl; T tags; P idl]) in
          Seq [cmd]

Then, given foo.idl, "ocamlbuild foo.cma" seems to work properly,
finding the relevant camlidl-output files.

Hope this helps.


Hezekiah M. Carty
Graduate Research Assistant
University of Maryland
Department of Atmospheric and Oceanic Science