help-make
[Top][All Lists]
Advanced

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

Re: How to define rule of rules?


From: Peng Yu
Subject: Re: How to define rule of rules?
Date: Sun, 2 May 2010 07:41:39 -0500

On Sat, May 1, 2010 at 8:20 PM, Stephan Beal <address@hidden> wrote:
> On Sun, May 2, 2010 at 2:11 AM, Peng Yu <address@hidden> wrote:
>>
>> I don't understand the above code. Would you give me the minimal code
>> for the scenario that mentioned in my first email?
>
> Sorry, but i thought that's exactly what i did. i'm not going to rewrite it
> for you to 100% match your use-case, but the pattern demonstrated there is
> one way to solve the problem you asked about:
> $(eval $(call png_rule,foo.R))

I think that you must have misunderstood my questions. Since the
definition of RData_rule, png_rule, csv_rule are almost the same. I
want to have a macro that can automatically define these rules by
passing the parameter RData, png and csv.

I tried the following code. But they don't work. I'm not sure if it is
possible at all to define one macro to define another macro.

.PHONY: all

define rule_of_rull
define $1_rull
TARGET:=$(patsubst %.R,%.$1,$$1)

all: $$$$(TARGET)

$$$$(TARGET): $$1
        @echo $$$$@

endef
endef


$(eval $(call rule_of_rull,RData))

$(eval $(call RDATA_rull,some.R))


-- 
Regards,
Peng




reply via email to

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