Module Name: src
Committed By: rillig
Date: Fri Jan 29 22:38:17 UTC 2021
Modified Files:
src/distrib/sets/lists/tests: mi
src/usr.bin/make/unit-tests: Makefile
Added Files:
src/usr.bin/make/unit-tests: jobs-empty-commands.exp
jobs-empty-commands.mk
Log Message:
make(1): demonstrate unnecessary creation of empty files in jobs mode
To generate a diff of this commit:
cvs rdiff -u -r1.1012 -r1.1013 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.262 -r1.263 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/jobs-empty-commands.exp \
src/usr.bin/make/unit-tests/jobs-empty-commands.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.1012 src/distrib/sets/lists/tests/mi:1.1013
--- src/distrib/sets/lists/tests/mi:1.1012 Sun Jan 17 23:00:41 2021
+++ src/distrib/sets/lists/tests/mi Fri Jan 29 22:38:17 2021
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1012 2021/01/17 23:00:41 rillig Exp $
+# $NetBSD: mi,v 1.1013 2021/01/29 22:38:17 rillig Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -5146,6 +5146,8 @@
./usr/tests/usr.bin/make/unit-tests/job-flags.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/job-output-long-lines.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/job-output-long-lines.mk tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/jobs-empty-commands.exp tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/jobs-empty-commands.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/jobs-error-indirect.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/jobs-error-indirect.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/jobs-error-nested-make.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.262 src/usr.bin/make/unit-tests/Makefile:1.263
--- src/usr.bin/make/unit-tests/Makefile:1.262 Sat Jan 23 07:34:00 2021
+++ src/usr.bin/make/unit-tests/Makefile Fri Jan 29 22:38:17 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.262 2021/01/23 07:34:00 rillig Exp $
+# $NetBSD: Makefile,v 1.263 2021/01/29 22:38:17 rillig Exp $
#
# Unit tests for make(1)
#
@@ -201,6 +201,7 @@ TESTS+= impsrc
TESTS+= include-main
TESTS+= job-flags
TESTS+= job-output-long-lines
+TESTS+= jobs-empty-commands
TESTS+= jobs-error-indirect
TESTS+= jobs-error-nested
TESTS+= jobs-error-nested-make
Added files:
Index: src/usr.bin/make/unit-tests/jobs-empty-commands.exp
diff -u /dev/null src/usr.bin/make/unit-tests/jobs-empty-commands.exp:1.1
--- /dev/null Fri Jan 29 22:38:17 2021
+++ src/usr.bin/make/unit-tests/jobs-empty-commands.exp Fri Jan 29 22:38:17 2021
@@ -0,0 +1,2 @@
+action
+exit status 0
Index: src/usr.bin/make/unit-tests/jobs-empty-commands.mk
diff -u /dev/null src/usr.bin/make/unit-tests/jobs-empty-commands.mk:1.1
--- /dev/null Fri Jan 29 22:38:17 2021
+++ src/usr.bin/make/unit-tests/jobs-empty-commands.mk Fri Jan 29 22:38:17 2021
@@ -0,0 +1,17 @@
+# $NetBSD: jobs-empty-commands.mk,v 1.1 2021/01/29 22:38:17 rillig Exp $
+#
+# In jobs mode, the shell commands for creating a target are written to a
+# temporary file first, which is then run by the shell. In chains of
+# dependencies, these files would end up empty. This can be avoided easily.
+#
+# https://mail-index.netbsd.org/current-users/2021/01/26/msg040215.html
+
+.MAKEFLAGS: -j1
+#.MAKEFLAGS: -dn # to see the created temporary files
+
+all: .PHONY step-1
+.for i i_plus_1 in ${:U:range=100:@i@$i $i@:[2..199]}
+step-$i: .PHONY step-${i_plus_1}
+.endfor
+step-100: .PHONY
+ @echo 'action'