help-make
[Top][All Lists]
Advanced

[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 15:30:47 -0400

On Thu, 2011-07-28 at 09:50 -0400, Martin d'Anjou wrote:
> I can't figure out how to pass the parent stem value to a prerequisite
> rule:
> 
> .SECONDEXPANSION:
> rule_%: test=foo
> rule_%: parent_stem=$*
> rule_%: child_b
>   @echo in parent: parent_stem=$(parent_stem)
> 
> child_%:
>   @echo in child: stem=$*
>   @echo in child: test=$(test)
>   @echo 'in child: parent_stem=$(parent_stem) --> this should be "a",
> not "b"'

I'm not at all sure this can be made to work, because automatic
variables are defined in the context of the command script for the rule
only (see the docs), but if it has any chance to work you MUST use an
escaped "$" in the parent_stem setting:

        rule_%: parent_stem=$$*

(again see the docs for .SECONDEXPANSION)




reply via email to

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