Hello everyone,
I'm trying to build a rule with an "optional" prerequisite, i.e.,
something that says that "if a given file doesn't exist, then ignore it,
otherwise consider it as a prerequisite".
An example: all files "%.z" depends on files "%.x" and, if existent,
"%.y". The following works:
----------
all: first.z second.z
first.z: first.x $(wildcard first.y)
echo $^
second.z: second.x $(wildcard second.y)
echo $^
----------
Given that files "first.x", "first.y" and "second.x" (but not
"second.y") exist in the current directory, the echo commands print
exactly what I want (two prerequisites for "first.z" and one for
"second.z").
Surprisingly, a patterned rule doesn't work as I expect:
----------
all: first.z second.z
%.z: %.x $(wildcard %.y)
echo $^
----------
It never expands the "$(wildcard ...)" clause accordingly. I think that
there's something about operator precedence.
How do I solve it? Maybe not using "$(wildcard ...)" at all?
Best regards,
Vilar Neto
_______________________________________________
Help-make mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/help-make