Vijay
Vijay

Reputation: 67221

Makefile $@ variable-what is it used for?

I am new to learning make files.I was reading this post. could anyone please tell me what is $@ variable used for inside a makefile?

Upvotes: 5

Views: 5672

Answers (2)

onteria_
onteria_

Reputation: 70497

It's used to refer to the target, for example:

test:
        gcc -o $@ [email protected]

Would compile program test from test.c if you ran make test

Upvotes: 4

Employed Russian
Employed Russian

Reputation: 213526

The $@ stands for the target of the current rule. More info here.

Upvotes: 7

Related Questions