Module Name: src
Committed By: rillig
Date: Tue Oct 27 07:13:03 UTC 2020
Modified Files:
src/usr.bin/make: main.c
Log Message:
make(1): extract CmdOpts_Init from main
To generate a diff of this commit:
cvs rdiff -u -r1.394 -r1.395 src/usr.bin/make/main.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/main.c
diff -u src/usr.bin/make/main.c:1.394 src/usr.bin/make/main.c:1.395
--- src/usr.bin/make/main.c:1.394 Tue Oct 27 07:03:55 2020
+++ src/usr.bin/make/main.c Tue Oct 27 07:13:02 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.394 2020/10/27 07:03:55 rillig Exp $ */
+/* $NetBSD: main.c,v 1.395 2020/10/27 07:13:02 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -118,7 +118,7 @@
#include "trace.h"
/* "@(#)main.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: main.c,v 1.394 2020/10/27 07:03:55 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.395 2020/10/27 07:13:02 rillig Exp $");
#if defined(MAKE_NATIVE) && !defined(lint)
__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
"The Regents of the University of California. "
@@ -1060,6 +1060,32 @@ UnlimitFiles(void)
#endif
}
+static void
+CmdOpts_Init(void)
+{
+ opts.compatMake = FALSE; /* No compat mode */
+ opts.debug = 0; /* No debug verbosity, please. */
+ /* opts.debug_file has been initialized earlier */
+ opts.debugVflag = FALSE;
+ /* TODO: checkEnvFirst = FALSE; */
+ opts.makefiles = Lst_New();
+ opts.ignoreErrors = FALSE; /* Pay attention to non-zero returns */
+ opts.maxJobs = DEFMAXLOCAL; /* Set default local max concurrency */
+ opts.keepgoing = FALSE; /* Stop on error */
+ opts.noRecursiveExecute = FALSE; /* Execute all .MAKE targets */
+ opts.noExecute = FALSE; /* Execute all commands */
+ opts.queryFlag = FALSE; /* This is not just a check-run */
+ opts.noBuiltins = FALSE; /* Read the built-in rules */
+ opts.beSilent = FALSE; /* Print commands as executed */
+ opts.touchFlag = FALSE; /* Actually update targets */
+ opts.printVars = 0;
+ opts.variables = Lst_New();
+ /* TODO: parseWarnFatal = FALSE; */
+ /* TODO: enterFlag = FALSE; */
+ /* TODO: varNoExportEnv = FALSE; */
+ opts.create = Lst_New();
+}
+
/*-
* main --
* The main function, for obvious reasons. Initializes variables
@@ -1155,27 +1181,12 @@ main(int argc, char **argv)
VAR_GLOBAL);
Var_Set(MAKE_DEPENDFILE, ".depend", VAR_GLOBAL);
- opts.create = Lst_New();
- opts.makefiles = Lst_New();
- opts.printVars = 0;
- opts.debugVflag = FALSE;
- opts.variables = Lst_New();
- opts.beSilent = FALSE; /* Print commands as executed */
- opts.ignoreErrors = FALSE; /* Pay attention to non-zero returns */
- opts.noExecute = FALSE; /* Execute all commands */
- opts.noRecursiveExecute = FALSE; /* Execute all .MAKE targets */
- opts.keepgoing = FALSE; /* Stop on error */
+ CmdOpts_Init();
allPrecious = FALSE; /* Remove targets when interrupted */
deleteOnError = FALSE; /* Historical default behavior */
- opts.queryFlag = FALSE; /* This is not just a check-run */
- opts.noBuiltins = FALSE; /* Read the built-in rules */
- opts.touchFlag = FALSE; /* Actually update targets */
- opts.debug = 0; /* No debug verbosity, please. */
jobsRunning = FALSE;
- opts.maxJobs = DEFMAXLOCAL; /* Set default local max concurrency */
maxJobTokens = opts.maxJobs;
- opts.compatMake = FALSE; /* No compat mode */
ignorePWD = FALSE;
/*