[SV 66273] Double-colon targets must not be intermediate An explicitly mentioned double-colon target cannot be intermediate. * src/read.c (record_files): Set file->is_explicit in the case of an explicitly mentioned file built by a double colon rule. * src/file.c (print_file): Have print_file print whether a file is explicitly mentioned. * tests/scripts/features/patternrules: Add tests.
diff --git a/src/file.c b/src/file.c index 6056bb5..6f816c8 100644 --- a/src/file.c +++ b/src/file.c
@@ -1129,6 +1129,9 @@ puts (_("# File is a prerequisite of .NOTINTERMEDIATE.")); if (f->secondary) puts (_("# File is secondary (prerequisite of .SECONDARY).")); + if (f->is_explicit) + puts (_("# File is explicitly mentioned.")); + if (f->also_make != 0) { const struct dep *d;
diff --git a/src/read.c b/src/read.c index f9b0dd7..2e30ce1 100644 --- a/src/read.c +++ b/src/read.c
@@ -2176,11 +2176,6 @@ free_dep_chain (f->deps); f->deps = 0; } - /* This file is explicitly mentioned as a target. There is no need - to set is_explicit in the case of double colon below, because an - implicit double colon rule only applies when the prerequisite - exists. A prerequisite which exists is not intermediate anyway. */ - f->is_explicit = 1; } else { @@ -2205,6 +2200,8 @@ f->cmds = cmds; } + /* This file is explicitly mentioned as a target. */ + f->is_explicit = 1; if (are_also_makes) {
diff --git a/tests/scripts/features/patternrules b/tests/scripts/features/patternrules index 24d9cfc..158a3ff 100644 --- a/tests/scripts/features/patternrules +++ b/tests/scripts/features/patternrules
@@ -693,5 +693,16 @@ unlink('b/hello.q'); rmdir('b'); +# SV 66273. An explicitly mentioned prerequisite is not intermediate, even in +# the case of double colon. +unlink('hello.q', 'hello.x'); +run_make_test(q! +all: hello.x +%.x: %.q; $(info $@ from $<) +hello.q::; touch $@ +!, + '', "touch hello.q\nhello.x from hello.q\n"); +unlink('hello.q'); + # This tells the test driver that the perl test script executed properly. 1;