[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Assigning $@ to target-specific variable
From: |
Dave Hylands |
Subject: |
Re: Assigning $@ to target-specific variable |
Date: |
Thu, 23 Feb 2006 10:07:28 -0800 |
Hi Ryan,
Whoops - replying to the list as well.
> I've just started using GNU make (3.80), and I'm confused why the
> following doesn't work:
>
> $(TARGETS): target := $@
>
> The target variable remains empty.
The $@ variable only makes sense from within a recipie. So
SomeTarget : SomePreReq
echo $@
will echo SomeTarget
Because you used immediate evaluation, and it wasn't being evaluated
from within recipie, $@ is empty.
If you used this instead:
$(TARGETS): target = $@
then you'd be using deferred evaluation and (assuming that $(TARGETS)
contains SomeTarget)
SomeTarget : SomePreReq
echo $(target)
would work.
--
Dave Hylands
Vancouver, BC, Canada
http://www.DaveHylands.com/