summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorDmitry Goncharov <dgoncharov@users.sf.net>2022-07-24 18:16:50 -0400
committerPaul Smith <psmith@gnu.org>2022-07-30 18:40:28 -0400
commit07eea3aa496184bb763b7306e9de6a40a94605c9 (patch)
treef0b5e2b330b6ef40627b7050738c603aec4cd79b /doc
parent16e14b4114c0c9cc14d15e818bf22588a79e39da (diff)
downloadmake-git-07eea3aa496184bb763b7306e9de6a40a94605c9.tar.gz
[SV 62706] Only second-expand targets that might be built
Second-expand only the prerequisites of the targets being built. Defer second-expanding the prerequisites of targets until we need to decide if they should be built. * NEWS: Mention the change in behavior. * doc/make.texi (Secondary Expansion): Document the new behavior. * src/filedef.h (struct file): Add flag snapped. (expand_deps): Declare a function to second expand the prerequisites of a target. * src/file.c (rehash_file): Merge flag snapped. (expand_deps): Remove qualifier static. Check flag snapped. (snap_deps): Remove the loop which performed second expansion for all targets. * src/remake.c (update_file_1): Second expand the prerequisites of the considered target. * tests/scripts/features/se_explicit: Add tests. * tests/scripts/features/se_implicit: Ditto. * tests/scripts/features/se_statpat: Ditto.
Diffstat (limited to 'doc')
-rw-r--r--doc/make.texi22
1 files changed, 10 insertions, 12 deletions
diff --git a/doc/make.texi b/doc/make.texi
index 085e9c24..49cdb0b2 100644
--- a/doc/make.texi
+++ b/doc/make.texi
@@ -1703,18 +1703,16 @@ this second expansion to occur, the special target
@code{.SECONDEXPANSION} must be defined before the first prerequisite
list that makes use of this feature.
-If that special target is defined then in between the two phases
-mentioned above, right at the end of the read-in phase, all the
-prerequisites of the targets defined after the special target are
-expanded a @emph{second time}. In most circumstances this secondary
-expansion will have no effect, since all variable and function
-references will have been expanded during the initial parsing of the
-makefiles. In order to take advantage of the secondary expansion
-phase of the parser, then, it's necessary to @emph{escape} the
-variable or function reference in the makefile. In this case the
-first expansion merely un-escapes the reference but doesn't expand it,
-and expansion is left to the secondary expansion phase. For example,
-consider this makefile:
+If @code{.SECONDEXPANSION} is defined then when GNU @code{make} needs to check
+the prerequisites of a target, the prerequisites are expanded a @emph{second
+time}. In most circumstances this secondary expansion will have no effect,
+since all variable and function references will have been expanded during the
+initial parsing of the makefiles. In order to take advantage of the secondary
+expansion phase of the parser, then, it's necessary to @emph{escape} the
+variable or function reference in the makefile. In this case the first
+expansion merely un-escapes the reference but doesn't expand it, and expansion
+is left to the secondary expansion phase. For example, consider this
+makefile:
@example
.SECONDEXPANSION: