-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?

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985
  • If anyone can understand the downvote, please let me know. I want to learn to improve. I never retaliate downvoters who explain. Self answered to help other people in the world gain 15 minutes in their lives by googling keywords :-) – Ciro Santilli OurBigBook.com Aug 17 '15 at 06:50

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
Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985