]> git.ipfire.org Git - thirdparty/make.git/commitdiff
[SV 48643] Add more tests of intermediates and unrelated targets
authorDmitry Goncharov <dgoncharov@users.sf.net>
Fri, 21 Jan 2022 23:37:44 +0000 (18:37 -0500)
committerPaul Smith <psmith@gnu.org>
Sun, 6 Feb 2022 23:46:32 +0000 (18:46 -0500)
If a prereq of a pattern is explicitly mentioned as a prereq of an
unrelated rule, it should not be considered an intermediate file.

* tests/scripts/features/double_colon: Add tests mentioning unrelated
explicit targets.
* tests/scripts/features/grouped_targets: Ditto.
* tests/scripts/features/implicit_search: Ditto.
* tests/scripts/features/patternrules: Ditto.
* tests/scripts/features/se_implicit: Ditto.
* tests/scripts/features/statipattrules: Ditto.

tests/scripts/features/double_colon
tests/scripts/features/grouped_targets
tests/scripts/features/implicit_search
tests/scripts/features/patternrules
tests/scripts/features/se_implicit
tests/scripts/features/statipattrules

index b5b73f700345414de46503d0e60a73a3ec1856d0..c4996e730699a8020faba20562b43dc05bf6db8f 100644 (file)
@@ -237,6 +237,20 @@ all: hello.z
 !,
               '', "#MAKE#: Nothing to be done for 'all'.\n");
 
+# subtest 3
+# hello.x is explicitly mentioned on an unrelated rule and thus is not an
+# intermediate file.
+# Terminal pattern rules do not apply anyway and there is no rule to built
+# 'hello.x'.
+touch('hello.z');
+run_make_test(q!
+all: hello.z
+%.z:: %.x; touch $@
+%.x: ;
+unrelated: hello.x
+!,
+              '', "#MAKE#: *** No rule to make target 'hello.x', needed by 'hello.z'.  Stop.\n", 512);
+
 unlink('hello.z');
 
 
index 131b8c0b7391f957547ef17556c534c8f8e5ae84..f6a172141032fd1c00a1ff4f7982dee86e639e43 100644 (file)
@@ -152,6 +152,16 @@ all: hello.z
 %.x: ;
 !, '', "hello.z hello.q\n");
 
+# subtest 3
+# hello.x is explicitly mentioned on an unrelated rule and thus is not an
+# intermediate file.
+run_make_test(q!
+all: hello.z
+%.z %.q: %.x; @echo $*.z $*.q
+%.x: ;
+unrelated: hello.x
+!, '', "hello.z hello.q\n");
+
 unlink('hello.z');
 unlink('hello.q');
 
index 93a212bd3e606475b8c36d4384221cf8d4015201..297e3217b4a47c3e11b995cfceb66b92b3e6df78 100644 (file)
@@ -278,6 +278,18 @@ unrelated: hello$s
 }
 }
 
+# Test that prerequisite 'hello.x' mentioned explicitly on an unrelated rule is
+# not considered intermediate.
+touch('hello.tsk');
+unlink('hello.x');
+run_make_test("
+all: hello.tsk
+%.tsk: %.x; touch hello.tsk
+%.x: ;
+unrelated: hello.x
+", '', "touch hello.tsk\n");
+unlink('hello.tsk');
+
 touch ('hello.f');
 # Test implicit search of builtin rules.
 
index 7303df5f4c1eba74ea63494baf19214e42f38994..623bb6ed02acbd99b3c09452451c56450490d984 100644 (file)
@@ -272,6 +272,18 @@ all: hello.z
 !,
               '', "touch hello.z");
 
+# subtest 3
+# hello.x is explicitly mentioned on an unrelated rule and thus is not an
+# intermediate file.
+touch('hello.z');
+run_make_test(q!
+all: hello.z
+%.z: %.x; touch $@
+%.x: ;
+unrelated: hello.x
+!,
+              '', "touch hello.z");
+
 unlink('hello.z');
 
 # sv 60188.
index db6e1683ceed96267928063e99d7ec9795a0e87c..712f3bfd77fd5f64cc3a7d00b0c05deeec379bc7 100644 (file)
@@ -291,6 +291,18 @@ all: hello.z
 %.x: ;
 !, '', "hello.z\n");
 
+# subtest 3.
+# hello.x is explicitly mentioned on an unrelated rule and thus is not an
+# intermediate file.
+run_make_test(q!
+.SECONDEXPANSION:
+dep:=hello.x
+all: hello.z
+%.z: %.x; @echo $@
+%.x: ;
+unrelated: $$(dep)
+!, '', "hello.z\n");
+
 unlink('hello.z');
 
 
index 096521ec116d49e055bc1ed92e69c361be93b991..378fedc5fda1c5fde64f3ec8e013cbf87adfb149 100644 (file)
@@ -123,10 +123,19 @@ hello.z: %.z: %.x ; @echo $@
 
 # subtest 2
 run_make_test(q!
-hello.z: %.z: test.x ; @echo $@
+hello.z: %.z: %.x test.x ; @echo $@
 %.x: ;
 !, '', "hello.z\n");
 
+# subtest 3
+# 'hello.x' is mentioned explicitly on an unrelated rule.
+run_make_test(q!
+hello.z: %.z: %.x ; @echo $@
+%.x: ;
+unrelated: hello.x
+!, '', "hello.z\n");
+
+
 unlink('hello.z');
 
 1;