summaryrefslogtreecommitdiff
path: root/src/implicit.c
diff options
context:
space:
mode:
authorDmitry Goncharov <dgoncharov@users.sf.net>2021-12-29 14:26:40 -0500
committerPaul Smith <psmith@gnu.org>2021-12-29 15:26:56 -0500
commitf2b130bda889e04082187d4cf97adf6bab58ed7b (patch)
tree9cbdca36597b08f82d72cc525c5e4953cad3126d /src/implicit.c
parent8aba33a8bd4a437340aeade0a959037ac2734ace (diff)
downloadmake-git-f2b130bda889e04082187d4cf97adf6bab58ed7b.tar.gz
[SV 48643] Preserve target-specific variables on intermediate files
Target-specific variables used to define the target as "ought to exist" so they could never be intermediate. Now they can be, so merge the target-specific variables from the intermediate target so they're not lost. * src/implicit.c (pattern_search): Use merge_variable_set_lists to merge target-specific variables. * tests/scripts/features/implicit_search: Add tests of target- specific variable assignments and implicit rules.
Diffstat (limited to 'src/implicit.c')
-rw-r--r--src/implicit.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/implicit.c b/src/implicit.c
index 4abd1ce9..c65aec66 100644
--- a/src/implicit.c
+++ b/src/implicit.c
@@ -975,7 +975,11 @@ pattern_search (struct file *file, int archive,
f->deps = imf->deps;
f->cmds = imf->cmds;
f->stem = imf->stem;
- f->variables = imf->variables;
+ /* Setting target specific variables for a file causes the file to be
+ * entered to the database as a prerequisite. Implicit search then
+ * treats this file as explicitly mentioned. Preserve target specific
+ * variables of this file. */
+ merge_variable_set_lists(&f->variables, imf->variables);
f->pat_variables = imf->pat_variables;
f->pat_searched = imf->pat_searched;
f->also_make = imf->also_make;