diff options
Diffstat (limited to 'devdocs/gnu_make/execution.html')
| -rw-r--r-- | devdocs/gnu_make/execution.html | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/devdocs/gnu_make/execution.html b/devdocs/gnu_make/execution.html new file mode 100644 index 00000000..10f06b05 --- /dev/null +++ b/devdocs/gnu_make/execution.html @@ -0,0 +1,19 @@ + <h1 class="section">Recipe Execution</h1> <p>When it is time to execute recipes to update a target, they are executed by invoking a new sub-shell for each line of the recipe, unless the <code>.ONESHELL</code> special target is in effect (see <a href="one-shell">Using One Shell</a>) (In practice, <code>make</code> may take shortcuts that do not affect the results.) </p> <p><strong>Please note:</strong> this implies that setting shell variables and invoking shell commands such as <code>cd</code> that set a context local to each process will not affect the following lines in the recipe.<a id="DOCF3" href="#FOOT3"><sup>3</sup></a> If you want to use <code>cd</code> to affect the next statement, put both statements in a single recipe line. Then <code>make</code> will invoke one shell to run the entire line, and the shell will execute the statements in sequence. For example: </p> <div class="example"> <pre class="example">foo : bar/lose + cd $(<D) && gobble $(<F) > ../$@ +</pre> +</div> <p>Here we use the shell AND operator (<code>&&</code>) so that if the <code>cd</code> command fails, the script will fail without trying to invoke the <code>gobble</code> command in the wrong directory, which could cause problems (in this case it would certainly cause <samp>../foo</samp> to be truncated, at least). </p> <table class="menu" border="0" cellspacing="0"> <tr> +<td align="left" valign="top">• <a href="one-shell" accesskey="1">One Shell</a> +</td> +<td> </td> +<td align="left" valign="top">One shell for all lines in a recipe. </td> +</tr> <tr> +<td align="left" valign="top">• <a href="choosing-the-shell" accesskey="2">Choosing the Shell</a> +</td> +<td> </td> +<td align="left" valign="top">How <code>make</code> chooses the shell used to run recipes. </td> +</tr> </table><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/Execution.html" class="_attribution-link">https://www.gnu.org/software/make/manual/html_node/Execution.html</a> + </p> +</div> |
