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/make-deduces.html | |
| parent | 9278ddd4ea1a8b1a4c1edaa8894516e3f48d245b (diff) | |
| download | dotemacs-82ba818ff456bcd6d56a06226e3f27e98fbb55c3.tar.gz dotemacs-82ba818ff456bcd6d56a06226e3f27e98fbb55c3.zip | |
removing all downloaded devdocs files
Diffstat (limited to 'devdocs/gnu_make/make-deduces.html')
| -rw-r--r-- | devdocs/gnu_make/make-deduces.html | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/devdocs/gnu_make/make-deduces.html b/devdocs/gnu_make/make-deduces.html deleted file mode 100644 index 747b1840..00000000 --- a/devdocs/gnu_make/make-deduces.html +++ /dev/null @@ -1,25 +0,0 @@ - <h1 class="section">Letting make Deduce the Recipes</h1> <p>It is not necessary to spell out the recipes for compiling the individual C source files, because <code>make</code> can figure them out: it has an <em>implicit rule</em> for updating a ‘<samp>.o</samp>’ file from a correspondingly named ‘<samp>.c</samp>’ file using a ‘<samp>cc -c</samp>’ command. For example, it will use the recipe ‘<samp>cc -c main.c -o main.o</samp>’ to compile <samp>main.c</samp> into <samp>main.o</samp>. We can therefore omit the recipes from the rules for the object files. See <a href="implicit-rules">Using Implicit Rules</a>. </p> <p>When a ‘<samp>.c</samp>’ file is used automatically in this way, it is also automatically added to the list of prerequisites. We can therefore omit the ‘<samp>.c</samp>’ files from the prerequisites, provided we omit the recipe. </p> <p>Here is the entire example, with both of these changes, and a variable <code>objects</code> as suggested above: </p> <div class="example"> <pre class="example">objects = main.o kbd.o command.o display.o \ - insert.o search.o files.o utils.o - -edit : $(objects) - cc -o edit $(objects) - -main.o : defs.h -kbd.o : defs.h command.h -command.o : defs.h command.h -display.o : defs.h buffer.h -insert.o : defs.h buffer.h -search.o : defs.h buffer.h -files.o : defs.h buffer.h command.h -utils.o : defs.h - -.PHONY : clean -clean : - rm edit $(objects) -</pre> -</div> <p>This is how we would write the makefile in actual practice. (The complications associated with ‘<samp>clean</samp>’ are described elsewhere. See <a href="phony-targets">Phony Targets</a>, and <a href="errors">Errors in Recipes</a>.) </p> <p>Because implicit rules are so convenient, they are important. You will see them used frequently. </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/make-Deduces.html" class="_attribution-link">https://www.gnu.org/software/make/manual/html_node/make-Deduces.html</a> - </p> -</div> |
