Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "Christoph Höger" <christoph.hoeger@tu-berlin.de>
To: caml users <caml-list@inria.fr>
Subject: Re: [Caml-list] glob-ing dependencies for a custom ocamlbuild rule
Date: Tue, 12 Apr 2016 14:59:59 +0200	[thread overview]
Message-ID: <570CF14F.3080801@tu-berlin.de> (raw)
In-Reply-To: <CAPFanBHDLeGbyY1b8eUz1r5u+C0nrmUpu7MW9rx_fhqi5-gP+g@mail.gmail.com>

I should have mentioned it, but I am not particularly interested in
letting ocamlbuild build one of the <dir>/**/*.mo files, I just want to
make sure that when it comes to building <dir>.modlib.impl or not,
ocamlbuild considers _all_ source files in <dir> and rebuilds if one has
changed. Is that covered by "dynamic dependencies"?

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

  reply	other threads:[~2016-04-12 13:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-12 12:00 Christoph Höger
2016-04-12 12:48 ` Gabriel Scherer
2016-04-12 12:59   ` Christoph Höger [this message]
2016-04-12 13:15     ` Ashish Agarwal
2016-04-12 15:33       ` Gabriel Scherer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=570CF14F.3080801@tu-berlin.de \
    --to=christoph.hoeger@tu-berlin.de \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox