Search code examples
makefilegnu-makecolon-equals

What's the difference between := and = in Makefile?


For variable assignment in Make, I see := and = operator. What's the difference between them?


Solution

  • This is described in the GNU Make documentation, in the section titled 6.2 The Two Flavors of Variables .

    In short, variables defined with := are expanded once, but variables defined with = are expanded whenever they are used.