help-make
[Top][All Lists]
Advanced

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

Re: Question function "call" and "%"


From: Paul Smith
Subject: Re: Question function "call" and "%"
Date: Tue, 23 Mar 2010 14:00:52 -0400

On Tue, 2010-03-23 at 09:58 -0700, RusMor wrote:
> blaat:
> blaat.blaat:
> 
> TEST = $(1).$(1)
> 
> test/%: $(call TEST,%)
>       @echo "Args = $^"

> address@hidden:~/scratch> make test/blaat
> make: *** No rule to make target `test/blaat'.  Stop.
> 
>   I do not understand why the call to the TEST function (in the test/% rule)
> with parameter "%" does not do the same as the call (in the print/% rule) to
> the same function with parameter "$<", which is derived from "%" ??

You need to check the GNU make manual section "How `make' Reads a
Makefile".

Basically, the $(call ...) here is being evaluated when the makefile is
read in, long before make starts using the pattern rule to match against
the command you have entered.

So, make is running the $(call ...) function with the literal string
"%", which expands to %.%, so make sees this pattern rule:

        test/%: %.%

Now, multiple patterns are not interpreted in pattern rules (don't know
why) so this basically says, for a target "test/blaat", it depends on
"blaat.%" of which there isn't one.

To get this to work you'll have to enable secondary expansion I think;
see the GNU make manual for more details/examples.





reply via email to

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