Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Nov 2004 13:17:32 +0200
From:      Ruslan Ermilov <ru@freebsd.org>
To:        Harti Brandt <harti@freebsd.org>
Cc:        current@freebsd.org
Subject:   Re: [TEST] make -j patch [take 2]
Message-ID:  <20041112111732.GH41844@ip.net.ua>
In-Reply-To: <20041112111357.T42945@beagle.kn.op.dlr.de>
References:  <95167.1100254152@critter.freebsd.dk> <20041112111357.T42945@beagle.kn.op.dlr.de>

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

--HcXnUX77nabWBLF4
Content-Type: multipart/mixed; boundary="XigHxYirkHk2Kxsx"
Content-Disposition: inline


--XigHxYirkHk2Kxsx
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, Nov 12, 2004 at 11:24:12AM +0100, Harti Brandt wrote:
> It would actually give me _more_ control over make's behaviour. I could,=
=20
> for example, build the tool with -j4, but run the tool with -j2. Suppose=
=20
> that is a long running regression test that I don't want to occupy my=20
> 4 processor machine, but I want the tool for the test to build fast.
>=20
Here's the patch that changes the -j behavior the way I want it:

- if a sub-make is given an explicit -jX argument (either on a
command line or through a special .MAKEFLAGS target in makefile),
it will forget about its current job group membership,

- if -jX is given implicitly through the MAKEFLAGS environment
variable then a sub-make will respect MAKE_JOBS_FIFO and will
join the job group.

Of course, like you say, there's always a possibility to unset
MAKE_JOBS_FIFO before launching a sub-make.


Cheers,
--=20
Ruslan Ermilov
ru@FreeBSD.org
FreeBSD committer

--XigHxYirkHk2Kxsx
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=p
Content-Transfer-Encoding: quoted-printable

Index: main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/usr.bin/make/main.c,v
retrieving revision 1.96
diff -u -p -r1.96 main.c
--- main.c	12 Nov 2004 08:58:07 -0000	1.96
+++ main.c	12 Nov 2004 11:03:56 -0000
@@ -119,7 +119,7 @@ Boolean			checkEnvFirst;	/* -e flag */
 Lst			envFirstVars;	/* (-E) vars to override from env */
 Boolean			jobsRunning;	/* TRUE if the jobs might be running */
=20
-static void		MainParseArgs(int, char **);
+static void		MainParseArgs(int, int, char **);
 char *			chdir_verify_path(char *, char *);
 static int		ReadMakefile(void *, void *);
 static void		usage(void);
@@ -157,7 +157,7 @@ MFLAGS_append(char *flag, char *arg)
  *	given
  */
 static void
-MainParseArgs(int argc, char **argv)
+MainParseArgs(int override, int argc, char **argv)
 {
 	char *p;
 	int c;
@@ -280,6 +280,8 @@ rearg:	while((c =3D getopt(argc, argv, OPT
 				usage();
 			}
 			MFLAGS_append("-j", optarg);
+			if (override)
+				unsetenv("MAKE_JOBS_FIFO");
 			break;
 		}
 		case 'k':
@@ -366,7 +368,7 @@ rearg:	while((c =3D getopt(argc, argv, OPT
  *	Only those that come from the various arguments.
  */
 void
-Main_ParseArgLine(char *line)
+Main_ParseArgLine(int override, char *line)
 {
 	char **argv;			/* Manufactured argument vector */
 	int argc;			/* Number of arguments in argv */
@@ -379,7 +381,7 @@ Main_ParseArgLine(char *line)
 		return;
=20
 	argv =3D brk_string(line, &argc, TRUE);
-	MainParseArgs(argc, argv);
+	MainParseArgs(override, argc, argv);
 }
=20
 char *
@@ -612,12 +614,12 @@ main(int argc, char **argv)
 	 * in a different format).
 	 */
 #ifdef POSIX
-	Main_ParseArgLine(getenv("MAKEFLAGS"));
+	Main_ParseArgLine(0, getenv("MAKEFLAGS"));
 #else
-	Main_ParseArgLine(getenv("MAKE"));
+	Main_ParseArgLine(0, getenv("MAKE"));
 #endif
=20
-	MainParseArgs(argc, argv);
+	MainParseArgs(1, argc, argv);
=20
 	/*
 	 * Find where we are...
Index: nonints.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/usr.bin/make/nonints.h,v
retrieving revision 1.23
diff -u -p -r1.23 nonints.h
--- nonints.h	12 Aug 2004 11:49:55 -0000	1.23
+++ nonints.h	12 Nov 2004 09:43:10 -0000
@@ -63,7 +63,7 @@ int For_Eval(char *);
 void For_Run(int);
=20
 /* main.c */
-void Main_ParseArgLine(char *);
+void Main_ParseArgLine(int, char *);
 char *Cmd_Exec(char *, char **);
 void Debug(const char *, ...);
 void Error(const char *, ...);
Index: parse.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/usr.bin/make/parse.c,v
retrieving revision 1.57
diff -u -p -r1.57 parse.c
--- parse.c	22 Jul 2004 11:12:01 -0000	1.57
+++ parse.c	12 Nov 2004 09:43:23 -0000
@@ -1048,7 +1048,7 @@ ParseDoDependency (char *line)
 	 * set the initial character to a null-character so the loop to
 	 * get sources won't get anything
 	 */
-	Main_ParseArgLine (line);
+	Main_ParseArgLine (1, line);
 	*line =3D '\0';
     } else if (specType =3D=3D ExShell) {
 	if (Job_ParseShell (line) !=3D SUCCESS) {

--XigHxYirkHk2Kxsx--

--HcXnUX77nabWBLF4
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (FreeBSD)

iD8DBQFBlJvMqRfpzJluFF4RAmPHAJ9iSDtMzaSwkppiwP6wiyOpGBlmbACggCll
GXFL2gbOs86p6g/EazL6alA=
=Hba+
-----END PGP SIGNATURE-----

--HcXnUX77nabWBLF4--



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