From 3bcb737d5a64288f2c6ff264ac7def698f17f6ce Mon Sep 17 00:00:00 2001 From: Christof Warlich Date: Sat, 6 Jul 2019 10:18:19 +0200 Subject: [PATCH 2/2] Fix documentation for dependency-only prerequisites. --- doc/make.texi | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/doc/make.texi b/doc/make.texi index 9e58802..df9f6b0 100644 --- a/doc/make.texi +++ b/doc/make.texi @@ -2088,7 +2088,7 @@ Now the rule to create the @file{objdir} directory will be run, if needed, before any @samp{.o} is built, but no @samp{.o} will be built because the @file{objdir} directory timestamp changed. -Finally, the third type of prerequisites, i.e. depenency-only +Finally, the third type of prerequisites, i.e. dependency-only prerequisites, may be specified by placing a "smaller than" symbol (@code{<}) in the prerequisite list: any prerequisites to the left of the "smaller than" symbol are normal (or order-only); any prerequisites @@ -2096,19 +2096,19 @@ to the right are dependency-only (and possibly order-only as well). Dependency-only prerequisites behave almost identical to the other two prerequisite types, with one important exception: They do not -contribute to any of their list-type related automatic variables. -Thus, dependency-only prerequisites are not added to neither +contribute to any of their list-type automatic variables. +Thus, dependency-only prerequisites are not added to any of the automatic variable lists $^, $+, $?, $*, $(^F), $(+F), $(?F), $(*F), $(^D), $(+D), $(?D) and $(*D), and prerequisites that are both -dependency-only and order-only are not added to neither of the -automatic variable lists $|, $(|F), $(|D). +dependency-only and order-only are not added to the +automatic variable list $|. -The rationale behind dependency-only dependencies is to make it more -easy to extend dependency lists of existing Makefiles. An example may +The rationale behind dependency-only dependencies is to make it easier +to extend dependency lists of existing Makefiles. An example can illustrate this: The following code may be considered as a snippet of a large and -maybe rather complex Makefile: +possibly rather complex Makefile: @example myappl: main.o file1.o file2.o @@ -2117,29 +2117,29 @@ myappl: main.o file1.o file2.o At a first glance, it lists all the relevant prerequisites, but a second thought reveals that this is just not true: The target -certainly also depends on the compiler frontend, the linker backend +also depends on the compiler frontend, the linker backend and the Makefile itself. Thus, a more complete snippet should look more like this: @example myappl: main.o file1.o file2.o /usr/bin/gcc /usr/bin/ld Makefile - gcc -o $@ $(filter %.o, $^) + gcc -o $@ $(filter %.o,$^) @end example -Please note the need for the newly introduced GNU Make's $(filter ) -function besides the additional prerequisites. +Please note the need for GNU Make's $(filter) function besides the +additional prerequisites. But for big projects, say the Linux kernel or a toolchain build, it would be rather laborious to change and fix all the Makefiles -accordingly, and it would be more than questionable if such patches +accordingly, and it is be more than questionable if such patches would be welcomed by every project. Fortunately, with dependency-only prerequisites at hand, the upstream Makefiles do not need to be -changed at all. Instead, it's sufficient to list the additional +changed at all. Instead, it is sufficient to list the additional dependencies as dependency-only prerequisites in another Makefile -that just includes the upstream Makefile. To continue with our +that simply includes the upstream Makefile. To continue with our example (and assuming the related upstream Makefile was just called -@code{Makefile}, we could most conviniently add a @code{GNUmakefile} +@code{Makefile}) we could most conveniently add a @code{GNUmakefile} with the following content: @example @@ -2149,7 +2149,7 @@ myappl: < /usr/bin/gcc /usr/bin/ld Makefile Calling @code{make} now would prefer @code{GNUmakefile} over @code{Makefile}, thus respecting the additional prerequisites -without affecting the related reciepe. +without affecting the related recipe. @node Wildcards, Directory Search, Prerequisite Types, Rules @section Using Wildcard Characters in File Names -- 2.17.1