Module Name:    src
Committed By:   rillig
Date:           Mon Nov 23 15:00:32 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-phony.exp suff-phony.mk

Log Message:
make(1): test that .PHONY targets are not resolved using suffix rules


To generate a diff of this commit:
cvs rdiff -u -r1.974 -r1.975 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.219 -r1.220 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/suff-phony.exp \
    src/usr.bin/make/unit-tests/suff-phony.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.974 src/distrib/sets/lists/tests/mi:1.975
--- src/distrib/sets/lists/tests/mi:1.974	Sun Nov 22 23:45:20 2020
+++ src/distrib/sets/lists/tests/mi	Mon Nov 23 15:00:32 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.974 2020/11/22 23:45:20 rillig Exp $
+# $NetBSD: mi,v 1.975 2020/11/23 15:00:32 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -5289,6 +5289,8 @@
 ./usr/tests/usr.bin/make/unit-tests/suff-main-several.mk			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/suff-main.exp				tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/suff-main.mk				tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/suff-phony.exp				tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/suff-phony.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/suff-self.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.219 src/usr.bin/make/unit-tests/Makefile:1.220
--- src/usr.bin/make/unit-tests/Makefile:1.219	Sun Nov 22 23:45:20 2020
+++ src/usr.bin/make/unit-tests/Makefile	Mon Nov 23 15:00:32 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.219 2020/11/22 23:45:20 rillig Exp $
+# $NetBSD: Makefile,v 1.220 2020/11/23 15:00:32 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -268,6 +268,7 @@ TESTS+=		suff-incomplete
 TESTS+=		suff-lookup
 TESTS+=		suff-main
 TESTS+=		suff-main-several
+TESTS+=		suff-phony
 TESTS+=		suff-rebuild
 TESTS+=		suff-self
 TESTS+=		suff-transform-debug

Added files:

Index: src/usr.bin/make/unit-tests/suff-phony.exp
diff -u /dev/null src/usr.bin/make/unit-tests/suff-phony.exp:1.1
--- /dev/null	Mon Nov 23 15:00:32 2020
+++ src/usr.bin/make/unit-tests/suff-phony.exp	Mon Nov 23 15:00:32 2020
@@ -0,0 +1,13 @@
+Adding suffix ".c"
+defining transformation from `.c' to `'
+inserting ".c" (1) at end of list
+inserting "" (0) at end of list
+transformation .c complete
+SuffFindDeps "all"
+	No valid suffix on all
+SuffFindDeps ".END"
+	No known suffix on .END. Using .NULL suffix
+adding suffix rules
+	trying .END.c...not there
+Wildcard expanding ".END"...
+exit status 0
Index: src/usr.bin/make/unit-tests/suff-phony.mk
diff -u /dev/null src/usr.bin/make/unit-tests/suff-phony.mk:1.1
--- /dev/null	Mon Nov 23 15:00:32 2020
+++ src/usr.bin/make/unit-tests/suff-phony.mk	Mon Nov 23 15:00:32 2020
@@ -0,0 +1,21 @@
+# $NetBSD: suff-phony.mk,v 1.1 2020/11/23 15:00:32 rillig Exp $
+#
+# Test that .PHONY targets are not resolved using suffix rules.
+#
+# The purpose of the .PHONY attribute is to mark them as independent from the
+# file system.
+#
+# See also:
+#	FindDepsRegular, Ctrl+F OP_PHONY
+
+.MAKEFLAGS: -ds
+
+all: .PHONY
+
+.SUFFIXES: .c
+
+.c:
+	: Making ${.TARGET} from ${.IMPSRC}.
+
+all.c:
+	: Making ${.TARGET} out of nothing.

Reply via email to