Module Name: src
Committed By: rillig
Date: Sat Nov 14 18:07:26 UTC 2020
Modified Files:
src/usr.bin/make: main.c
src/usr.bin/make/unit-tests: Makefile
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.462 -r1.463 src/usr.bin/make/main.c
cvs rdiff -u -r1.199 -r1.200 src/usr.bin/make/unit-tests/Makefile
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/main.c
diff -u src/usr.bin/make/main.c:1.462 src/usr.bin/make/main.c:1.463
--- src/usr.bin/make/main.c:1.462 Sat Nov 14 17:39:59 2020
+++ src/usr.bin/make/main.c Sat Nov 14 18:07:26 2020
@@ -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 @@ Main_SetObjdir(Boolean writable, const c
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);
Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.199 src/usr.bin/make/unit-tests/Makefile:1.200
--- src/usr.bin/make/unit-tests/Makefile:1.199 Sat Nov 14 15:35:20 2020
+++ src/usr.bin/make/unit-tests/Makefile Sat Nov 14 18:07:26 2020
@@ -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 @@ MAKE_TEST_ENV?= MALLOC_OPTIONS="JA" # fo
# 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