bug-make
[Top][All Lists]
Advanced

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

Re: comments in eval


From: Paul D. Smith
Subject: Re: comments in eval
Date: Fri, 29 Jul 2005 19:34:57 -0400

%% Jonathan Baccash <address@hidden> writes:

  jb> With GNU make 3.81-beta3, I try this makefile:
  jb> define myvar
  jb> # $(error blah)
  jb> endef
  jb> $(eval $(myvar))


  jb> And I get:
  jb> Makefile:4: *** blah.  Stop.

  jb> Shouldn't the commented error call be ignored?

No, because the variable myvar is expanded FIRST, then the results
are evaluated.  When myvar is being expanded it's just the same as if it
were being used in a command script or similar: comment characters have
no impact.

To behave like you expect you need to escape the error function so that
it's not expanded until it's inside the eval:

  define myvar
  # $$(error blah)
  endef
  $(eval $(myvar))

-- 
-------------------------------------------------------------------------------
 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]