Module Name: src
Committed By: rillig
Date: Tue Dec 28 14:22:51 UTC 2021
Modified Files:
src/usr.bin/make: make.h
src/usr.bin/make/unit-tests: depsrc-use.mk depsrc-usebefore.mk
Log Message:
make: do not treat .USEBEFORE as candidate for the main target
A .USE target is not a candidate, so .USEBEFORE shouldn't either.
Since make.h 1.36 from 2001-07-03. In that commit, OP_USEBEFORE should
have been added to OP_NOTARGET.
To generate a diff of this commit:
cvs rdiff -u -r1.280 -r1.281 src/usr.bin/make/make.h
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/depsrc-use.mk
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/depsrc-usebefore.mk
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.280 src/usr.bin/make/make.h:1.281
--- src/usr.bin/make/make.h:1.280 Tue Dec 28 14:06:42 2021
+++ src/usr.bin/make/make.h Tue Dec 28 14:22:51 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: make.h,v 1.280 2021/12/28 14:06:42 rillig Exp $ */
+/* $NetBSD: make.h,v 1.281 2021/12/28 14:22:51 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -816,9 +816,8 @@ GNode_IsError(const GNode *gn)
MAKE_INLINE bool MAKE_ATTR_USE
GNode_IsMainCandidate(const GNode *gn)
{
- /* XXX: What about OP_USEBEFORE? */
- return (gn->type & (OP_NOTMAIN | OP_USE | OP_EXEC | OP_TRANSFORM)) ==
- 0;
+ return (gn->type & (OP_NOTMAIN | OP_USE | OP_USEBEFORE |
+ OP_EXEC | OP_TRANSFORM)) == 0;
}
MAKE_INLINE const char * MAKE_ATTR_USE
Index: src/usr.bin/make/unit-tests/depsrc-use.mk
diff -u src/usr.bin/make/unit-tests/depsrc-use.mk:1.4 src/usr.bin/make/unit-tests/depsrc-use.mk:1.5
--- src/usr.bin/make/unit-tests/depsrc-use.mk:1.4 Sat Aug 22 12:30:57 2020
+++ src/usr.bin/make/unit-tests/depsrc-use.mk Tue Dec 28 14:22:51 2021
@@ -1,8 +1,13 @@
-# $NetBSD: depsrc-use.mk,v 1.4 2020/08/22 12:30:57 rillig Exp $
+# $NetBSD: depsrc-use.mk,v 1.5 2021/12/28 14:22:51 rillig Exp $
#
# Tests for the special source .USE in dependency declarations,
# which allows to append common commands to other targets.
+# Before make.h 1.280 from 2021-12-28, a .USEBEFORE target was accidentally
+# regarded as a candidate for the main target. On the other hand, a .USE
+# target was not.
+not-a-main-candidate: .USE
+
all: action directly
first: .USE
Index: src/usr.bin/make/unit-tests/depsrc-usebefore.mk
diff -u src/usr.bin/make/unit-tests/depsrc-usebefore.mk:1.6 src/usr.bin/make/unit-tests/depsrc-usebefore.mk:1.7
--- src/usr.bin/make/unit-tests/depsrc-usebefore.mk:1.6 Sun Nov 15 20:20:58 2020
+++ src/usr.bin/make/unit-tests/depsrc-usebefore.mk Tue Dec 28 14:22:51 2021
@@ -1,4 +1,4 @@
-# $NetBSD: depsrc-usebefore.mk,v 1.6 2020/11/15 20:20:58 rillig Exp $
+# $NetBSD: depsrc-usebefore.mk,v 1.7 2021/12/28 14:22:51 rillig Exp $
#
# Tests for the special source .USEBEFORE in dependency declarations,
# which allows to prepend common commands to other targets.
@@ -7,6 +7,11 @@
# .USE
# depsrc-use.mk
+# Before make.h 1.280 from 2021-12-28, a .USEBEFORE target was accidentally
+# regarded as a candidate for the main target. On the other hand, a .USE
+# target was not.
+not-a-main-candidate: .USEBEFORE
+
all: action directly
first: .USEBEFORE