Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In a Makefile, is "VARIABLE = value" equal to "VARIABLE=value?

Simple question but there are so many things to consider in make that it feels better if I ask this question:

Is VARIABLE = value equal to VARIABLE=value?

like image 335
Xiphias Avatar asked Sep 19 '25 20:09

Xiphias


2 Answers

Yes, they're the same. Per the docs:

Whitespace around the variable name and immediately after the ‘=’ is ignored.

like image 113
jonrsharpe Avatar answered Sep 23 '25 06:09

jonrsharpe


Just FYI, although VARIABLE := value is the same as VARIABLE:=value, but

VARIABLE:=$(undefined) value
# now VARIABLE is prepended with a space

is NOT. This is why the make's manual says "ignored immediately after equal sign".

Also, operator += always adds a space.

like image 34
Matt Avatar answered Sep 23 '25 05:09

Matt