%% Manoj Srivastava <[EMAIL PROTECTED]> writes:

  ms> The following sample makefile should not produce the error it does
  ms> produce (output follows the makefile).  The $(basename ...)
  ms> function should work when it appears in the prerequisites section
  ms> of a rule, but it does nothing.

No, it shouldn't.  Make is behaving correctly.

All variable and function expansion for targets and prerequisite lists
occurs when the makefile is read in, well before any sort of pattern
expansion occurs; so these functions are operating on the static string
"%", not the string it will expand to after pattern matching.

See the GNU make manual for discussion of how make reads makefiles and
when different parts of the makefile are expanded.

  ms> foo.yy: %: $(addsuffix .zz, %)

  ms> foo.xx: %: $(basename %)

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <[EMAIL PROTECTED]>          Find some GNU make tips at:
 http://www.gnu.org                      http://www.paulandlesley.org/gmake/
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

_______________________________________________
Bug-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-make

Reply via email to