Re: [Caml-list] ocamlbuild rules generating multiple files

2009-02-11 Thread Romain Bardou

Daniel Bünzli a écrit :

Hello,

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 also encountered this problem, and AFAIK there is no support yet for 
what I would call "dynamic productions". The answer of Nicolas Pouillard 
was: "hmm good question... indeed it should be added" (roughly 
translated :) ).


--
Romain Bardou

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] ocamlbuild rules generating multiple files

2009-02-10 Thread Mikkel Fahnøe Jørgensen
2009/2/10 Daniel Bünzli :
> Thanks but my problem is that the generated file do not have the same
> basename as the dep i.e. I cannot specify the ~prods arg, the ~prods are
> going to be discovered while the rule is executed and without going through
> further "build" argument invocations.

This is how dependency scanners also work.

You can see an example in

http://git.dvide.com/pub/ocamlbuild-ctools/tree/myocamlbuild_config.ml

search for:
accumulated_include_rule

Here accumulated_include_rule is used instead of rule, but it calls
rule eventually, but with its calculated prod arguments that it gets
(in this case) from reading multiple dependency files. You could
modify this function to take a list of a .tgz file.

Some care needs to be taken since each build step must produce an
actual file - especially when creating dependencies, but it is not
necessarily required in you case. Dependency scanners do need to
produce files so something else can depend on this files to ensure the
dependency is scanned.

Mikkel

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] ocamlbuild rules generating multiple files

2009-02-10 Thread Hezekiah M. Carty
On Tue, Feb 10, 2009 at 5:39 PM, Daniel Bünzli
 wrote:
>
> Le 10 févr. 09 à 23:33, Hezekiah M. Carty a écrit :
>
>> I've used the following rule under After_rules in myocamlbuild.ml for
>
> [...]
>
> Thanks but my problem is that the generated file do not have the same
> basename as the dep i.e. I cannot specify the ~prods arg, the ~prods are
> going to be discovered while the rule is executed and without going through
> further "build" argument invocations.
>
> Maybe a good example is tar archives. Let's say I have a rule that takes a
> .tgz and produces its files. How do I tell ocamlbuild that these files now
> exist.

Ah, my apologies.  I didn't read your original post carefully enough.
Would it be possible to write a function to read these files in to a
list then use "dep [foo; bar] file_list;"?  This is what I use for
included files in .idl files.  I have only done this with static,
pre-defined lists using 'dep ["compile"; "camlidl"] ["file1.inc;
file2.inc"];'.  I'm not sure how well it would work or if it would
work at all with a dynamic list of files.

Hez

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

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] ocamlbuild rules generating multiple files

2009-02-10 Thread Daniel Bünzli


Le 10 févr. 09 à 23:33, Hezekiah M. Carty a écrit :


I've used the following rule under After_rules in myocamlbuild.ml for


[...]

Thanks but my problem is that the generated file do not have the same  
basename as the dep i.e. I cannot specify the ~prods arg, the ~prods  
are going to be discovered while the rule is executed and without  
going through further "build" argument invocations.


Maybe a good example is tar archives. Let's say I have a rule that  
takes a .tgz and produces its files. How do I tell ocamlbuild that  
these files now exist.


Best,

Daniel

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] ocamlbuild rules generating multiple files

2009-02-10 Thread Hezekiah M. Carty
On Tue, Feb 10, 2009 at 5:15 PM, Daniel Bünzli
 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

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] ocamlbuild rules generating multiple files

2009-02-10 Thread Daniel Bünzli

Hello,

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 ?


Thanks,

Daniel

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs