What is the value of the variable defined on the same line of the rule as the prerequisites, such as "a: x = 0" in GNU Make?

I saw code similar to the following code in the Makefile:

a: x = 0 

What does this line mean? Is this a rule or something else?

-1
source share
1 answer

This is called the target variable, see https://www.gnu.org/software/make/manual/html_node/Target_002dspecific.html

It gives a different value to the variable inside the given target.

Sample Usage:

 x := 0 a: x := 1 a: @echo $x b: @echo $x 

Now:

 $ make a 1 $ make b 0 
+2
source

Source: https://habr.com/ru/post/921551/


All Articles