Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Aug 1997 14:41:50 +0700 (NSS)
From:      "Nickolay N. Dudorov" <nnd@nnd.itfs.nsk.su>
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   bin/4291: /usr/bin/make - inconsistent -j<n> flag parsing
Message-ID:  <199708130741.OAA07532@nnd.itfs.nsk.su>
Resent-Message-ID: <199708130750.AAA02555@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         4291
>Category:       bin
>Synopsis:       /usr/bin/make - inconsistent -j<n> flag parsing
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Aug 13 00:50:01 PDT 1997
>Last-Modified:
>Originator:     Nickolay N. Dudorov
>Organization:
NTP Infoteka
>Release:        FreeBSD 3.0-CURRENT i386
>Environment:

	Current versions of FreeBSD - at least FreeBSD-3.0
	and FreeBSD-2.2-RELENG

>Description:

	/usr/bin/make can be used in two modes: with "parallel"
jobs (set with -j<n> flag) and in "compat mode" (-B flag).

	Currently "compat mode" is set by default (no -j nor -B
flags given) and if -B flag is given despite of presence/absence
of -j flag.

	BUT "compat mode" is also set without using -B flag
if -j<n> flag follows some "variable definition" on a command
line or in the MAKEFLAGS environment variable.

>How-To-Repeat:

1)
	make -j12 VAR=val all

will work in "parallel mode", whereas

	make VAR=val -j12 all

will set "compat mode".

2)
	setenv MAKEFLAGS "VAR=val -j12"
	make all

will set "compat mode", whereas

	setenv MAKEFLAGS "-j12 VAR=val"
	make all

will work in "parallel mode".

>Fix:
	
	The next patch corrects /usr/bin/make treatment of
-j<n> flag - i.e. make it "position independent".

diff -ru src/usr.bin/make/main.c src/usr.bin/make-patched/main.c
--- src/usr.bin/make/main.c	Fri Jul 25 10:16:42 1997
+++ src/usr.bin/make-patched/main.c	Wed Aug 13 13:23:47 1997
@@ -118,6 +118,7 @@
 static Boolean		printVars;	/* print value of one or more vars */
 static Lst		variables;	/* list of variables to print */
 int			maxJobs;	/* -j argument */
+static Boolean          forceJobs;      /* -j argument given */
 static int		maxLocal;	/* -L argument */
 Boolean			compatMake;	/* -B argument */
 Boolean			debug;		/* -d flag */
@@ -162,7 +163,6 @@
 	extern int optind;
 	extern char *optarg;
 	int c;
-	int forceJobs = 0;
 
 	optind = 1;	/* since we're called more than once */
 #ifdef REMOTE
@@ -315,13 +315,6 @@
 		}
 	}
 
-	/*
-	 * Be compatible if user did not specify -j and did not explicitly
-	 * turned compatibility on
-	 */
-	if (!compatMake && !forceJobs)
-		compatMake = TRUE;
-
 	oldVars = TRUE;
 
 	/*
@@ -559,6 +552,7 @@
 #else
 	maxJobs = maxLocal;
 #endif
+	forceJobs = FALSE;              /* No -j flag */
 	compatMake = FALSE;		/* No compat mode */
 
 
@@ -605,6 +599,13 @@
 #endif
 
 	MainParseArgs(argc, argv);
+
+	/*
+	 * 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

>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199708130741.OAA07532>