[Top][All Lists]
[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: |
Wed, 24 Mar 2004 11:47:27 -0700 |
User-agent: |
KMail/1.5.1 |
> 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.
Mike Gibson
address@hidden