summaryrefslogtreecommitdiff
path: root/src/file.c
diff options
context:
space:
mode:
authorDmitry Goncharov <dgoncharov@users.sf.net>2021-09-07 00:08:27 -0400
committerPaul Smith <psmith@gnu.org>2021-09-07 01:14:20 -0400
commit9e4b3d3f4c8241a2c3cd66e1a7695befa5a6a0aa (patch)
tree57d940970aefe3e884095eaa7c273038a7940800 /src/file.c
parent5a96d5a066e86178886b80ad00130faf1cc079bf (diff)
downloadmake-git-9e4b3d3f4c8241a2c3cd66e1a7695befa5a6a0aa.tar.gz
[SV 60435] Ensure intermediate grouped files are removed
If multiple intermediate files are built together be sure all of them are removed after make is finished. Continue to ensure that targets that exist before make starts are not removed even if they appear to be intermediate. Add a number of tests to pattern rules to verify this behavior. * src/filedef.h (struct file): Add a new is_explicit bitfield. * src/file.c (rehash_file): Merge the is_explicit bit. (enter_prereqs): Set is_explicit if the file is explicitly mentioned. * src/implicit.c (pattern_search): Set intermediate on the file if it's not explicit. (record_files): Set is_explicit if a file is mentioned as a target. * src/remake.c (update_file_1): Set secondary on files that already exist so they won't be removed. * tests/scripts/features/double_colon: Add a test for double-colon pattern rules. * tests/scripts/features/patternrules: Update KGO for tests where more files are removed. Add new tests to verify handling removal of intermediate files in the context of grouped pattern targets.
Diffstat (limited to 'src/file.c')
-rw-r--r--src/file.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/file.c b/src/file.c
index 80696b8e..27be8b6c 100644
--- a/src/file.c
+++ b/src/file.c
@@ -338,6 +338,7 @@ rehash_file (struct file *from_file, const char *to_hname)
MERGE (cmd_target);
MERGE (phony);
/* Don't merge intermediate because this file might be pre-existing */
+ MERGE (is_explicit);
MERGE (secondary);
MERGE (notintermediate);
MERGE (ignore_vpath);
@@ -556,6 +557,9 @@ enter_prereqs (struct dep *deps, const char *stem)
d1->file = enter_file (d1->name);
d1->staticpattern = 0;
d1->name = 0;
+ if (!stem)
+ /* This file is explicitly mentioned as a prereq. */
+ d1->file->is_explicit = 1;
}
return deps;