KDIR ?= $(shell uname -r)
What is the meaning of ?=
?
I have understood the difference between :=
, +=
and =
from another thread available in Stack Overflow, but unable to find the explanation for ?=
.
?= indicates to set the KDIR variable only if it's not set/doesn't have a value. For example: KDIR ?= "foo" KDIR ?= "bar" test: echo $(KDIR)
The simple answer is that %.o is a target that matches any file ending in .o. "%.o: %. c" means that any file ending in .o depends on the same filename ending in . c to be present.
$$ means be interpreted as a $ by the shell. the $(UNZIP_PATH) gets expanded by make before being interpreted by the shell.
If there is a wildcard symbol (%) in the pattern, this will match any number of characters, and these characters are copied into the replacement string at the place of the % in the second argument.
?=
indicates to set the KDIR
variable only if it's not set/doesn't have a value.
For example:
KDIR ?= "foo" KDIR ?= "bar" test: echo $(KDIR)
Would print "foo"
GNU manual: http://www.gnu.org/software/make/manual/html_node/Setting.html
Thanks to Simon and R.T. for their quick and correct response.
Also, I have found the GNU manual that explains everything in detail: http://www.gnu.org/software/make/manual/html_node/Setting.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With