bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: basename function does nothing when it appears in prerequisites


From: Paul D. Smith
Subject: Re: basename function does nothing when it appears in prerequisites
Date: Sun, 9 Sep 2001 11:36:18 -0400

%% Manoj Srivastava <address@hidden> 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 <address@hidden>          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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]