5

Gnu Makefile shows two symbols for immediate expansion, as follows:

immediate := immediate
immediate ::= immediate

Is there a difference between these two?

reference: gnu makefile manual section 3.7

1 Answer 1

7

From section 6.2:

Simply expanded variables are defined by lines using ‘:=’ or ‘::=’ (see Setting Variables). Both forms are equivalent in GNU make; however only the ‘::=’ form is described by the POSIX standard (support for ‘::=’ was added to the POSIX standard in 2012, so older versions of make won’t accept this form either).

Sign up to request clarification or add additional context in comments.

5 Comments

Thanks! Any idea why they (POSIX) decided to chose ::= over simpler := ?
@Lavya: Other make implementations also had their own := extensions with various meanings. So POSIX invented new syntax to avoid stepping on any already existing toes. See austingroupbugs.net/view.php?id=330 for details (and dwheeler.com/essays/make.html for the excellent activism that brought this about).
@JohnMarshall Thanks!
Interesting assertion about POSIX 2012, but not substantiated by the POSIX 2013 web site (make — macros). There is no mention of either := or ::= in the POSIX specification that I can see, not even in the Rationale.
That bug 330 lists ::= as tagged Issue 8 and resolved as Accepted As Marked in December 2011. The POSIX 2013 web site still reflects the current Issue 7. The Austin Group FAQ doesn't give any clues as to in which decade we might hope to see Issue 8… Seems like the text in the GNU Make manual was hopeful that it would appear within the year when that text was written in January 2012.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.