Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make make(1): extract MakeBeginNode from Compat_Run
details: https://anonhg.NetBSD.org/src/rev/19cedff4fddc
branches: trunk
changeset: 957870:19cedff4fddc
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Dec 13 16:30:08 2020 +0000
description:
make(1): extract MakeBeginNode from Compat_Run
The comment "execute the commands" had once been correct but not
anymore. Since a few years, not only the commands of the .BEGIN and
.END nodes are executed, instead the nodes are made as usual, including
their dependencies.
diffstat:
usr.bin/make/compat.c | 34 ++++++++++++++++++----------------
1 files changed, 18 insertions(+), 16 deletions(-)
diffs (62 lines):
diff -r c311f6ca4775 -r 19cedff4fddc usr.bin/make/compat.c
--- a/usr.bin/make/compat.c Sun Dec 13 16:14:40 2020 +0000
+++ b/usr.bin/make/compat.c Sun Dec 13 16:30:08 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat.c,v 1.209 2020/12/13 16:14:40 rillig Exp $ */
+/* $NetBSD: compat.c,v 1.210 2020/12/13 16:30:08 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -96,7 +96,7 @@
#include "pathnames.h"
/* "@(#)compat.c 8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: compat.c,v 1.209 2020/12/13 16:14:40 rillig Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.210 2020/12/13 16:30:08 rillig Exp $");
static GNode *curTarg = NULL;
static pid_t compatChild;
@@ -660,6 +660,20 @@
MakeNodes(&gn->cohorts, pgn);
}
+static void
+MakeBeginNode(void)
+{
+ GNode *gn = Targ_FindNode(".BEGIN");
+ if (gn == NULL)
+ return;
+
+ Compat_Make(gn, gn);
+ if (GNode_IsError(gn)) {
+ PrintOnError(gn, "\nStop.");
+ exit(1);
+ }
+}
+
/* Initialize this module and start making.
*
* Input:
@@ -688,20 +702,8 @@
* detail probably doesn't matter though. */
(void)Targ_GetEndNode();
- /*
- * If the user has defined a .BEGIN target, execute the commands
- * attached to it.
- */
- if (!opts.queryFlag) {
- gn = Targ_FindNode(".BEGIN");
- if (gn != NULL) {
- Compat_Make(gn, gn);
- if (GNode_IsError(gn)) {
- PrintOnError(gn, "\nStop.");
- exit(1);
- }
- }
- }
+ if (!opts.queryFlag)
+ MakeBeginNode();
/*
* Expand .USE nodes right now, because they can modify the structure
Home |
Main Index |
Thread Index |
Old Index