[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Target-specific variables in implicit rules
From: |
Paul D. Smith |
Subject: |
Re: Target-specific variables in implicit rules |
Date: |
Thu, 20 Oct 2005 12:38:56 -0400 |
%% Dario Teixeira <address@hidden> writes:
dt> Now, the problem happens when I use target-specific variable
dt> values. If I understood the make manual, all prerequisites should
dt> inherit those target-specific variables, but this does not seem to
dt> happen with the implicit rule.
They are inherited; if you printed those values inside the command
script you'd see them.
Check the docs more carefully: target-specific values are ONLY valid
inside command scripts (they have the same lifetime and scoping rules as
automatic variables like $@, etc.)
dt> all: draft
dt> draft: PREFIX=before
dt> draft: SUFFIX=after
dt> draft: prefix_foobar_suffix.out
dt> $(PREFIX)_%_$(SUFFIX).out : $(PREFIX)_%_$(SUFFIX).in
dt> generate $< $@
Here you're trying to use them in a target/prerequisite list: that won't
work.
dt> Also, is there any other way to achieve what I want?
I guess I'm not really sure what you're trying to achieve. Why not just
write:
all: draft
draft: prefix_foobar_suffix.out
%.out : %.in
generate $< $@
??
--
-------------------------------------------------------------------------------
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