tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

make -j max_jobs



If you run make with -j8 etc,
"-j" and "8" are placed in .MAKEFLAGS as two separate words.
So to get max_jobs you need something like:

_NJOBS := ${.MAKEFLAGS:C,.*-j *([1-9][0-9]*).*,\1,W}

would it be more useful to set say .MAKE.JOBS or .MAKE.MAX_JOBS to the
actual arg value as in:

Index: main.c
===================================================================
RCS file: /cvsroot/src/usr.bin/make/main.c,v
retrieving revision 1.179
diff -u -p -r1.179 main.c
--- main.c      20 Apr 2010 17:18:08 -0000      1.179
+++ main.c      22 Apr 2010 05:05:01 -0000
@@ -385,6 +385,7 @@ rearg:      
                case 'B':
                        compatMake = TRUE;
                        Var_Append(MAKEFLAGS, "-B", VAR_GLOBAL);
+                       Var_Set(MAKE_MODE, "compat", VAR_GLOBAL, 0);
                        break;
                case 'C':
                        if (chdir(argvalue) == -1) {
@@ -500,6 +501,7 @@ rearg:      
                        }
                        Var_Append(MAKEFLAGS, "-j", VAR_GLOBAL);
                        Var_Append(MAKEFLAGS, argvalue, VAR_GLOBAL);
+                       Var_Set(".MAKE.JOBS", argvalue, VAR_GLOBAL, 0);
                        maxJobTokens = maxJobs;
                        break;
                case 'k':


Home | Main Index | Thread Index | Old Index