help-make
[Top][All Lists]
Advanced

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

Re: Expand % in wildcard function


From: Mike Gibson
Subject: Re: Expand % in wildcard function
Date: Thu, 25 Mar 2004 16:09:16 -0700
User-agent: KMail/1.5.1

Hey, I wrote just because I'm nice enough to write some code for doesn't mean 
I'm nice enough to debug it. ;)

Actually, I am.

add a backslash to the end of this line.  The newline isn't properly being 
escaped.

$(patsubst $(DOCS)/%,%, $(wildcard $(DOCS)/*)),

NOTE:  I still haven't tested it.  Perhaps if you paid me one million dollars.

Mike

P.S.  I hate spam too, but your little challenge-response thing doesn't work 
and thus makes me not want to waste my time replying.

On Thursday 25 March 2004 02:35 pm, address@hidden wrote:
> Citeren Mike Gibson <address@hidden>:
> > > What should I do to expand the % in the wildcard function?
> >
> > Like Paul said, you can't.  But there is a way to do it.  Use $(eval ...)
> > from
> > version 3.80 and above.
> >
> > > xsl/alldocs_%.xsl: genalldocs.php $(wildcard $(DOCS)/%/*.xml)
> >
> > You would replace the above with this:
> >
> > # define a template rule
> > define alldocs_rule
> > xsl/alldocs_$(1).xsl: genalldocs.php $(wildcard $(DOCS)/$(1)/*.xml)
> >     blah ablh blah
> >
> > endef
> > # the space before the endef is sometimes important
> >
> > # loop through all possible targets
> > ALLDOCS_RULES := \
> >     $(foreach file, \
> >             $(patsubst $(DOCS)/%,%, $(wildcard $(DOCS)/*)),
> >             $(call alldocs_rule,$(file)))
> >
> > # insert the result into the makefile
> > $(eval $(ALLDOCS_RULES))
> >
> > The created rules aren't implicit rules, they're regular rules so they'll
> > behave that way.  This doesn't usually matter, but be aware of it.
>
> Thank you all for your replies. I tried this:
>
> define genalldocs
> xsl/alldocs_$(1).xsl: genalldocs.php $(wildcard $(DOCS)/$(1)/*.xml)
>       ${PHP} php/genalldocs.php $(CURDIR)/$(DOCS)/$(1)/ >$@
>
> endef
>
> $(call genalldocs,l)
> $(call genalldocs,k)
> $(call genalldocs,a)
>
> But when at least one docs/a/*.xml is newer than xsl/alldocs_a.xsl I get
> this error:
>
> *** No rule to make target `docs/a/a182.xml
> ', needed by `xsl/alldocs_a.xsl'.  Stop.
>
> Notice the crlf. a182.xml is the last a/*.xml file. The same error occurs
> with the k- and l-directory. Every time the last *.xml file is mentioned in
> the error message.
>
> Any idea what causes this error and how to prevent it?
>
> I'm using make 3.80 and WindowsXP.
>
> With kindly regards,
>
> Douwe.
>
>
> _______________________________________________
> Help-make mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/help-make





reply via email to

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