%% Samya DasSarma <[EMAIL PROTECTED]> writes:
sd> Assume the makefile is:
sd> targs = %.x %.z
sd> $(targs):
sd> echo "$(@) $(suffix $(@))"
sd> all:a.x a.z
sd> Now, if I do gmake all, the output is:
sd> echo "a.x .x"
sd> a.x .x
sd> Question is, why is it not trying to build a.z? There is no
sd> a.x/a.z files present in my current directory.
It is.
You wrote:
%.x %.z:
<command>
That tells make that if it invokes your <command> one time, that one
invocation will build both targets. So, it's invoking your command one
time. When it does, $@ is set to whatever target caused the command to
be invoked (it can't be set to both at the same time of course!). In
this case since a.x is the first one make considers, that's what $@ is
set to.
Pattern rules don't behave like explicit rules in this respect: check
out the description in the GNU make manual.
--
-------------------------------------------------------------------------------
Paul D. Smith <[EMAIL PROTECTED]> 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
[EMAIL PROTECTED]
http://lists.gnu.org/mailman/listinfo/help-make