Module Name: src
Committed By: rillig
Date: Fri Jan 7 20:50:35 UTC 2022
Modified Files:
src/usr.bin/make: make.h nonints.h parse.c suff.c targ.c
Log Message:
make: merge duplicate variables for the main target
No functional change.
To generate a diff of this commit:
cvs rdiff -u -r1.286 -r1.287 src/usr.bin/make/make.h
cvs rdiff -u -r1.231 -r1.232 src/usr.bin/make/nonints.h
cvs rdiff -u -r1.630 -r1.631 src/usr.bin/make/parse.c
cvs rdiff -u -r1.362 -r1.363 src/usr.bin/make/suff.c
cvs rdiff -u -r1.175 -r1.176 src/usr.bin/make/targ.c
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.286 src/usr.bin/make/make.h:1.287
--- src/usr.bin/make/make.h:1.286 Fri Jan 7 19:24:27 2022
+++ src/usr.bin/make/make.h Fri Jan 7 20:50:35 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: make.h,v 1.286 2022/01/07 19:24:27 rillig Exp $ */
+/* $NetBSD: make.h,v 1.287 2022/01/07 20:50:35 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -589,6 +589,7 @@ extern int makelevel;
extern char *makeDependfile;
/* If we replaced environ, this will be non-NULL. */
extern char **savedEnv;
+extern GNode *mainNode;
extern pid_t myPid;
Index: src/usr.bin/make/nonints.h
diff -u src/usr.bin/make/nonints.h:1.231 src/usr.bin/make/nonints.h:1.232
--- src/usr.bin/make/nonints.h:1.231 Fri Jan 7 20:09:58 2022
+++ src/usr.bin/make/nonints.h Fri Jan 7 20:50:35 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: nonints.h,v 1.231 2022/01/07 20:09:58 rillig Exp $ */
+/* $NetBSD: nonints.h,v 1.232 2022/01/07 20:50:35 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -183,7 +183,6 @@ GNode *Targ_GetNode(const char *) MAKE_A
GNode *Targ_NewInternalNode(const char *) MAKE_ATTR_USE;
GNode *Targ_GetEndNode(void);
void Targ_FindList(GNodeList *, StringList *);
-void Targ_SetMain(GNode *);
void Targ_PrintCmds(GNode *);
void Targ_PrintNode(GNode *, int);
void Targ_PrintNodes(GNodeList *, int);
Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.630 src/usr.bin/make/parse.c:1.631
--- src/usr.bin/make/parse.c:1.630 Fri Jan 7 20:37:25 2022
+++ src/usr.bin/make/parse.c Fri Jan 7 20:50:35 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.630 2022/01/07 20:37:25 rillig Exp $ */
+/* $NetBSD: parse.c,v 1.631 2022/01/07 20:50:35 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -106,7 +106,7 @@
#include "pathnames.h"
/* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.630 2022/01/07 20:37:25 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.631 2022/01/07 20:50:35 rillig Exp $");
/*
* A file being read.
@@ -179,10 +179,10 @@ typedef List SearchPathList;
typedef ListNode SearchPathListNode;
/*
- * The main target to create. This is the first target defined in any of the
- * makefiles.
+ * The target to be made if no targets are specified in the command line.
+ * This is the first target defined in any of the makefiles.
*/
-static GNode *mainNode;
+GNode *mainNode;
/*
* During parsing, the targets from the left-hand side of the currently
@@ -829,7 +829,6 @@ MaybeUpdateMainTarget(void)
if (GNode_IsMainCandidate(gn)) {
DEBUG1(MAKE, "Setting main node to \"%s\"\n", gn->name);
mainNode = gn;
- Targ_SetMain(gn);
return;
}
}
Index: src/usr.bin/make/suff.c
diff -u src/usr.bin/make/suff.c:1.362 src/usr.bin/make/suff.c:1.363
--- src/usr.bin/make/suff.c:1.362 Sat Jan 1 19:44:05 2022
+++ src/usr.bin/make/suff.c Fri Jan 7 20:50:35 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: suff.c,v 1.362 2022/01/01 19:44:05 rillig Exp $ */
+/* $NetBSD: suff.c,v 1.363 2022/01/07 20:50:35 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -115,7 +115,7 @@
#include "dir.h"
/* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */
-MAKE_RCSID("$NetBSD: suff.c,v 1.362 2022/01/01 19:44:05 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.363 2022/01/07 20:50:35 rillig Exp $");
typedef List SuffixList;
typedef ListNode SuffixListNode;
@@ -744,7 +744,6 @@ UpdateTarget(GNode *target, GNode **inou
GNode_IsMainCandidate(target)) {
DEBUG1(MAKE, "Setting main node to \"%s\"\n", target->name);
*inout_main = target;
- Targ_SetMain(target);
/*
* XXX: Why could it be a good idea to return true here?
* The main task of this function is to turn ordinary nodes
@@ -788,7 +787,6 @@ UpdateTarget(GNode *target, GNode **inou
target->name);
*inout_removedMain = true;
*inout_main = NULL;
- Targ_SetMain(NULL);
}
Lst_Done(&target->children);
Lst_Init(&target->children);
Index: src/usr.bin/make/targ.c
diff -u src/usr.bin/make/targ.c:1.175 src/usr.bin/make/targ.c:1.176
--- src/usr.bin/make/targ.c:1.175 Fri Jan 7 20:37:25 2022
+++ src/usr.bin/make/targ.c Fri Jan 7 20:50:35 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: targ.c,v 1.175 2022/01/07 20:37:25 rillig Exp $ */
+/* $NetBSD: targ.c,v 1.176 2022/01/07 20:50:35 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -107,7 +107,7 @@
#include "dir.h"
/* "@(#)targ.c 8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: targ.c,v 1.175 2022/01/07 20:37:25 rillig Exp $");
+MAKE_RCSID("$NetBSD: targ.c,v 1.176 2022/01/07 20:50:35 rillig Exp $");
/*
* All target nodes that appeared on the left-hand side of one of the
@@ -340,19 +340,6 @@ Targ_FindList(GNodeList *gns, StringList
}
}
-/*
- * The main target to be made; only for debugging output.
- * See mainNode in parse.c for the definitive source.
- */
-static GNode *mainTarg;
-
-/* Remember the main target to make; only used for debugging. */
-void
-Targ_SetMain(GNode *gn)
-{
- mainTarg = gn;
-}
-
static void
PrintNodeNames(GNodeList *gnodes)
{
@@ -494,7 +481,7 @@ Targ_PrintNode(GNode *gn, int pass)
return;
debug_printf("#\n");
- if (gn == mainTarg)
+ if (gn == mainNode)
debug_printf("# *** MAIN TARGET ***\n");
if (pass >= 2) {