Module Name: src
Committed By: rillig
Date: Fri Sep 25 18:18:25 UTC 2020
Modified Files:
src/distrib/sets/lists/tests: mi
src/usr.bin/make/unit-tests: Makefile
Added Files:
src/usr.bin/make/unit-tests: suff-rebuild.exp suff-rebuild.mk
Log Message:
make(1): add test for deleting the suffixes during parsing
To generate a diff of this commit:
cvs rdiff -u -r1.928 -r1.929 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.149 -r1.150 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/suff-rebuild.exp \
src/usr.bin/make/unit-tests/suff-rebuild.mk
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.928 src/distrib/sets/lists/tests/mi:1.929
--- src/distrib/sets/lists/tests/mi:1.928 Fri Sep 25 05:56:59 2020
+++ src/distrib/sets/lists/tests/mi Fri Sep 25 18:18:25 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.928 2020/09/25 05:56:59 rillig Exp $
+# $NetBSD: mi,v 1.929 2020/09/25 18:18:25 rillig Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -4960,6 +4960,8 @@
./usr/tests/usr.bin/make/unit-tests/sh-single-line.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/sh.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/sh.mk tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/suff-rebuild.exp tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/suff-rebuild.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/suffixes.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/suffixes.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/sunshcmd.exp tests-usr.bin-tests compattestfile,atf
Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.149 src/usr.bin/make/unit-tests/Makefile:1.150
--- src/usr.bin/make/unit-tests/Makefile:1.149 Fri Sep 25 05:56:59 2020
+++ src/usr.bin/make/unit-tests/Makefile Fri Sep 25 18:18:25 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.149 2020/09/25 05:56:59 rillig Exp $
+# $NetBSD: Makefile,v 1.150 2020/09/25 18:18:25 rillig Exp $
#
# Unit tests for make(1)
#
@@ -242,6 +242,7 @@ TESTS+= sh-meta-chars
TESTS+= sh-multi-line
TESTS+= sh-single-line
TESTS+= # suffixes # runs into an endless loop (try -dA)
+TESTS+= suff-rebuild
TESTS+= sunshcmd
TESTS+= sysv
TESTS+= ternary
Added files:
Index: src/usr.bin/make/unit-tests/suff-rebuild.exp
diff -u /dev/null src/usr.bin/make/unit-tests/suff-rebuild.exp:1.1
--- /dev/null Fri Sep 25 18:18:26 2020
+++ src/usr.bin/make/unit-tests/suff-rebuild.exp Fri Sep 25 18:18:25 2020
@@ -0,0 +1,5 @@
+: from nothing to a
+: from a to b
+: from b to c
+: from c to nothing
+exit status 0
Index: src/usr.bin/make/unit-tests/suff-rebuild.mk
diff -u /dev/null src/usr.bin/make/unit-tests/suff-rebuild.mk:1.1
--- /dev/null Fri Sep 25 18:18:26 2020
+++ src/usr.bin/make/unit-tests/suff-rebuild.mk Fri Sep 25 18:18:25 2020
@@ -0,0 +1,33 @@
+# $NetBSD: suff-rebuild.mk,v 1.1 2020/09/25 18:18:25 rillig Exp $
+#
+# Demonstrates what happens to transformation rules (called inference rules
+# by POSIX) when all suffixes are deleted.
+
+all: suff-rebuild-example
+
+.SUFFIXES:
+
+.SUFFIXES: .a .b .c
+
+suff-rebuild-example.a:
+ : from nothing to a
+
+.a.b:
+ : from a to b
+.b.c:
+ : from b to c
+.c:
+ : from c to nothing
+
+# XXX: At a quick glance, the code in SuffScanTargets looks at if it were
+# possible to delete the suffixes in the middle of the makefile, add back
+# the suffixes from before, and have the transformation rules preserved.
+#
+# As of 2020-09-25, uncommenting the following line results in the error
+# message "don't know how to make suff-rebuild-example" though.
+#
+#.SUFFIXES:
+
+# Add the suffixes back. It should not matter that the order of the suffixes
+# is different from before.
+.SUFFIXES: .c .b .a