Hi,
I need to use variables inside an implicit rule. The idea
is that all files named $(PREFIX)_%_$(SUFFIX) should
be processed by the rule. The exact values for $(PREFIX)
and $(SUFFIX) are set previously in the Makefile, and the
% character is of course the wildcard for implicit rules.
Anyway, here's an example that works fine:
(It is of course a stripped down version of the full Makefile.
Also, suppose that "generate" is a command which reads from
first argument and writes to the second).
==================================================
all: draft
PREFIX=before
SUFFIX=after
draft: before_foobar_after.out
$(PREFIX)_%_$(SUFFIX).out : $(PREFIX)_%_$(SUFFIX).in
generate $< $@
==================================================
Now, the problem happens when I use target-specific
variable values. If I understood the make manual,
all prerequisites should inherit those target-specific
variables, but this does not seem to happen with
the implicit rule.
This example fails:
==================================================
all: draft
draft: PREFIX=before
draft: SUFFIX=after
draft: prefix_foobar_suffix.out
$(PREFIX)_%_$(SUFFIX).out : $(PREFIX)_%_$(SUFFIX).in
generate $< $@
==================================================
Is this a bug, a feature, or am I missing something?
Also, is there any other way to achieve what I want?
Thanks in advance for your help, guys!
Kind regards,
Dario Teixeira
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make