wafsamba: Fix 'make -j<jobs>'
authorAndreas Schneider <asn@samba.org>
Thu, 6 Sep 2018 10:40:10 +0000 (12:40 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Fri, 7 Sep 2018 18:24:46 +0000 (20:24 +0200)
Currently only 'make -j' enables parallel builds and e.g. 'make -j4'
results in no parallel compile jobs at all.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13606

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Sep  7 20:24:46 CEST 2018 on sn-devel-144

buildtools/wafsamba/samba_utils.py

index 30e99432d1b3e64fb9b4c43864084e7203dec81b..fd61b8425d8d347e343459e8cdd89ba773f4801b 100644 (file)
@@ -448,6 +448,7 @@ def CHECK_MAKEFLAGS(bld):
     if makeflags is None:
         return
     jobs_set = False
+    jobs = None
     # we need to use shlex.split to cope with the escaping of spaces
     # in makeflags
     for opt in shlex.split(makeflags):
@@ -470,17 +471,21 @@ def CHECK_MAKEFLAGS(bld):
             setattr(Options.options, opt[0:loc], opt[loc+1:])
         elif opt[0] != '-':
             for v in opt:
-                if v == 'j':
+                if re.search(r'j[0-9]*$', v):
                     jobs_set = True
+                    jobs = opt.strip('j')
                 elif v == 'k':
                     Options.options.keep = True
-        elif opt == '-j':
+        elif re.search(r'-j[0-9]*$', opt):
             jobs_set = True
+            jobs = opt.strip('-j')
         elif opt == '-k':
             Options.options.keep = True
     if not jobs_set:
         # default to one job
         Options.options.jobs = 1
+    elif jobs_set and jobs:
+        Options.options.jobs = int(jobs)
 
 Build.BuildContext.CHECK_MAKEFLAGS = CHECK_MAKEFLAGS