Variables defined with ‘=’ are recursively expanded variables.
Variables defined with ‘:=’ or ‘::=’ are simply expanded variables.
(Both forms are equivalent in GNU make; however only the ‘::=’ form is described by the POSIX standard.)

 

  • := (Simply Expanded Variable) The value is scanned for once and for all expanding any references to other variables and functions, when variable is defined. e.g.
    x:=foo
    y:=$(x) bar
    x:=later
    so above is equivalent to
    y:=foo bar
    x:=later

  • += is used for appending more text to variables e.g.
    objects=main.o foo.o bar.o
    objects+=new.o
    which will set objects to 'main.o foo.o bar.o new.o'

  • = is for recursively expanded variable.The value is install verbatim; if it contains reference to other variables these variables are expanded whenever this variable is substituted.And this is known as recursive expansion.

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 BB 的頭像
    BB

    Welkin小窩

    BB 發表在 痞客邦 留言(0) 人氣()