help-make
[Top][All Lists]
Advanced

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

Re: Expand % in wildcard function


From: d3
Subject: Re: Expand % in wildcard function
Date: Fri, 26 Mar 2004 11:37:03 +0100
User-agent: Internet Messaging Program (IMP) 3.0

Citeren "Paul D. Smith" <address@hidden>:

> %% address@hidden writes:
> 
>   d> 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.
> 
>   d> Thank you all for your replies. I tried this:
> 
>   d> define genalldocs
>   d> xsl/alldocs_$(1).xsl: genalldocs.php $(wildcard $(DOCS)/$(1)/*.xml)
>   d>  ${PHP} php/genalldocs.php $(CURDIR)/$(DOCS)/$(1)/ >$@
> 
>   d> endef
> 
>   d> $(call genalldocs,l)
>   d> $(call genalldocs,k)
>   d> $(call genalldocs,a)
> 
> Well, this can't work because you are not using $(eval ...)... As Mike
> said you have to use $(eval ...).  You also have to escape some things.
> 
> I would do something like this instead:
> 
>   xsl/alldocs_%.xsl: php/genalldocs.php
>       ${PHP} $< $(CURDIR)/$(DOCS)/$*/ > $@
> 
>   xsl/alldocs_l.xsl: $(wildcard $(DOCS)/l/*.xml)
>   xsl/alldocs_k.xsl: $(wildcard $(DOCS)/k/*.xml)
>   xsl/alldocs_a.xsl: $(wildcard $(DOCS)/a/*.xml)
> 
> Then you don't even need eval.  If you really want to do this in a loop
> or something then you _would_ need eval:
> 
>   xsl/alldocs_%.xsl: php/genalldocs.php
>       ${PHP} $< $(CURDIR)/$(DOCS)/$*/ > $@
> 
>   define genalldocs
>   xsl/alldocs_$(1).xsl: genalldocs.php $$(wildcard $(DOCS)/$(1)/*.xml)
>   endef
> 
>   DOCDIRS = l k a
> 
>   $(foreach D,$(DOCDIRS),$(eval $(call genalldocs,$(D))))
> 

Thank you for your patience with a make-newbie which should have read your 
mails and the manual (especially 8.8 about the eval function) better. There 
are a lot of things that became clear to me now and I have make doing what I 
want now.

With kindly regards,

Douwe.




reply via email to

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