Module Name: src
Committed By: rillig
Date: Sun Nov 22 20:29:54 UTC 2020
Modified Files:
src/usr.bin/make: parse.c suff.c
Log Message:
make(1): add debug logging for setting and resetting the main target
The suffix code still doesn't behave as expected. Make sure that at
least setting the main target works as expected. It does, and the added
debug logging provides further hints for debugging the suffix handling
code.
To generate a diff of this commit:
cvs rdiff -u -r1.446 -r1.447 src/usr.bin/make/parse.c
cvs rdiff -u -r1.299 -r1.300 src/usr.bin/make/suff.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/parse.c
diff -u src/usr.bin/make/parse.c:1.446 src/usr.bin/make/parse.c:1.447
--- src/usr.bin/make/parse.c:1.446 Sun Nov 22 19:14:24 2020
+++ src/usr.bin/make/parse.c Sun Nov 22 20:29:53 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.446 2020/11/22 19:14:24 rillig Exp $ */
+/* $NetBSD: parse.c,v 1.447 2020/11/22 20:29:53 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -117,7 +117,7 @@
#include "pathnames.h"
/* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.446 2020/11/22 19:14:24 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.447 2020/11/22 20:29:53 rillig Exp $");
/* types and constants */
@@ -1006,6 +1006,7 @@ FindMainTarget(void)
for (ln = targets->first; ln != NULL; ln = ln->next) {
GNode *gn = ln->datum;
if (!(gn->type & OP_NOTARGET)) {
+ 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.299 src/usr.bin/make/suff.c:1.300
--- src/usr.bin/make/suff.c:1.299 Sun Nov 22 18:13:52 2020
+++ src/usr.bin/make/suff.c Sun Nov 22 20:29:53 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: suff.c,v 1.299 2020/11/22 18:13:52 rillig Exp $ */
+/* $NetBSD: suff.c,v 1.300 2020/11/22 20:29:53 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
#include "dir.h"
/* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */
-MAKE_RCSID("$NetBSD: suff.c,v 1.299 2020/11/22 18:13:52 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.300 2020/11/22 20:29:53 rillig Exp $");
#define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
#define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -686,6 +686,7 @@ UpdateTarget(GNode *target, GNode **inou
if (*inout_main == NULL && *inout_removedMain &&
!(target->type & OP_NOTARGET)) {
+ DEBUG1(MAKE, "Setting main node to \"%s\"\n", target->name);
*inout_main = target;
Targ_SetMain(target);
/*
@@ -726,6 +727,8 @@ UpdateTarget(GNode *target, GNode **inou
if (ParseTransform(target->name, &srcSuff, &targSuff)) {
if (*inout_main == target) {
+ DEBUG1(MAKE, "Setting main node from \"%s\" back to null\n",
+ target->name);
*inout_removedMain = TRUE;
*inout_main = NULL;
Targ_SetMain(NULL);