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: Matt Swift
Subject: RE: basename function does nothing when it appears in prerequisites
Date: Sun, 9 Sep 2001 15:30:51 -0400

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





reply via email to

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