[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to capture a set of recurring rules?
From: |
Paul Smith |
Subject: |
Re: How to capture a set of recurring rules? |
Date: |
Tue, 02 Feb 2010 00:19:21 -0500 |
On Mon, 2010-02-01 at 22:09 -0600, Peng Yu wrote:
> Suppose that I use the following rule pattern a lot in my makefile,
> where <filename> has to be the same in each block of the three rules.
> <some1> <some2> ... <some_n> can be any files.
>
> all: <filename>.RData
>
> clean: <filename>.RData
> $(RM) $^
>
> <filename>.RData: <filename>.R <some1> <some2> ... <some_n>
> Rscript $<
You can use $(eval ...) as long as you can require a new-enough version
of GNU make.
define special-rule
all: $1.RData
clean $1.RData
$$(RM) $$^
$1.RData: $1.R $2 $3 $4 $5 $6 $7 $8 $9
Rscript $$<
enddef
$(eval $(call special-rule,xxx,a.txt,b.txt))
$(eval $(call special-rule,uuu,x.txt,y.txt,z.txt))
Note that this has the disadvantage that if you have >8 prerequisites it
will fail. You can increase this as much as you want but I can't think
of a way, offhand, to make it foolproof.
--
-------------------------------------------------------------------------------
Paul D. Smith <address@hidden> Find some GNU make tips at:
http://www.gnu.org http://make.mad-scientist.net
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist
- How to capture a set of recurring rules?, Peng Yu, 2010/02/01
- Re: How to capture a set of recurring rules?,
Paul Smith <=
- Re: How to capture a set of recurring rules?, Philip Guenther, 2010/02/02
- Re: How to capture a set of recurring rules?, Paul Smith, 2010/02/02
- Re: How to capture a set of recurring rules?, Peng Yu, 2010/02/02
- Re: How to capture a set of recurring rules?, Philip Guenther, 2010/02/04
- Re: How to capture a set of recurring rules?, Peng Yu, 2010/02/04
- Re: How to capture a set of recurring rules?, Paul Smith, 2010/02/05
- Re: How to capture a set of recurring rules?, Paul Smith, 2010/02/05
- Re: How to capture a set of recurring rules?, Peng Yu, 2010/02/05
- Re: How to capture a set of recurring rules?, Philip Guenther, 2010/02/05