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): use progname instead of hard-coded 'ma...



details:   https://anonhg.NetBSD.org/src/rev/736516ac055f
branches:  trunk
changeset: 957028:736516ac055f
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Nov 14 18:07:26 2020 +0000

description:
make(1): use progname instead of hard-coded 'make' in warning

This only affects the warning that chdir to objdir failed.  In sub-makes
the progname includes the [n], allowing to narrow down the actual cause
of the problem.

diffstat:

 usr.bin/make/main.c              |  8 ++++----
 usr.bin/make/unit-tests/Makefile |  4 +++-
 2 files changed, 7 insertions(+), 5 deletions(-)

diffs (47 lines):

diff -r 6cfc23a0c67a -r 736516ac055f usr.bin/make/main.c
--- a/usr.bin/make/main.c       Sat Nov 14 17:39:59 2020 +0000
+++ b/usr.bin/make/main.c       Sat Nov 14 18:07:26 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.462 2020/11/14 17:39:59 rillig Exp $        */
+/*     $NetBSD: main.c,v 1.463 2020/11/14 18:07:26 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "trace.h"
 
 /*     "@(#)main.c     8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: main.c,v 1.462 2020/11/14 17:39:59 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.463 2020/11/14 18:07:26 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
            "The Regents of the University of California.  "
@@ -732,8 +732,8 @@
        if (stat(path, &sb) == 0 && S_ISDIR(sb.st_mode)) {
                if ((writable && access(path, W_OK) != 0) ||
                    (chdir(path) != 0)) {
-                       (void)fprintf(stderr, "make warning: %s: %s.\n",
-                           path, strerror(errno));
+                       (void)fprintf(stderr, "%s warning: %s: %s.\n",
+                           progname, path, strerror(errno));
                } else {
                        snprintf(objdir, sizeof objdir, "%s", path);
                        Var_Set(".OBJDIR", objdir, VAR_GLOBAL);
diff -r 6cfc23a0c67a -r 736516ac055f usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile  Sat Nov 14 17:39:59 2020 +0000
+++ b/usr.bin/make/unit-tests/Makefile  Sat Nov 14 18:07:26 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.199 2020/11/14 15:35:20 rillig Exp $
+# $NetBSD: Makefile,v 1.200 2020/11/14 18:07:26 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -507,6 +507,8 @@
 # always pretend .MAKE was called 'make'
 _SED_CMDS+=    -e 's,^${TEST_MAKE:T:S,.,\\.,g}[][0-9]*:,make:,'
 _SED_CMDS+=    -e 's,${TEST_MAKE:S,.,\\.,g},make,'
+_SED_CMDS+=    -e 's,${TEST_MAKE:T:S,.,\\.,g}[][0-9]* warning,make warning,'
+_SED_CMDS+=    -e 's,^usage: ${TEST_MAKE:T:S,.,\\.,g} ,usage: make ,'
 # replace anything after 'stopped in' with unit-tests
 _SED_CMDS+=    -e '/stopped/s, /.*, unit-tests,'
 # strip ${.CURDIR}/ from the output



Home | Main Index | Thread Index | Old Index