Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make honor setting .MAKE.JOBS from the makefile. Tha...
details: https://anonhg.NetBSD.org/src/rev/e2ce1a68dc1f
branches: trunk
changeset: 344180:e2ce1a68dc1f
user: matthias <matthias%NetBSD.org@localhost>
date: Wed Mar 16 16:04:44 2016 +0000
description:
honor setting .MAKE.JOBS from the makefile. That way one can e.g. do:
CPUS!=sysctl -n hw.ncpuonline
.MAKE.JOBS?=$(CPUS)
diffstat:
usr.bin/make/main.c | 43 ++++++++++++++++++++++++++++++++-----------
1 files changed, 32 insertions(+), 11 deletions(-)
diffs (78 lines):
diff -r 98203cbf9f44 -r e2ce1a68dc1f usr.bin/make/main.c
--- a/usr.bin/make/main.c Wed Mar 16 15:51:15 2016 +0000
+++ b/usr.bin/make/main.c Wed Mar 16 16:04:44 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.242 2016/03/07 21:45:43 christos Exp $ */
+/* $NetBSD: main.c,v 1.243 2016/03/16 16:04:44 matthias Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.242 2016/03/07 21:45:43 christos Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.243 2016/03/16 16:04:44 matthias Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
@@ -81,7 +81,7 @@
#if 0
static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94";
#else
-__RCSID("$NetBSD: main.c,v 1.242 2016/03/07 21:45:43 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.243 2016/03/16 16:04:44 matthias Exp $");
#endif
#endif /* not lint */
#endif
@@ -1117,14 +1117,6 @@
}
/*
- * Be compatible if user did not specify -j and did not explicitly
- * turned compatibility on
- */
- if (!compatMake && !forceJobs) {
- compatMake = TRUE;
- }
-
- /*
* Initialize archive, target and suffix modules in preparation for
* parsing the makefile(s)
*/
@@ -1240,6 +1232,35 @@
Var_Append("MFLAGS", Var_Value(MAKEFLAGS, VAR_GLOBAL, &p1), VAR_GLOBAL);
free(p1);
+ if (Var_Exists(".MAKE.JOBS", VAR_GLOBAL)) {
+ char *value;
+ int n;
+
+ value = Var_Subst(NULL, "${.MAKE.JOBS}", VAR_GLOBAL, VARF_WANTRES);
+ n = strtol(value, NULL, 0);
+ if (n < 1) {
+ (void)fprintf(stderr, "%s: illegal value for .MAKE.JOBS -- must be positive integer!\n",
+ progname);
+ exit(1);
+ }
+ if (n != maxJobs) {
+ Var_Append(MAKEFLAGS, "-j", VAR_GLOBAL);
+ Var_Append(MAKEFLAGS, value, VAR_GLOBAL);
+ }
+ maxJobs = n;
+ maxJobTokens = maxJobs;
+ forceJobs = TRUE;
+ free(value);
+ }
+
+ /*
+ * Be compatible if user did not specify -j and did not explicitly
+ * turned compatibility on
+ */
+ if (!compatMake && !forceJobs) {
+ compatMake = TRUE;
+ }
+
if (!compatMake)
Job_ServerStart(maxJobTokens, jp_0, jp_1);
if (DEBUG(JOB))
Home |
Main Index |
Thread Index |
Old Index