bug-make
[Top][All Lists]
Advanced

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

Re: order of evaluation for target specific variables


From: Paul Smith
Subject: Re: order of evaluation for target specific variables
Date: Wed, 27 Apr 2016 16:48:36 -0400

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.



reply via email to

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