diff options
| author | Craig Jennings <c@cjennings.net> | 2025-08-14 22:58:58 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2025-08-14 22:58:58 -0500 |
| commit | 82ba818ff456bcd6d56a06226e3f27e98fbb55c3 (patch) | |
| tree | 158cfc17b2f644a10f063cb546752cfaae12c97f /devdocs/gnu_make/recursive-assignment.html | |
| parent | 9278ddd4ea1a8b1a4c1edaa8894516e3f48d245b (diff) | |
| download | dotemacs-82ba818ff456bcd6d56a06226e3f27e98fbb55c3.tar.gz dotemacs-82ba818ff456bcd6d56a06226e3f27e98fbb55c3.zip | |
removing all downloaded devdocs files
Diffstat (limited to 'devdocs/gnu_make/recursive-assignment.html')
| -rw-r--r-- | devdocs/gnu_make/recursive-assignment.html | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/devdocs/gnu_make/recursive-assignment.html b/devdocs/gnu_make/recursive-assignment.html deleted file mode 100644 index 7c47a9c2..00000000 --- a/devdocs/gnu_make/recursive-assignment.html +++ /dev/null @@ -1,17 +0,0 @@ - <h1 class="subsection">Recursively Expanded Variable Assignment</h1> <p>The first flavor of variable is a <em>recursively expanded</em> variable. Variables of this sort are defined by lines using ‘<samp>=</samp>’ (see <a href="setting">Setting Variables</a>) or by the <code>define</code> directive (see <a href="multi_002dline">Defining Multi-Line Variables</a>). 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). When this happens, it is called <em>recursive expansion</em>. </p> <p>For example, </p> <div class="example"> <pre class="example">foo = $(bar) -bar = $(ugh) -ugh = Huh? - -all:;echo $(foo) -</pre> -</div> <p>will echo ‘<samp>Huh?</samp>’: ‘<samp>$(foo)</samp>’ expands to ‘<samp>$(bar)</samp>’ which expands to ‘<samp>$(ugh)</samp>’ which finally expands to ‘<samp>Huh?</samp>’. </p> <p>This flavor of variable is the only sort supported by most other versions of <code>make</code>. It has its advantages and its disadvantages. An advantage (most would say) is that: </p> <div class="example"> <pre class="example">CFLAGS = $(include_dirs) -O -include_dirs = -Ifoo -Ibar -</pre> -</div> <p>will do what was intended: when ‘<samp>CFLAGS</samp>’ is expanded in a recipe, it will expand to ‘<samp>-Ifoo -Ibar -O</samp>’. A major disadvantage is that you cannot append something on the end of a variable, as in </p> <div class="example"> <pre class="example">CFLAGS = $(CFLAGS) -O -</pre> -</div> <p>because it will cause an infinite loop in the variable expansion. (Actually <code>make</code> detects the infinite loop and reports an error.) </p> <p>Another disadvantage is that any functions (see <a href="functions">Functions for Transforming Text</a>) referenced in the definition will be executed every time the variable is expanded. This makes <code>make</code> run slower; worse, it causes the <code>wildcard</code> and <code>shell</code> functions to give unpredictable results because you cannot easily control when they are called, or even how many times. </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/Recursive-Assignment.html" class="_attribution-link">https://www.gnu.org/software/make/manual/html_node/Recursive-Assignment.html</a> - </p> -</div> |
