help-make
[Top][All Lists]
Advanced

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

How to capture a set of recurring rules?


From: Peng Yu
Subject: How to capture a set of recurring rules?
Date: Mon, 1 Feb 2010 22:09:24 -0600

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 $<


For example, I might have a makefile that has the following rules.
Since the 3-rule pattern appears multiple times. I'm wondering if
there is a way to define a new rule that capture the thre rules so
that I can write my makefile simpler.


all: xxx.RData

clean: xxx.RData
        $(RM) $^

xxx.RData: xxx.R a.txt b.txt
        Rscript $<

all: uuu.RData

clean: uuu.RData
        $(RM) $^

uuu.RData: uuu.R x.txt y.txt z.txt
        Rscript $<




reply via email to

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