[Top][All Lists]

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

[bug #19236] Imported variable with trailing backslash messes up make's

From: Paul D. Smith
Subject: [bug #19236] Imported variable with trailing backslash messes up make's line parsing in nested evaluations
Date: Thu, 08 Mar 2007 13:38:08 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20060601 Firefox/ (Ubuntu-edgy)

Update of bug #19236 (project make):

                  Status:                    None => Not A Bug              
             Open/Closed:                    Open => Closed                 


Follow-up Comment #1:

I agree this is unpleasant; however I don't see anything make can do about
it.  Eval works by first expanding its argument(s), then evaluating the
result.  In your example, after the expansion of $(Y) make sees:

ifeq (1,1)
B := X\

and there's no possible way that the eval can know that this backslash was
originally contained in the variable A, rather than being written directly by

The only solution to this is for YOU to be more cautious about when you allow
variables to expand.  If you defer the expansion of A so that it's done by the
eval itself instead of being done up front before eval is invoked, then you'll
get the behavior you want; change the definition of Y as follows:

define Y
ifeq (1,1)
B := $$(A)

By using $$(A), it won't expand during the expansion of Y, and eval will see

ifeq (1,1)
B := $(A)

with no backslash... THEN when eval evaluates this IT will expand A and set B
to the right value (X\).  For your "real life" example this would translate

ifneq ($(filter bcb%,$(TOOLSET)),)
$(1): export PATH := $(BCCDIR)bin;$$(PATH)

Although, as a general rule, I find it best to defer expansion of ALL
variables other than those that require it (typically as part of a call), so
the above might be more safely written:

ifneq ($$(filter bcb%,$$(TOOLSET)),)
$(1): export PATH := $$(BCCDIR)bin;$$(PATH)

I'm closing this for now but if anyone has any ideas on how to make this work
better please add a note or bring it up on the mailing lists.


Reply to this item at:


  Message sent via/by Savannah

reply via email to

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