[Techtalk] Re: Re: Loop/wildcard-like syntax for GNU make?

Wim De Smet kromagg at gmail.com
Sat Apr 21 13:09:13 UTC 2007

cOn 4/20/07, Michelle Konzack <linux4michelle at freenet.de> wrote:
> Hi Wim,
> Am 2007-04-19 19:34:43, schrieb Wim De Smet:
> > On 4/19/07, Michelle Konzack <linux4michelle at freenet.de> wrote:
> > >-----------------------------------------------
> > >GIFS := $(wildcard *.gif)
> > >
> > >all: $(GIFS)
> > >
> > >$(GIFS):
> > >        convert $@ $(patsubst %.gif,%,$@).jpg
> > >
> > >.PHONY: all $(GIFS)
> >
> > I think that last line should read:
> > .PHONY: all
> > since $(GIFS) actually points to real files, otherwise your makefile
> > is probably going to always/never update the files.
> Hmmm, here it works perfectly...
> I have done it always sind many years.
> It written in the HTML documentation of GNU make.

Rereading it the makefile you wrote is a bit backwards. A rule should
always be in the form:
target: <sources>
Where your target is created from your sources. If you don't mark the
$(GIFS) as phony it doesn't work since these are actually the source
files and since they have no source listed they are considered updated
as soon as they exist, which they always do. If you mark them as phony
however, the rule is always run when called. John's earlier solution
is really preferrable since it will only update when the source files

> "make" should use the VARIABLE $(GIFS) and NOT the files.

I don't follow, the variable $(GIFS) points to the files doesn't it?


More information about the Techtalk mailing list