summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/main.c b/main.c
index 24a1caef4291..ace5c729be51 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.662 2025/08/09 23:13:28 rillig Exp $ */
+/* $NetBSD: main.c,v 1.668 2026/03/13 04:22:03 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.662 2025/08/09 23:13:28 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.668 2026/03/13 04:22:03 sjg Exp $");
#if defined(MAKE_NATIVE)
__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
"The Regents of the University of California. "
@@ -186,8 +186,9 @@ usage(void)
(void)fprintf(stderr,
"usage: %.*s [-BeikNnqrSstWwX]\n"
" [-C directory] [-D variable] [-d flags] [-f makefile]\n"
-" [-I directory] [-J private] [-j max_jobs] [-m directory] [-T file]\n"
-" [-V variable] [-v variable] [variable=value] [target ...]\n",
+" [-I directory] [-J private] [-j max_jobs] [-m directory]\n"
+" [-T file] [-V variable] [-v variable]\n"
+" [variable=value ...] [target ...]\n",
(int)prognameLen, progname);
exit(2);
}
@@ -464,8 +465,6 @@ static bool
MainParseOption(char c, const char *argvalue)
{
switch (c) {
- case '\0':
- break;
case 'B':
opts.compatMake = true;
Global_Append(MAKEFLAGS, "-B");
@@ -1224,7 +1223,6 @@ InitMaxJobs(void)
"Invalid internal option \"-J\" in \"%s\"; "
"see the manual page",
curdir);
- PrintStackTrace(true);
return;
}
if (forceJobs || opts.compatMake ||
@@ -1316,6 +1314,10 @@ ReadFirstDefaultMakefile(void)
free(prefs);
}
+#ifndef MAKE_SAVE_DOLLARS_DEFAULT
+# define MAKE_SAVE_DOLLARS_DEFAULT "yes"
+#endif
+
/*
* Initialize variables such as MAKE, MACHINE, .MAKEFLAGS.
* Initialize a few modules.
@@ -1367,6 +1369,8 @@ main_Init(int argc, char **argv)
Global_Set("MACHINE", machine);
Global_Set("MACHINE_ARCH", machine_arch);
#ifdef MAKE_VERSION
+ Global_Set_ReadOnly(".MAKE.VERSION", MAKE_VERSION);
+ /* for backwards compatibility */
Global_Set("MAKE_VERSION", MAKE_VERSION);
#endif
Global_Set_ReadOnly(".newline", "\n");
@@ -1382,6 +1386,7 @@ main_Init(int argc, char **argv)
#else
Global_Set_ReadOnly(".MAKE.JOBS.C", "no");
#endif
+ Global_Set(MAKE_SAVE_DOLLARS, MAKE_SAVE_DOLLARS_DEFAULT);
CmdOpts_Init();
allPrecious = false; /* Remove targets when interrupted */
@@ -1909,7 +1914,7 @@ Fatal(const char *fmt, ...)
va_end(ap);
(void)fprintf(stderr, "\n");
(void)fflush(stderr);
- PrintStackTrace(true);
+ PrintStackTrace(stderr, true);
PrintOnError(NULL, "\n");