help-make
[Top][All Lists]
Advanced

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

Re: How to capture a set of recurring rules?


From: Peng Yu
Subject: Re: How to capture a set of recurring rules?
Date: Tue, 2 Feb 2010 07:58:15 -0600

On Tue, Feb 2, 2010 at 1:13 AM, Philip Guenther <address@hidden> wrote:
> On Monday, February 1, 2010, Paul Smith <address@hidden> wrote:
> ...
>> 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.
>
> Why do the dependencies need to be separate arguments to the macro and
> not just one argument with embedded spaces?
>
> Philip Guenther

That is because I want to keep everything related to a RData file
close to each other. Otherwise, I have changed multiple distant places
in a Makefile. When the number of RData is larger, it will be a
nightmare to maintain the makefile.

Actually, I don't think that you should ask this question, as Means of
Abstraction (according to SICP, http://mitpress.mit.edu/sicp/), with
the closure property, which is a very important element in a
programming language, is clearly not completely supported in GNU Make.
Make should be able to build new rules from old rules. The rules
should looks the same to user. Although the above solution practically
works, it lacks the two ingredients.




reply via email to

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