What is ?= in Makefile What is ?= in Makefile linux linux

What is ?= in Makefile


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