PDA

View Full Version : a question about makefile



bzhao
August 20th, 2009, 04:30 AM
today I met a makefile having a line like:
TMP ?= /tmp

What does the "?" mean here.

Thanks indeed

zarthon
August 20th, 2009, 05:03 AM
From:
http://www.gnu.org/software/make/manual/html_node/Flavors.html#Flavors



There is another assignment operator for variables, `?='. This is called a conditional variable assignment operator, because it only has an effect if the variable is not yet defined. This statement:

FOO ?= bar

is exactly equivalent to this (see The origin Function):

ifeq ($(origin FOO), undefined)
FOO = bar
endif

bzhao
August 22nd, 2009, 05:32 PM
thank you for providing the link, which is good.