bug-make
[Top][All Lists]
Advanced

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

Re: confusion over eval and warning


From: Paul D. Smith
Subject: Re: confusion over eval and warning
Date: Mon, 21 Jun 2004 17:38:56 -0400

%% Ted Stern <address@hidden> writes:

  ts> one.o   := a/a/one.o
  ts> two.o   := b/b/two.o
  ts> three.o := c/c/three.o
  ts> four.o  := d/d/four.o
  ts> five.o  := e/e/five.o

  ts> ALL_BASE := one two three four five

  ts> define DEFINE_OBJ_LIST
  ts> $(1)_OBJS := $(foreach BASE,$(filter $(2)%,$(ALL_BASE)),$($(BASE).o))
  ts> $(warning $(1)_OBJS (contains $(words $($(1)_OBJS)) objects) = 
$($(1)_OBJS))
  ts> endef

You're going to need to escape a lot of the "$" in this list.  Remember
that $(call ...) is going to evaluate this variable value first, before
eval gets to it.  When that happens the "first level" of unescaped "$"
are expanded... _BEFORE_ eval gets there.

Basically, leave the arguments to call (e.g., $(1), $(2), etc.)
unescaped, and escape all the other "$" as "$$" (this is just a general
rule; for example since $(ALL_BASE) is a constant you don't have to
escape that, if you don't want to, etc.)

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




reply via email to

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