I understand the explanation, but I do not understand why, if it applies to
the $(basename) function, it does not apply to the $(addsuffix) function.
If addsuffix behaved like basename, then the dependency list for the target
foo.yy would be ".zz" instead of "foo.yy.zz" (which it is by experiment --
that's why this was in the test makefile).


> %% 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 %)



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

Reply via email to