[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: $(eval) and shell variables help
From: |
Anoni |
Subject: |
Re: $(eval) and shell variables help |
Date: |
Wed, 20 Nov 2002 12:51:35 -0800 |
I am using $(eval) to dynamically generate a set of rules (one for each
source file/targets) and need to prevent the Make from updating the target
(using touch)
if there is an error detected from a command I executed as part of the rule.
Is there a way to do this?
Thanks.
----- Original Message -----
From: "Paul D. Smith" <address@hidden>
To: "Anoni" <address@hidden>
Cc: <address@hidden>
Sent: Wednesday, November 20, 2002 12:38 PM
Subject: Re: $(eval) and shell variables help
> %% "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
>
>
> _______________________________________________
> Help-make mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/help-make
>