%% "Ovidiu, Gheorghies" <[EMAIL PROTECTED]> writes:
og> Suppose we have the following:
og> $(TARGETS): %.a_pattern: $(subst something, something_else, %.b_pattern)
og> The problem is that first the subst function is applied to the
og> .b_pattern and only then the stem is substituted.
og> My question is if it is possible to obtain such effect, as if the
og> stem were first subtituted into the dependency pattern and after
og> that an arbitrary string function to be applied on it.
Unfortunately, no. An upcoming new feature in GNU make will allow for
this sort of thing (although not just as you've written it).
og> Is the current behavior intentional? Why[?]
Sort of. It's purposeful, but the purpose wasn't to do the subst before
the pattern per se.
It's more a side effect of how make parses makefiles, in general. The
expansion of the entire line is done long before, in terms of make
processing, where it's split into a static pattern rule and the pattern
substitutions are done. This is just how make (all versions) process
input files.
It pretty much has to work this way, too, because make allows the result
of the expansion to contain important special tokens, like semi-colons,
etc. that can drastically change how the rule is parsed and broken up.
So, those expansions have to be done early.
Basically, it's done this way because all of make's parsing works like
this and IMO adding in a strange special case here would be even more
gross and confusing and hard to explain than the current behavior :).
--
-------------------------------------------------------------------------------
Paul D. Smith <[EMAIL PROTECTED]> Find some GNU make tips at:
http://www.gnu.org http://www.paulandlesley.org/gmake/
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist