Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 393
Vijay Avatar asked May 28 '11 02:05

Vijay


2 Answers

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

like image 148
Employed Russian Avatar answered Oct 26 '22 09:10

Employed Russian


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

like image 41
onteria_ Avatar answered Oct 26 '22 10:10

onteria_