summaryrefslogtreecommitdiff
path: root/devdocs/gnu_make/rule-example.html
diff options
context:
space:
mode:
Diffstat (limited to 'devdocs/gnu_make/rule-example.html')
-rw-r--r--devdocs/gnu_make/rule-example.html11
1 files changed, 11 insertions, 0 deletions
diff --git a/devdocs/gnu_make/rule-example.html b/devdocs/gnu_make/rule-example.html
new file mode 100644
index 00000000..f696e2a0
--- /dev/null
+++ b/devdocs/gnu_make/rule-example.html
@@ -0,0 +1,11 @@
+ <h1 class="section">Rule Example</h1> <p>Here is an example of a rule: </p> <div class="example"> <pre class="example">foo.o : foo.c defs.h # module for twiddling the frobs
+ cc -c -g foo.c
+</pre>
+</div> <p>Its target is <samp>foo.o</samp> and its prerequisites are <samp>foo.c</samp> and <samp>defs.h</samp>. It has one command in the recipe: ‘<samp>cc -c -g foo.c</samp>’. The recipe starts with a tab to identify it as a recipe. </p> <p>This rule says two things: </p> <ul> <li> How to decide whether <samp>foo.o</samp> is out of date: it is out of date if it does not exist, or if either <samp>foo.c</samp> or <samp>defs.h</samp> is more recent than it. </li>
+<li> How to update the file <samp>foo.o</samp>: by running <code>cc</code> as stated. The recipe does not explicitly mention <samp>defs.h</samp>, but we presume that <samp>foo.c</samp> includes it, and that is why <samp>defs.h</samp> was added to the prerequisites. </li>
+</ul><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/Rule-Example.html" class="_attribution-link">https://www.gnu.org/software/make/manual/html_node/Rule-Example.html</a>
+ </p>
+</div>