On Sun, 2017-03-19 at 01:51 +0000, Alejandro García Vallejo wrote:
> bar: $(@:%r=foo%z)
>         @echo End
> 
> foobaz:
>         @echo The
> 
> """
> GNU Make Output:
> End
> 
> Make fails to read $@ (aka, it's empty).

That's not a bug; that's defined behavior.  From the GNU make manual:

https://www.gnu.org/software/make/manual/html_node/Automatic-Variables.html

> It’s very important that you recognize the limited scope in which
> automatic variable values are available: they only have values within
> the recipe. In particular, you cannot use them anywhere within the
> target list of a rule; they have no value there and will expand to the
> empty string. Also, they cannot be accessed directly within the
> prerequisite list of a rule. A common mistake is attempting to use $@
> within the prerequisites list; this will not work. However, there is a
> special feature of GNU make, secondary expansion (see Secondary
> Expansion), which will allow automatic variable values to be used in
> prerequisite lists.


_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to