[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pass parent stem value to prerequisite rule

From: Paul Smith
Subject: Re: pass parent stem value to prerequisite rule
Date: Thu, 28 Jul 2011 16:39:20 -0400

On Thu, 2011-07-28 at 16:08 -0400, Martin d'Anjou wrote:
> You are correct, second expansion is only for prerequisites ($$* in
> the pattern-specific variable has no effect). I would really like this
> feature. What is the complexity of putting it in? I was able in the
> past to modify job.c to abort at the first error, so I am willing to
> try.

I haven't looked at it in detail, but my suspicion is that it's very

The automatic variables are not computed until the rule is about to be
invoked, that's why we say they're not available before that.  Indeed,
some of them (such as $? etc.) _cannot_ be computed until all
prerequisites are completed, and by then it's too late for you since you
want them available when the prerequisite runs.

You would probably need to split up the current computation of the
automatic variables into multiple functions that can be invoked at
different times, depending on when the information you want is
available, so some variables will be available "earlier" than others.

That's not the only problem: although the make syntax makes it look like
"foo_% : FOO = bar" is associating the variable assignment with a
specific pattern rule, that's not how it's implemented internally IIRC.
Instead these patterns are kept in their own list and applied separately
using simple pattern matching, for every rule.  I don't remember (for
implicit/pattern match rules) when this match is performed.

Getting this all to happen in the right order, and to contain the right
content, will not be trivial (I expect).

I wonder if it wouldn't be simpler/more generally useful to define a way
to obtain the current target's parentage, as a list of target names,
which can then be operated on using make functions.  It wouldn't
necessarily give you the stem by itself but maybe it's sufficient?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]