help-make
[Top][All Lists]
Advanced

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

Re: $(eval) and shell variables help


From: Paul D. Smith
Subject: Re: $(eval) and shell variables help
Date: Wed, 20 Nov 2002 15:38:46 -0500

%% "Anoni" <address@hidden> writes:

  a> How do you get the value of a shell variable (e.g, exit number) in an
  a> $(eval) context? 

I think you're confused about what eval does.

It does not _run_ a makefile.  It only evaluates it: reads it in so that
it's now part of make's internal database.
 
  a> define TEMPLATE
 
  a>     $(1)     : blah blah...; \
  a>             @some_command; \
  a>                exit_status=...; \
  a>                if [ ... != 0 ]; then \
  a>                      exit 1; \
  a>                 fi; \
  a>             touch $$@;
  a> endef
 
  a> $(foreach t,$(targets),$(eval $(call TEMPLATE,$(t))))

This identical to writing the contents of the TEMPLATE variable out by
hand, once for each word in $(targets).

Neither more nor less.

Maybe if you described what you were actually trying to do we could give
you better advice.

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