1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
<h1 class="chapter">Using Implicit Rules</h1> <p>Certain standard ways of remaking target files are used very often. For example, one customary way to make an object file is from a C source file using the C compiler, <code>cc</code>. </p> <p><em>Implicit rules</em> tell <code>make</code> how to use customary techniques so that you do not have to specify them in detail when you want to use them. For example, there is an implicit rule for C compilation. File names determine which implicit rules are run. For example, C compilation typically takes a <samp>.c</samp> file and makes a <samp>.o</samp> file. So <code>make</code> applies the implicit rule for C compilation when it sees this combination of file name endings. </p> <p>A chain of implicit rules can apply in sequence; for example, <code>make</code> will remake a <samp>.o</samp> file from a <samp>.y</samp> file by way of a <samp>.c</samp> file. </p> <p>The built-in implicit rules use several variables in their recipes so that, by changing the values of the variables, you can change the way the implicit rule works. For example, the variable <code>CFLAGS</code> controls the flags given to the C compiler by the implicit rule for C compilation. </p> <p>You can define your own implicit rules by writing <em>pattern rules</em>. </p> <p><em>Suffix rules</em> are a more limited way to define implicit rules. Pattern rules are more general and clearer, but suffix rules are retained for compatibility. </p> <table class="menu" border="0" cellspacing="0"> <tr>
<td align="left" valign="top">• <a href="using-implicit" accesskey="1">Using Implicit</a>
</td>
<td> </td>
<td align="left" valign="top">How to use an existing implicit rule to get the recipes for updating a file. </td>
</tr> <tr>
<td align="left" valign="top">• <a href="catalogue-of-rules" accesskey="2">Catalogue of Rules</a>
</td>
<td> </td>
<td align="left" valign="top">A list of built-in rules. </td>
</tr> <tr>
<td align="left" valign="top">• <a href="implicit-variables" accesskey="3">Implicit Variables</a>
</td>
<td> </td>
<td align="left" valign="top">How to change what predefined rules do. </td>
</tr> <tr>
<td align="left" valign="top">• <a href="chained-rules" accesskey="4">Chained Rules</a>
</td>
<td> </td>
<td align="left" valign="top">How to use a chain of implicit rules. </td>
</tr> <tr>
<td align="left" valign="top">• <a href="pattern-rules" accesskey="5">Pattern Rules</a>
</td>
<td> </td>
<td align="left" valign="top">How to define new implicit rules. </td>
</tr> <tr>
<td align="left" valign="top">• <a href="last-resort" accesskey="6">Last Resort</a>
</td>
<td> </td>
<td align="left" valign="top">How to define a recipe for rules which cannot find any. </td>
</tr> <tr>
<td align="left" valign="top">• <a href="suffix-rules" accesskey="7">Suffix Rules</a>
</td>
<td> </td>
<td align="left" valign="top">The old-fashioned style of implicit rule. </td>
</tr> <tr>
<td align="left" valign="top">• <a href="implicit-rule-search" accesskey="8">Implicit Rule Search</a>
</td>
<td> </td>
<td align="left" valign="top">The precise algorithm for applying implicit rules. </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/Implicit-Rules.html" class="_attribution-link">https://www.gnu.org/software/make/manual/html_node/Implicit-Rules.html</a>
</p>
</div>
|