diff options
Diffstat (limited to 'devdocs/gnu_make/recipe-syntax.html')
| -rw-r--r-- | devdocs/gnu_make/recipe-syntax.html | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/devdocs/gnu_make/recipe-syntax.html b/devdocs/gnu_make/recipe-syntax.html new file mode 100644 index 00000000..a97f8b0d --- /dev/null +++ b/devdocs/gnu_make/recipe-syntax.html @@ -0,0 +1,20 @@ + <h1 class="section">Recipe Syntax</h1> <p>Makefiles have the unusual property that there are really two distinct syntaxes in one file. Most of the makefile uses <code>make</code> syntax (see <a href="makefiles">Writing Makefiles</a>). However, recipes are meant to be interpreted by the shell and so they are written using shell syntax. The <code>make</code> program does not try to understand shell syntax: it performs only a very few specific translations on the content of the recipe before handing it to the shell. </p> <p>Each line in the recipe must start with a tab (or the first character in the value of the <code>.RECIPEPREFIX</code> variable; see <a href="special-variables">Special Variables</a>), except that the first recipe line may be attached to the target-and-prerequisites line with a semicolon in between. <em>Any</em> line in the makefile that begins with a tab and appears in a “rule context” (that is, after a rule has been started until another rule or variable definition) will be considered part of a recipe for that rule. Blank lines and lines of just comments may appear among the recipe lines; they are ignored. </p> <p>Some consequences of these rules include: </p> <ul> <li> A blank line that begins with a tab is not blank: it’s an empty recipe (see <a href="empty-recipes">Empty Recipes</a>). </li> +<li> A comment in a recipe is not a <code>make</code> comment; it will be passed to the shell as-is. Whether the shell treats it as a comment or not depends on your shell. </li> +<li> A variable definition in a “rule context” which is indented by a tab as the first character on the line, will be considered part of a recipe, not a <code>make</code> variable definition, and passed to the shell. </li> +<li> A conditional expression (<code>ifdef</code>, <code>ifeq</code>, etc. see <a href="conditional-syntax">Syntax of Conditionals</a>) in a “rule context” which is indented by a tab as the first character on the line, will be considered part of a recipe and be passed to the shell. </li> +</ul> <table class="menu" border="0" cellspacing="0"> <tr> +<td align="left" valign="top">• <a href="splitting-recipe-lines" accesskey="1">Splitting Recipe Lines</a> +</td> +<td> </td> +<td align="left" valign="top">Breaking long recipe lines for readability. </td> +</tr> <tr> +<td align="left" valign="top">• <a href="variables-in-recipes" accesskey="2">Variables in Recipes</a> +</td> +<td> </td> +<td align="left" valign="top">Using <code>make</code> variables in 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/Recipe-Syntax.html" class="_attribution-link">https://www.gnu.org/software/make/manual/html_node/Recipe-Syntax.html</a> + </p> +</div> |
