On Tue, Apr 12, 2016 at 8:59 AM, Christoph Höger <christoph.hoeger@tu-berlin.de> wrote:

_all_ source files in <dir>

I think that is Gabriel's point. The definition of _all_ depends on when you think this pattern will be evaluated.


It would be a major PITA to add all these files manually...

Not really. The nice thing about ocamlbuild is that you can write arbitrary OCaml code, so just compute deps by traversing the directory yourself.




Am 12.04.2016 um 14:48 schrieb Gabriel Scherer:
> Ocamlbuild distinguishes "static dependencies", which are expressed in
> the ~deps argument of the rule declaration, and "dynamic dependencies"
> which are files required by the rule command.
>
> The notion of pattern accepted for static dependencies is indeed
> rather rigid (less expressive than the patterns used in the _tags
> file), and what you have in mind does not work. The supported patterns
> are deterministic: given one file, there is a unique way a pattern can
> match, and a pattern is instantiated into a single file by any
> substitution environment. There is a good reason for that: it is not
> clear what the semantics of your proposal would be. Indeed, ocamlbuild
> tries to recursively build all static dependencies before deciding to
> apply a rule, but what does it mean to build all **/*.mo? Listing the
> one that exist in the source directory is easy, but how would you
> guess which one to try to build recursively using other rules?
>
> Notions such as "all files matching P in this directory" are not
> stable to the replacement of a source file by an intermediate target:
> for example if tomorrow you decide that one of the .mo file will be
> itself pre-processed from a .mo.pp file, it won't be seen by a
> existing-file globbing technique anymore. You have a lot of
> flexibility in the behaviors you implement in the build command, so
> you can easily do the matching there and "build" those files, but it
> will result in a relatively fragile rule; this is you decision to
> make, and not in the path of least resistance.
>
>
> On Tue, Apr 12, 2016 at 8:00 AM, Christoph Höger
> <christoph.hoeger@tu-berlin.de> wrote:
>> Dear all,
>>
>> I want to write a custom ocamlbuild rule that basically combines all
>> source files from a given (sub-)directory and thus depends on these files.
>>
>> However, the following does not work:
>>
>>         rule "normalize (preprocess) a Modelica library"
>>           ~prods:["%.modlib.impl"; "%.modlib.sign"]
>>           ~deps:["%.modlib/**/*.mo"; "%.modlib.depends"]
>>           ~doc:"Preprocesses a Modelica library"
>>           modlibc_command
>>
>> It seems that the rule does not expand the pattern in the dependency. Is
>> there a way to achieve something similar? It would be a major PITA to
>> add all these files manually...
>>
>> regards,
>>
>> Christoph
>> --
>> Christoph Höger
>>
>> Technische Universität Berlin
>> Fakultät IV - Elektrotechnik und Informatik
>> Übersetzerbau und Programmiersprachen
>>
>> Sekr. TEL12-2, Ernst-Reuter-Platz 7, 10587 Berlin
>>
>> Tel.: +49 (30) 314-24890
>> E-Mail: christoph.hoeger@tu-berlin.de
>>
>> --
>> Caml-list mailing list.  Subscription management and archives:
>> https://sympa.inria.fr/sympa/arc/caml-list
>> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
>> Bug reports: http://caml.inria.fr/bin/caml-bugs
>


--
Christoph Höger

Technische Universität Berlin
Fakultät IV - Elektrotechnik und Informatik
Übersetzerbau und Programmiersprachen

Sekr. TEL12-2, Ernst-Reuter-Platz 7, 10587 Berlin

Tel.: +49 (30) 314-24890
E-Mail: christoph.hoeger@tu-berlin.de

--
Caml-list mailing list.  Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs