Module Name: src
Committed By: rillig
Date: Fri Oct 23 19:11:30 UTC 2020
Modified Files:
src/distrib/sets/lists/tests: mi
src/usr.bin/make: make.h
src/usr.bin/make/unit-tests: Makefile dep-wildcards.exp
Added Files:
src/usr.bin/make/unit-tests: dep-double-colon-indep.exp
dep-double-colon-indep.mk
Log Message:
make(1): add test for the '::' dependency operator
To generate a diff of this commit:
cvs rdiff -u -r1.946 -r1.947 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.164 -r1.165 src/usr.bin/make/make.h
cvs rdiff -u -r1.171 -r1.172 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/dep-double-colon-indep.exp \
src/usr.bin/make/unit-tests/dep-double-colon-indep.mk
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/dep-wildcards.exp
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.946 src/distrib/sets/lists/tests/mi:1.947
--- src/distrib/sets/lists/tests/mi:1.946 Fri Oct 23 14:24:51 2020
+++ src/distrib/sets/lists/tests/mi Fri Oct 23 19:11:30 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.946 2020/10/23 14:24:51 rillig Exp $
+# $NetBSD: mi,v 1.947 2020/10/23 19:11:30 rillig Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -4627,6 +4627,8 @@
./usr/tests/usr.bin/make/unit-tests/dep-colon-bug-cross-file.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/dep-colon.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/dep-colon.mk tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/dep-double-colon-indep.exp tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/dep-double-colon-indep.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/dep-double-colon.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/dep-double-colon.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/dep-exclam.exp tests-usr.bin-tests compattestfile,atf
Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.164 src/usr.bin/make/make.h:1.165
--- src/usr.bin/make/make.h:1.164 Fri Oct 23 18:36:09 2020
+++ src/usr.bin/make/make.h Fri Oct 23 19:11:30 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: make.h,v 1.164 2020/10/23 18:36:09 rillig Exp $ */
+/* $NetBSD: make.h,v 1.165 2020/10/23 19:11:30 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -191,11 +191,15 @@ typedef enum {
*
* Some of the OP_ constants can be combined, others cannot. */
typedef enum GNodeType {
- /* Execution of commands depends on children (:) */
+ /* The dependency operator ':' is the most common one. The commands of
+ * this node are executed if any child is out-of-date. */
OP_DEPENDS = 1 << 0,
- /* Always execute commands (!) */
+ /* The dependency operator '!' always executes its commands, even if
+ * its children are up-to-date. */
OP_FORCE = 1 << 1,
- /* Execution of commands depends on children per line (::) */
+ /* The dependency operator '::' behaves like ':', except that it allows
+ * multiple dependency groups to be defined. Each of these groups is
+ * executed on its own, independently from the others. */
OP_DOUBLEDEP = 1 << 2,
/* Matches the dependency operators ':', '!' and '::'. */
Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.171 src/usr.bin/make/unit-tests/Makefile:1.172
--- src/usr.bin/make/unit-tests/Makefile:1.171 Fri Oct 23 14:38:39 2020
+++ src/usr.bin/make/unit-tests/Makefile Fri Oct 23 19:11:30 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.171 2020/10/23 14:38:39 rillig Exp $
+# $NetBSD: Makefile,v 1.172 2020/10/23 19:11:30 rillig Exp $
#
# Unit tests for make(1)
#
@@ -75,6 +75,7 @@ TESTS+= dep
TESTS+= dep-colon
TESTS+= dep-colon-bug-cross-file
TESTS+= dep-double-colon
+TESTS+= dep-double-colon-indep
TESTS+= dep-exclam
TESTS+= dep-none
TESTS+= dep-var
Index: src/usr.bin/make/unit-tests/dep-wildcards.exp
diff -u src/usr.bin/make/unit-tests/dep-wildcards.exp:1.3 src/usr.bin/make/unit-tests/dep-wildcards.exp:1.4
--- src/usr.bin/make/unit-tests/dep-wildcards.exp:1.3 Fri Sep 25 23:24:49 2020
+++ src/usr.bin/make/unit-tests/dep-wildcards.exp Fri Oct 23 19:11:30 2020
@@ -1,5 +1,6 @@
dep-colon-bug-cross-file.mk
dep-colon.mk
+dep-double-colon-indep.mk
dep-double-colon.mk
dep-exclam.mk
dep-none.mk
Added files:
Index: src/usr.bin/make/unit-tests/dep-double-colon-indep.exp
diff -u /dev/null src/usr.bin/make/unit-tests/dep-double-colon-indep.exp:1.1
--- /dev/null Fri Oct 23 19:11:30 2020
+++ src/usr.bin/make/unit-tests/dep-double-colon-indep.exp Fri Oct 23 19:11:30 2020
@@ -0,0 +1,3 @@
+: 'Making 1400 dep-double-colon-1300 from dep-double-colon-1400 oodate dep-double-colon-1400'
+: 'Making 1500 dep-double-colon-1300 from dep-double-colon-1500 oodate dep-double-colon-1500'
+exit status 0
Index: src/usr.bin/make/unit-tests/dep-double-colon-indep.mk
diff -u /dev/null src/usr.bin/make/unit-tests/dep-double-colon-indep.mk:1.1
--- /dev/null Fri Oct 23 19:11:30 2020
+++ src/usr.bin/make/unit-tests/dep-double-colon-indep.mk Fri Oct 23 19:11:30 2020
@@ -0,0 +1,32 @@
+# $NetBSD: dep-double-colon-indep.mk,v 1.1 2020/10/23 19:11:30 rillig Exp $
+#
+# Tests for the :: operator in dependency declarations, which allows multiple
+# dependency groups with the same target. Each group is evaluated on its own,
+# independent of the other groups.
+#
+# This is useful for targets that are updatable, such as a database or a log
+# file. Be careful with parallel mode though, to avoid lost updates and
+# other inconsistencies.
+#
+# The target 1300 depends on 1200, 1400 and 1500. The target 1200 is older
+# than 1300, therefore nothing is done for it. The other targets are newer
+# than 1300, therefore each of them is made, independently from the other.
+
+.END:
+ @rm -f dep-double-colon-1???
+
+_!= touch -t 202001011200 dep-double-colon-1200
+_!= touch -t 202001011300 dep-double-colon-1300
+_!= touch -t 202001011400 dep-double-colon-1400
+_!= touch -t 202001011500 dep-double-colon-1500
+
+all: dep-double-colon-1300
+
+dep-double-colon-1300:: dep-double-colon-1200
+ : 'Making 1200 ${.TARGET} from ${.ALLSRC} oodate ${.OODATE}'
+
+dep-double-colon-1300:: dep-double-colon-1400
+ : 'Making 1400 ${.TARGET} from ${.ALLSRC} oodate ${.OODATE}'
+
+dep-double-colon-1300:: dep-double-colon-1500
+ : 'Making 1500 ${.TARGET} from ${.ALLSRC} oodate ${.OODATE}'