Subject: make: cannot turn off -jN
To: None <tech-toolchain@netbsd.org>
From: Simon J. Gerraty <sjg@crufty.net>
List: tech-toolchain
Date: 02/24/2003 02:16:04
I want to be able to use -jN at a top level makefile to get some
parallelism in a build... but I want each of the branches being built
in parallel to build in compat mode - so I don't have to fix 100's of
makefiles before I can get any benefit.

Trouble is, -jN gets propagated to sub-makes via MAKEFLAGS and there
is no way to turn it off.  -B ensures compat mode is not - but unlike
-j it does _not_ get propagated to submakes.

The following patch allows -B to propagate along with -jN.  
This means that running sub-makes of my parallel target with
"${.MAKE} -j1 -B" does what I need.

An alternative might be to allow -j0 to effectively cancel -jN.  I'd
rather leave -j1 as is since it is handy for debugging -jN problems
but FWIW -j1 seems to have much the same effect on gmake -B on netbsd
make.

Thoughts?
--sjg

Index: main.c
===================================================================
RCS file: /cvsroot/src/usr.bin/make/main.c,v
retrieving revision 1.85
diff -u -p -r1.85 main.c
--- main.c	2002/06/15 18:24:57	1.85
+++ main.c	2003/02/24 10:11:32
@@ -226,6 +226,7 @@ rearg:	while((c = getopt(argc, argv, OPT
 			break;
 		case 'B':
 			compatMake = TRUE;
+			Var_Append(MAKEFLAGS, "-B", VAR_GLOBAL);
 			break;
 #ifdef REMOTE
 		case 'L':