Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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"]
        ~deps:["%.idl"]
        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]
        end;

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

Hope this helps.

Hez

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