[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Replacing characters in a pattern rule
From: |
John Graham-Cumming |
Subject: |
Re: Replacing characters in a pattern rule |
Date: |
Fri, 09 Sep 2005 14:04:17 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040208 Thunderbird/0.5 Mnenhy/0.6.0.104 |
natch wrote:
That solution looks beautiful. Unfortunately, I'm forced to use Make
3.79.1 which doesn't understand eval. Any other suggestions?
OK. What you could do is write the rules out to a Makefile that you
generate during Makefile parsing and then include that Makefile. (Yes,
this is a hack).
DIRECTORIES := a b c group/d group/e
HTML_FILES := $(addsuffix /index.html,$(DIRECTORIES))
SPECIAL_MAKEFILE := include-me
define copy-rule
echo "$1 : $(subst /,_,$1) ; cp $1 $(subst /,_,$1)" >> $(SPECIAL_MAKEFILE)
endef
$(shell rm -f $(SPECIAL_MAKEFILE))
$(foreach d,$(HTML_FILES),$(shell $(call copy-rule,$d)))
include include-me
And if you want to get really fancy you could make a rule for include-me
that does the $(foreach) bit.
John.
--
John Graham-Cumming
address@hidden
Home: http://www.jgc.org/
POPFile: http://getpopfile.org/
Sign up for my Spam and Anti-spam Newsletter
at http://www.jgc.org/