[Top][All Lists]
[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: |
Thu, 25 Mar 2004 22:35:08 +0100 |
User-agent: |
Internet Messaging Program (IMP) 3.0 |
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.