help-make
[Top][All Lists]
Advanced

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

Re: Variable definition in eval'd function


From: Ken Smith
Subject: Re: Variable definition in eval'd function
Date: Wed, 10 Oct 2007 11:37:44 -0700

On 10/10/07, Bryan Ischo <address@hidden> wrote:
>
> Hi all.  I am having a heck of a time getting the $(eval) function to do
> what I want with respect to a per-evaluation variable definition.

I tried your example and thought you need only do:

VARIABLE := VALUE

instead of:

VARIABLE = VALUE

in your *.mk files with $(VARIABLE) in the rule but that didn't work
for me.  I have a different suggestion.  I wonder if something like
the following will work for you.

---foo.mk---BEGIN
foo_VARIABLE = foo_variable
---foo.mk---END

---bar.mk---BEGIN
bar_VARIABLE = bar_variable
---bar.mk---END

---GNUmakefile---BEGIN
FRAGMENTS = foo bar

define PROCESS_FRAGMENT

-include $(1).mk

.PHONY: $(1)
$(1):
        @echo $$@
        @echo $$($(1)_VARIABLE)

endef

$(foreach i, $(FRAGMENTS), $(eval $(call PROCESS_FRAGMENT,$(i))))
---GNUmakefile---END

   Ken




reply via email to

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