Module Name: src
Committed By: rillig
Date: Mon Feb 7 22:43:50 UTC 2022
Modified Files:
src/distrib/sets/lists/tests: mi
src/usr.bin/make/unit-tests: Makefile
Added Files:
src/usr.bin/make/unit-tests: suff-use.exp suff-use.mk
Log Message:
tests/make: demonstrate combination of .USE with transformation rule
Reported in 2003 in PR toolchain/20993. Linking a transformation rule
with .USE or .USEBEFORE node makes the transformation rule fail.
To generate a diff of this commit:
cvs rdiff -u -r1.1185 -r1.1186 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.302 -r1.303 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/suff-use.exp \
src/usr.bin/make/unit-tests/suff-use.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.1185 src/distrib/sets/lists/tests/mi:1.1186
--- src/distrib/sets/lists/tests/mi:1.1185 Sun Jan 23 18:00:53 2022
+++ src/distrib/sets/lists/tests/mi Mon Feb 7 22:43:50 2022
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1185 2022/01/23 18:00:53 rillig Exp $
+# $NetBSD: mi,v 1.1186 2022/02/07 22:43:50 rillig Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -5917,6 +5917,8 @@
./usr/tests/usr.bin/make/unit-tests/suff-transform-expand.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/suff-transform-select.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/suff-transform-select.mk tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/suff-use.exp tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/suff-use.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/suffixes.exp tests-obsolete obsolete
./usr/tests/usr.bin/make/unit-tests/suffixes.mk tests-obsolete obsolete
./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.302 src/usr.bin/make/unit-tests/Makefile:1.303
--- src/usr.bin/make/unit-tests/Makefile:1.302 Thu Jan 27 21:50:50 2022
+++ src/usr.bin/make/unit-tests/Makefile Mon Feb 7 22:43:50 2022
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.302 2022/01/27 21:50:50 sjg Exp $
+# $NetBSD: Makefile,v 1.303 2022/02/07 22:43:50 rillig Exp $
#
# Unit tests for make(1)
#
@@ -314,6 +314,7 @@ TESTS+= suff-transform-debug
TESTS+= suff-transform-endless
TESTS+= suff-transform-expand
TESTS+= suff-transform-select
+TESTS+= suff-use
TESTS+= sunshcmd
TESTS+= ternary
TESTS+= unexport
Added files:
Index: src/usr.bin/make/unit-tests/suff-use.exp
diff -u /dev/null src/usr.bin/make/unit-tests/suff-use.exp:1.1
--- /dev/null Mon Feb 7 22:43:50 2022
+++ src/usr.bin/make/unit-tests/suff-use.exp Mon Feb 7 22:43:50 2022
@@ -0,0 +1,7 @@
+: 'Making demo.c out of nothing'
+make: don't know how to make demo.o (continuing)
+`all' not remade because of errors.
+
+Stop.
+make: stopped in unit-tests
+exit status 1
Index: src/usr.bin/make/unit-tests/suff-use.mk
diff -u /dev/null src/usr.bin/make/unit-tests/suff-use.mk:1.1
--- /dev/null Mon Feb 7 22:43:50 2022
+++ src/usr.bin/make/unit-tests/suff-use.mk Mon Feb 7 22:43:50 2022
@@ -0,0 +1,50 @@
+# $NetBSD: suff-use.mk,v 1.1 2022/02/07 22:43:50 rillig Exp $
+#
+# This test combines a .USE node with suffix rules, trying to add an
+# additional command before and after successful compilation of a .c file.
+#
+# History:
+# bin/make-2001.11.12.21.58.18-plain
+# | : 'Making demo.c out of nothing'
+# | make: don't know how to make demo.o. Stop
+# |
+# | make: stopped in /home/rillig/proj/make-archive
+# | exit status 2
+# bin/make-2007.10.11.21.19.28-plain
+#
+# bin/make-2014.08.23.15.05.40-plain
+# | : 'Making demo.c out of nothing'
+# | : 'Compiling demo.c to demo.o'
+# | exit status 0
+# bin/make-2014.09.05.06.57.20-plain
+#
+# bin/make-2014.09.07.20.55.34-plain
+# | : 'Making demo.c out of nothing'
+# | make: don't know how to make demo.o. Stop
+# |
+# | make: stopped in /home/rillig/proj/make-archive
+# | exit status 2
+# ...
+#
+# See also:
+# https://gnats.netbsd.org/20993
+
+
+.SUFFIXES: .c .o
+
+all: demo.o
+
+.c.o:
+ : 'Compiling ${.IMPSRC} to ${.TARGET}'
+
+demo.c:
+ : 'Making ${.TARGET} out of nothing'
+
+using-before: .USEBEFORE
+ : 'Before making ${.TARGET} from ${.ALLSRCS}'
+
+using-after: .USE
+ : 'After making ${.TARGET} from ${.ALLSRCS}'
+
+# expect: make: don't know how to make demo.o (continuing)
+.c.o: using-before using-after