help-make
[Top][All Lists]
Advanced

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

Re: Odd rule issue


From: Oleksandr Gavenko
Subject: Re: Odd rule issue
Date: Fri, 10 Dec 2010 10:33:07 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.12) Gecko/20101027 Thunderbird/3.1.6

On 10.12.2010 0:31, David Boyce wrote:
On Thu, Dec 9, 2010 at 6:26 AM, AdamWainwright<address@hidden>  wrote:
-------------------------------------------------
PROGS=../xxx

$(PROGS): $(addsuffix .y, $(@F))
        cp $(@F).y $@
-------------------------------------------------

Initial run copies file 'xxx.y' to 'xxx'.  If 'xxx.y' is updated then the
rule does not equate to 'true' (because the file 'xxx' doesn't exist) and
actions taken.  Using debug I find it isn't even considering the
dependencies of the addsuffix() and states that the file doesn't need to be
updated.  I feel there is some error in my logic here but I can't put my
finger on it.

One error in your logic is documented at
http://www.gnu.org/software/make/manual/make.html#Automatic-Variables:
"It's very important that you recognize the limited scope in which
automatic variable values are available: they only have values within
the recipe." Since $@ and its variant $(@F) are automatic variables,
they cannot be used in the top (target: prereq) line.

And also you can see doc about .SECONDEXPANSION.

But stop!

How about "Pattern Rules"?

../%: %.y
        cp ...

or if PROGS count is few (you mention only one) write:

../prog1: prog1.y
        cp ...
../prog2: prog2.y
        cp ...

--
С уважением, Александр Гавенко.



reply via email to

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