From owner-freebsd-bugs Wed Aug 13 00:50:03 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id AAA02562 for bugs-outgoing; Wed, 13 Aug 1997 00:50:03 -0700 (PDT) Received: (from gnats@localhost) by hub.freebsd.org (8.8.5/8.8.5) id AAA02555; Wed, 13 Aug 1997 00:50:01 -0700 (PDT) Resent-Date: Wed, 13 Aug 1997 00:50:01 -0700 (PDT) Resent-Message-Id: <199708130750.AAA02555@hub.freebsd.org> Resent-From: gnats (GNATS Management) Resent-To: freebsd-bugs Resent-Reply-To: FreeBSD-gnats@FreeBSD.ORG, nnd@nnd.itfs.nsk.su Received: from nnd.itfs.nsk.su (nnd.itfs.nsk.su [193.124.36.42]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id AAA02208 for ; Wed, 13 Aug 1997 00:41:33 -0700 (PDT) Received: (from root@localhost) by nnd.itfs.nsk.su (8.8.7/8.8.5) id OAA07532; Wed, 13 Aug 1997 14:41:50 +0700 (NSS) Message-Id: <199708130741.OAA07532@nnd.itfs.nsk.su> Date: Wed, 13 Aug 1997 14:41:50 +0700 (NSS) From: "Nickolay N. Dudorov" Reply-To: nnd@nnd.itfs.nsk.su To: FreeBSD-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: 3.2 Subject: bin/4291: /usr/bin/make - inconsistent -j flag parsing Sender: owner-freebsd-bugs@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >Number: 4291 >Category: bin >Synopsis: /usr/bin/make - inconsistent -j 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 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 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 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: