summaryrefslogtreecommitdiff
path: root/devdocs/gnu_make/immediate-assignment.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2025-08-14 22:58:58 -0500
committerCraig Jennings <c@cjennings.net>2025-08-14 22:58:58 -0500
commit82ba818ff456bcd6d56a06226e3f27e98fbb55c3 (patch)
tree158cfc17b2f644a10f063cb546752cfaae12c97f /devdocs/gnu_make/immediate-assignment.html
parent9278ddd4ea1a8b1a4c1edaa8894516e3f48d245b (diff)
downloaddotemacs-82ba818ff456bcd6d56a06226e3f27e98fbb55c3.tar.gz
dotemacs-82ba818ff456bcd6d56a06226e3f27e98fbb55c3.zip
removing all downloaded devdocs files
Diffstat (limited to 'devdocs/gnu_make/immediate-assignment.html')
-rw-r--r--devdocs/gnu_make/immediate-assignment.html19
1 files changed, 0 insertions, 19 deletions
diff --git a/devdocs/gnu_make/immediate-assignment.html b/devdocs/gnu_make/immediate-assignment.html
deleted file mode 100644
index eff5701d..00000000
--- a/devdocs/gnu_make/immediate-assignment.html
+++ /dev/null
@@ -1,19 +0,0 @@
- <h1 class="subsection">Immediately Expanded Variable Assignment</h1> <p>Another form of assignment allows for immediate expansion, but unlike simple assignment the resulting variable is recursive: it will be re-expanded again on every use. In order to avoid unexpected results, after the value is immediately expanded it will automatically be quoted: all instances of <code>$</code> in the value after expansion will be converted into <code>$$</code>. This type of assignment uses the ‘<samp>:::=</samp>’ operator. For example, </p> <div class="example"> <pre class="example">var = first
-OUT :::= $(var)
-var = second
-</pre>
-</div> <p>results in the <code>OUT</code> variable containing the text ‘<samp>first</samp>’, while here: </p> <div class="example"> <pre class="example">var = one$$two
-OUT :::= $(var)
-var = three$$four
-</pre>
-</div> <p>results in the <code>OUT</code> variable containing the text ‘<samp>one$$two</samp>’. The value is expanded when the variable is assigned, so the result is the expansion of the first value of <code>var</code>, ‘<samp>one$two</samp>’; then the value is re-escaped before the assignment is complete giving the final result of ‘<samp>one$$two</samp>’. </p> <p>The variable <code>OUT</code> is thereafter considered a recursive variable, so it will be re-expanded when it is used. </p> <p>This seems functionally equivalent to the ‘<samp>:=</samp>’ / ‘<samp>::=</samp>’ operators, but there are a few differences: </p> <p>First, after assignment the variable is a normal recursive variable; when you append to it with ‘<samp>+=</samp>’ the value on the right-hand side is not expanded immediately. If you prefer the ‘<samp>+=</samp>’ operator to expand the right-hand side immediately you should use the ‘<samp>:=</samp>’ / ‘<samp>::=</samp>’ assignment instead. </p> <p>Second, these variables are slightly less efficient than simply expanded variables since they do need to be re-expanded when they are used, rather than merely copied. However since all variable references are escaped this expansion simply un-escapes the value, it won’t expand any variables or run any functions. </p> <p>Here is another example: </p> <div class="example"> <pre class="example">var = one$$two
-OUT :::= $(var)
-OUT += $(var)
-var = three$$four
-</pre>
-</div> <p>After this, the value of <code>OUT</code> is the text ‘<samp>one$$two $(var)</samp>’. When this variable is used it will be expanded and the result will be ‘<samp>one$two three$four</samp>’. </p> <p>This style of assignment is equivalent to the traditional BSD <code>make</code> ‘<samp>:=</samp>’ operator; as you can see it works slightly differently than the GNU <code>make</code> ‘<samp>:=</samp>’ operator. The <code>:::=</code> operator is added to the POSIX specification in Issue 8 to provide portability. </p><div class="_attribution">
- <p class="_attribution-p">
- Copyright © 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022 Free Software Foundation, Inc. <br>Licensed under the GNU Free Documentation License.<br>
- <a href="https://www.gnu.org/software/make/manual/html_node/Immediate-Assignment.html" class="_attribution-link">https://www.gnu.org/software/make/manual/html_node/Immediate-Assignment.html</a>
- </p>
-</div>