help-make
[Top][All Lists]
Advanced

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

Re: Problem with makefile


From: Philip Guenther
Subject: Re: Problem with makefile
Date: Wed, 6 Mar 2013 12:30:17 -0800

On Wed, Mar 6, 2013 at 12:05 PM, Hiebert, Darren (IS)
<address@hidden> wrote:
> Attached (and below) is a slight variation of my original makefile that 
> incorporates your recommendation, but no longer works for any of the 
> SAMPLE_BINn_OBJECT_FILES (where n is 1, 2, or 3). It replaces the three 
> different expansions with one foreach.

When using $(eval), variable expansion takes place twice: once when
the argument to $(eval) is expanded, and then again when the result of
that is processed by $(eval).  Variable assignments are done during
the *second* of those.  So, anything that depends on the expansion of
a variable to an assignment in the text being evaluated, such as your
use of $($(1)_TARGET_NUMBERS), must be delayed to the second
expansion.

Here, the $(foreach) needs to see the expanded value, so that it can
split it on whitespace, so it and all the expansions in it except for
$(1) have to be delayed too.  That gives you this:

$$(foreach index,$$($(1)_TARGET_NUMBERS),$$(call
target_assignments,$(1),BIN$$(index)))

...but at that point, the $(call target_assignments) is then only
being expanded once instead of twice like it currently expects.  So,
you need to wrap *that* in an $(eval):

$$(foreach index,$$($(1)_TARGET_NUMBERS),$$(eval $$(call
target_assignments,$(1),BIN$$(index))))


There's probably a better way to fix this by fixing
target_assignments, but the utter lack of comments make me unsure of
how this is being used elsewhere or its intent.


Philip Guenther



reply via email to

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