On Wed, 2016-04-27 at 15:25 -0400, Alfred M. Szmidt wrote: > What are the intended semantics of the following snippet, > > target: foo=zork > target: > ifeq ($(foo),zork) > @echo "zork zork" > else > @echo "bork bork" > endif > > I'm thinking that it should print "zork zork" -- target specific > variables are supposed to have the same priority as if any other make > variable. But if foo=zork is defined as a non-target specific > variable, the behaviour changes (printing "zork zork"). > > But then, the current behaviour (printing "bork bork") kinda makes > sense as well. Is this a subtle "feature" in how target specific > variables are handled?
It's not subtle (IMO). The manual for target-specific variables clearly states that they are only in effect _inside the recipe_ of the target. ifeq, etc. are all "preprocessor" statements which are parsed as the makefile is read in, before any rules are run, and are not part of the recipe. You can tell this because they are not indented with a TAB and every line of a recipe must be indented with a TAB. So, target-specific variables cannot be queried by ifeq, etc. _______________________________________________ Bug-make mailing list Bug-make@gnu.org https://lists.gnu.org/mailman/listinfo/bug-make