help-make
[Top][All Lists]
Advanced

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

Re: help with implicit rules


From: Philip Guenther
Subject: Re: help with implicit rules
Date: Wed, 21 Nov 2012 09:38:52 +0000

On Wed, Nov 21, 2012 at 9:09 AM, Miguel Guedes
<address@hidden> wrote:
> For some reason I can only get it to work like so:
> PAGES = $(wildcard *.page)
> all: $(PAGES:.page=.html)
...
> Defining the `all' rule as
>
>   all: $($(wildcard *.page):.page=.html)
>
> doesn't seem to work. (I'd like to know why though)

To quote the GNU make info pages:
-------
A "substitution reference" substitutes the value of a variable with
alterations that you specify.  It has the form `$(VAR:A=B)' (or
`${VAR:A=B}') and its meaning is to take the value of the variable VAR,
replace every A at the end of a word with B in that value, and
substitute the resulting string.
-------

I.e., "VAR" has to be the name of a variable.  So, given
   all: $($(wildcard *.page):.page=.html)

make expands "$(wildcard *.page)" *and then treats the result as the
name of a variable*.  Since your makefile doesn't have a variable with
the name "whatever.page another.page something.page etc.page", the
result is empty.

To do a pattern substitution on something other than the result of a
variable expansion, use the $(patsubst) function directly:

all: $(patsubst %.page,%.html,$(wildcard *.page))


Philip Guenther



reply via email to

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