Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] Question: := vs = in package *.mk files
@ 2011-10-05  0:55 H Hartley Sweeten
  2011-10-05  7:04 ` Thomas Petazzoni
  0 siblings, 1 reply; 3+ messages in thread
From: H Hartley Sweeten @ 2011-10-05  0:55 UTC (permalink / raw)
  To: buildroot

Hello all,

The Buildroot documentation shows using '=' when setting variables
in the package *.mk file.  Some of the existing packages use ':='
instead.  What's the difference?  Should the existing packages be
updated?

Thanks,
Hartley

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Buildroot] Question: := vs = in package *.mk files
  2011-10-05  0:55 [Buildroot] Question: := vs = in package *.mk files H Hartley Sweeten
@ 2011-10-05  7:04 ` Thomas Petazzoni
  2011-10-05 20:40   ` Peter Korsgaard
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Petazzoni @ 2011-10-05  7:04 UTC (permalink / raw)
  To: buildroot

Le Tue, 4 Oct 2011 19:55:48 -0500,
H Hartley Sweeten <hartleys@visionengravers.com> a ?crit :

> The Buildroot documentation shows using '=' when setting variables
> in the package *.mk file.  Some of the existing packages use ':='
> instead.  What's the difference?  Should the existing packages be
> updated?

The difference is explained in the make documentation:


"""

   The first flavor of variable is a "recursively expanded" variable.
Variables of this sort are defined by lines using `=' (*note Setting
Variables: Setting.) or by the `define' directive (*note Defining
Variables Verbatim: Defining.).  The value you specify is installed
verbatim; if it contains references to other variables, these
references are expanded whenever this variable is substituted (in the
course of expanding some other string).

[...]

"Simply expanded variables" are defined by lines using `:=' (*note
Setting Variables: Setting.).  The value of a simply expanded variable
is scanned once and for all, expanding any references to other
variables and functions, when the variable is defined.  The actual
value of the simply expanded variable is the result of expanding the
text that you write.  It does not contain any references to other
variables; it contains their values _as of the time this variable was
defined_. 

"""

See http://www.gnu.org/software/make/manual/make.html#Flavors

In package definition, Peter has said that he preferred the usage of
'=' except when it would create a noticeable performance problem. So
for all package definitions such as _SITE, _VERSION, _SOURCE,
_AUTORECONF, _INSTALL_STAGING, etc. the '=' sign is the one to choose.

Of course, a lot of packages do not comply with this rule, but this
will be fixed progressively over time as we update packages.

Regards,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Buildroot] Question: := vs = in package *.mk files
  2011-10-05  7:04 ` Thomas Petazzoni
@ 2011-10-05 20:40   ` Peter Korsgaard
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Korsgaard @ 2011-10-05 20:40 UTC (permalink / raw)
  To: buildroot

>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@free-electrons.com> writes:

Hi,

 Thomas> In package definition, Peter has said that he preferred the usage of
 Thomas> '=' except when it would create a noticeable performance problem. So
 Thomas> for all package definitions such as _SITE, _VERSION, _SOURCE,
 Thomas> _AUTORECONF, _INSTALL_STAGING, etc. the '=' sign is the one to choose.

Indeed. And the reason for this is that it fixes ordering issues because
of the late bindings, so you don't need to be careful about using
"outside" variables within a package .mk

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-10-05 20:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-05  0:55 [Buildroot] Question: := vs = in package *.mk files H Hartley Sweeten
2011-10-05  7:04 ` Thomas Petazzoni
2011-10-05 20:40   ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox