help-make
[Top][All Lists]
Advanced

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

fun with eval


From: David Wuertele
Subject: fun with eval
Date: Tue, 03 Aug 2004 16:56:16 -0700
User-agent: Gnus/5.090018 (Oort Gnus v0.18) Emacs/21.2 (gnu/linux)

Can anyone explain to me why running GNU Make 3.80 on the following
makefile:


  THINGS := one two three

  define THING_template
    ALL += `date +%s; sleep 1`
    THIS = $(shell date +%s; sleep 1)
    ALL2 += $(THIS)
  endef

  $(foreach thing,$(THINGS),$(eval $(call THING_template,$(thing))))

  debug:
          @echo ALL = $(ALL)
          @echo ALL2 = $(ALL2)


...results in the following output:

  $ make
  ALL = 1091577190 1091577191 1091577192
  ALL2 = 1091577187 1091577188

I would have expected something more like this:

  $ make
  ALL = 1091577190 1091577191 1091577192
  ALL2 = 1091577186 1091577187 1091577188

Where did the other append to ALL2 go?

Thanks,
Dave





reply via email to

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