aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--miscutils/make.c2
-rwxr-xr-xtestsuite/make.tests47
2 files changed, 25 insertions, 24 deletions
diff --git a/miscutils/make.c b/miscutils/make.c
index 86d06e970..1414f869c 100644
--- a/miscutils/make.c
+++ b/miscutils/make.c
@@ -722,7 +722,7 @@ dyndep(struct name *np, struct rule *imprule)
722 continue; 722 continue;
723 if (!ip->n_tim.tv_sec) 723 if (!ip->n_tim.tv_sec)
724 modtime(ip); 724 modtime(ip);
725 if (chain ? ip->n_tim.tv_sec || (ip->n_flag & N_TARGET) : 725 if (!chain ? ip->n_tim.tv_sec || (ip->n_flag & N_TARGET) :
726 dyndep(ip, NULL) != NULL) { 726 dyndep(ip, NULL) != NULL) {
727 // Prerequisite exists or we know how to make it 727 // Prerequisite exists or we know how to make it
728 if (imprule) { 728 if (imprule) {
diff --git a/testsuite/make.tests b/testsuite/make.tests
index 7bb736ade..70c1231b9 100755
--- a/testsuite/make.tests
+++ b/testsuite/make.tests
@@ -59,6 +59,25 @@ x.p:
59' 59'
60cd .. || exit 1; rm -rf make.tempdir 2>/dev/null 60cd .. || exit 1; rm -rf make.tempdir 2>/dev/null
61 61
62# Austin Group defect report 875 clarifies certain aspects of the
63# behaviour of inference rules. Study of this resulted in a number
64# of changes to pdpmake, though this test passed anyway.
65mkdir make.tempdir && cd make.tempdir || exit 1
66touch test.j test.k
67testing "make proper handling of inference rules 1" \
68 "make -f -" \
69 ".j.l\n" "" '
70.SUFFIXES: .j .k .l
71.j.l:
72 @echo .j.l
73.k.l:
74 @echo .k.l
75test.l: test.k
76test.j:
77test.k:
78'
79cd .. || exit 1; rm -rf make.tempdir 2>/dev/null
80
62# A macro created using ::= remembers it's of type immediate-expansion. 81# A macro created using ::= remembers it's of type immediate-expansion.
63# Immediate expansion also occurs when += is used to append to such a macro. 82# Immediate expansion also occurs when += is used to append to such a macro.
64testing "make appending to immediate-expansion macro" \ 83testing "make appending to immediate-expansion macro" \
@@ -397,29 +416,11 @@ target:
397 : hash # hash 416 : hash # hash
398' 417'
399 418
400# Austin Group defect report 875 clarifies certain aspects of the 419# Austin Group defect report 875 (mentioned above) actually used
401# behaviour of inference rules. Study of this resulted in a number 420# suffixes '.a .b .c'. This doesn't matter in POSIX mode but it
402# of changes to pdpmake. Since the issue at hand involves the use 421# caused a failure (now fixed) when chained inference rules were
403# of chained inference rules it doesn't affect POSIX mode. 422# allowed. The '.a.c' and the built-in '.c.a' inference rules
404mkdir make.tempdir && cd make.tempdir || exit 1 423# resulted in a loop.
405touch test.j test.k
406testing "make proper handling of inference rules 1" \
407 "make -f -" \
408 ".j.l\n" "" '
409.SUFFIXES: .j .k .l
410.j.l:
411 @echo .j.l
412.k.l:
413 @echo .k.l
414test.l: test.k
415test.j:
416test.k:
417'
418cd .. || exit 1; rm -rf make.tempdir 2>/dev/null
419
420# The actual test in the above-mentioned defect report was actually
421# more demanding. It used the suffixes '.a .b .c'. This results in
422# the built-in '.c.a' inference rule being introduced into the mix.
423mkdir make.tempdir && cd make.tempdir || exit 1 424mkdir make.tempdir && cd make.tempdir || exit 1
424touch test.a test.b 425touch test.a test.b
425testing "make proper handling of inference rules 2" \ 426testing "make proper handling of inference rules 2" \