summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorDmitry Goncharov <dgoncharov@users.sf.net>2021-05-30 13:48:29 -0400
committerPaul Smith <psmith@gnu.org>2021-07-25 17:15:38 -0400
commit33468b3f31d65815152c11f32dc5c4384a6267b5 (patch)
treedd6ea8bec02ce9b16af732d0a229b7e74e63d75e /doc
parent1cffd0a203bc1477671a02aafd6360b7bb964670 (diff)
downloadmake-git-33468b3f31d65815152c11f32dc5c4384a6267b5.tar.gz
[SV 60297] Add .NOTINTERMEDIATE special target
Support a new special target, .NOTINTERMEDIATE. Any file or pattern prerequisite of this target will never be considered intermediate. This differs from .SECONDARY in that .SECONDARY files won't be deleted but they will still not be built if they are missing. .NOTINTERMEDIATE files are treated the same way as a target which is explicitly mentioned in the makefile. This is mostly useful with patterns; obviously mentioning a target explicitly here is enough in and of itself to make something not intermediate. Some adjustments made by psmith@gnu.org * NEWS: Announce the new feature. * doc/make.texi (Special Targets): Document .NOTINTERMEDIATE. (Chained Rules): Describe how to use .NOTINTERMEDIATE. * src/main.c (main): Add "notintermediate" to the .FEATURES variable. * src/filedef.h (struct file): Add "notintermediate" flag. * src/file.c (no_intermediates): Mark global .NOTINTERMEDIATE. (snap_file): Support .NOTINTERMEDIATE special target. Throw an error if the same target is marked both .NOTINTERMEDIATE and .SECONDARY or .INTERMEDIATE. (rehash_file): Merge intermediate, notintermediate, secondary flags. (remove_intermediates): Check notintermediate flag before removing. (print_file): * src/implicit.c (pattern_search): Set notintermediate based on the pattern. * tests/scripts/targets/NOTINTERMEDIATE: Add a new test suite.
Diffstat (limited to 'doc')
-rw-r--r--doc/make.texi42
1 files changed, 29 insertions, 13 deletions
diff --git a/doc/make.texi b/doc/make.texi
index 1464d0ca..db4d7e7a 100644
--- a/doc/make.texi
+++ b/doc/make.texi
@@ -2969,6 +2969,18 @@ The targets which @code{.INTERMEDIATE} depends on are treated as
intermediate files. @xref{Chained Rules, ,Chains of Implicit Rules}.
@code{.INTERMEDIATE} with no prerequisites has no effect.
+@findex .NOTINTERMEDIATE
+@item .NOTINTERMEDIATE
+@cindex notintermediate targets, explicit
+
+Prerequisites of the special target @code{.NOTINTERMEDIATE} are never
+considered intermediate files. @xref{Chained Rules, ,Chains of Implicit Rules}.
+@code{.NOTINTERMEDIATE} with no prerequisites causes all targets to be treated
+as notintermediate.
+
+If the prerequisite is a target pattern then targets that are built using that
+pattern rule are not considered intermediate.
+
@findex .SECONDARY
@item .SECONDARY
@cindex secondary targets
@@ -9994,22 +10006,26 @@ file as intermediate by listing it as a prerequisite of the special target
@code{.INTERMEDIATE}. This takes effect even if the file is mentioned
explicitly in some other way.
+Listing a file as a prerequisite of the special target
+@code{.NOTINTERMEDIATE} forces it to not be considered intermediate
+(just as any other mention of the file will do). Also, listing the
+target pattern of a pattern rule as a prerequisite of
+@code{.NOTINTERMEDIATE} ensures that no targets generated using that
+pattern rule are considered intermediate.
+
+You can disable intermediate files completely in your makefile by
+providing @code{.NOTINTERMEDIATE} as a target with no prerequisites:
+in that case it applies to every file in the makefile.
+
@cindex intermediate files, preserving
@cindex preserving intermediate files
@cindex secondary files
-You can prevent automatic deletion of an intermediate file by marking it
-as a @dfn{secondary} file. To do this, list it as a prerequisite of the
-special target @code{.SECONDARY}. When a file is secondary, @code{make}
-will not create the file merely because it does not already exist, but
-@code{make} does not automatically delete the file. Marking a file as
-secondary also marks it as intermediate.
-
-You can list the target pattern of an implicit rule (such as @samp{%.o})
-as a prerequisite of the special target @code{.PRECIOUS} to preserve
-intermediate files made by implicit rules whose target patterns match
-that file's name; see @ref{Interrupts}.@refill
-@cindex preserving with @code{.PRECIOUS}
-@cindex @code{.PRECIOUS} intermediate files
+If you do not want @code{make} to create a file merely because it does
+not already exist, but you also do not want @code{make} to
+automatically delete the file, you can mark it as a @dfn{secondary}
+file. To do this, list it as a prerequisite of the special target
+@code{.SECONDARY}. Marking a file as secondary also marks it as
+intermediate.
A chain can involve more than two implicit rules. For example, it is
possible to make a file @file{foo} from @file{RCS/foo.y,v} by running RCS,