Module Name: src Committed By: sjg Date: Tue May 28 19:09:04 UTC 2024
Modified Files: src/usr.bin/make: main.c make.1 Log Message: make: allow debugging the warning about .OBJDIR When make complains about an unwritable .OBJDIR it is not always obvious how we derrived that value. If MAKE_DEBUG_OBJDIR_CHECK_WRITABLE is enabled call PrintOnError so we can examine variables that are likely relevant. Fix description of MAKE_OBJDIR_CHECK_WRITABLE in make.1 To generate a diff of this commit: cvs rdiff -u -r1.617 -r1.618 src/usr.bin/make/main.c cvs rdiff -u -r1.375 -r1.376 src/usr.bin/make/make.1 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.617 src/usr.bin/make/main.c:1.618 --- src/usr.bin/make/main.c:1.617 Fri May 24 23:02:46 2024 +++ src/usr.bin/make/main.c Tue May 28 19:09:04 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.617 2024/05/24 23:02:46 rillig Exp $ */ +/* $NetBSD: main.c,v 1.618 2024/05/28 19:09:04 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -111,7 +111,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.617 2024/05/24 23:02:46 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.618 2024/05/28 19:09:04 sjg Exp $"); #if defined(MAKE_NATIVE) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -739,6 +739,10 @@ Main_SetObjdir(bool writable, const char if ((writable && access(path, W_OK) != 0) || chdir(path) != 0) { (void)fprintf(stderr, "%s: warning: %s: %s.\n", progname, path, strerror(errno)); + /* Allow debugging how we got here - not always obvious */ + if (GetBooleanExpr("${MAKE_DEBUG_OBJDIR_CHECK_WRITABLE}", + false)) + PrintOnError(NULL, ""); return false; } Index: src/usr.bin/make/make.1 diff -u src/usr.bin/make/make.1:1.375 src/usr.bin/make/make.1:1.376 --- src/usr.bin/make/make.1:1.375 Sun Mar 10 02:53:37 2024 +++ src/usr.bin/make/make.1 Tue May 28 19:09:04 2024 @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.375 2024/03/10 02:53:37 sjg Exp $ +.\" $NetBSD: make.1,v 1.376 2024/05/28 19:09:04 sjg Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" from: @(#)make.1 8.4 (Berkeley) 3/19/94 .\" -.Dd March 9, 2024 +.Dd May 28, 2024 .Dt MAKE 1 .Os .Sh NAME @@ -1143,9 +1143,19 @@ This mode can be used to detect undeclar Used to create files in a separate directory, see .Va .OBJDIR . .It Va MAKE_OBJDIR_CHECK_WRITABLE -Used to force a separate directory for the created files, -even if that directory is not writable, see -.Va .OBJDIR . +When true, +.Nm +will check that +.Va .OBJDIR +is writable, and issue a warning if not. +.It Va MAKE_DEBUG_OBJDIR_CHECK_WRITABLE +When true and +.Nm +is warning about an unwritable +.Va .OBJDIR , +report the variables listed in +.Va MAKE_PRINT_VAR_ON_ERROR +to help debug. .It Va MAKEOBJDIRPREFIX Used to create files in a separate directory, see .Va .OBJDIR .