help-make
[Top][All Lists]
Advanced

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

Assigning $@ to target-specific variable


From: Ryan Berdeen
Subject: Assigning $@ to target-specific variable
Date: Tue, 21 Feb 2006 03:30:57 -0800

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.

According to the manual, "All variables that appear within the variable-assignment are evaluated within the context of the target" (http://www.gnu.org/software/make/manual/html_chapter/ make_6.html#SEC77). As far as I have been able to determine, inside the context of the target, $@ contains the name of the target.

Am I doing something wrong, misunderstanding the manual, or is something else going on? Is there a simple way to accomplish what I want?

Full disclosure:
I encountered this situation while completing a homework assignment on the recursive use of make. Since I wasn't able to use the above, I submitted my solution listing the targets as follows:
target1: target = target1
target2: target = target2
...

Thanks in advance for any assistance.

Ryan




reply via email to

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