caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Ashish Agarwal <agarwal1975@gmail.com>
To: "Christoph Höger" <christoph.hoeger@tu-berlin.de>
Cc: caml users <caml-list@inria.fr>
Subject: Re: [Caml-list] glob-ing dependencies for a custom ocamlbuild rule
Date: Tue, 12 Apr 2016 09:15:33 -0400	[thread overview]
Message-ID: <CAMu2m2+vedKoBsUZQF06F3QyFVxXjX4auLSZu=o21=NsXL0-jA@mail.gmail.com> (raw)
In-Reply-To: <570CF14F.3080801@tu-berlin.de>

[-- Attachment #1: Type: text/plain, Size: 4116 bytes --]

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
>

[-- Attachment #2: Type: text/html, Size: 6479 bytes --]

  reply	other threads:[~2016-04-12 13:15 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
2016-04-12 13:15     ` Ashish Agarwal [this message]
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='CAMu2m2+vedKoBsUZQF06F3QyFVxXjX4auLSZu=o21=NsXL0-jA@mail.gmail.com' \
    --to=agarwal1975@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=christoph.hoeger@tu-berlin.de \
    /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;
as well as URLs for NNTP newsgroup(s).