-2

I have seen code like the following following code in a Makefile:

a: x = 0

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

1 Answers1

2

That is called a target specific variable, see: https://www.gnu.org/software/make/manual/html_node/Target_002dspecific.html

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

Sample usage:

x := 0

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

b:
    @echo $x

Now:

$ make a
1
$ make b
0