diff --git a/python/mozbuild/mozbuild/base.py b/python/mozbuild/mozbuild/base.py index 66edad6563c..1db94c75eb7 100644 --- a/python/mozbuild/mozbuild/base.py +++ b/python/mozbuild/mozbuild/base.py @@ -421,6 +421,26 @@ class MozbuildObject(ProcessExecutionMixin): if filename: args.extend(['-f', filename]) + if num_jobs == 0 and self.mozconfig['make_flags']: + flags = iter(self.mozconfig['make_flags']) + for flag in flags: + if flag == '-j': + try: + flag = flags.next() + except StopIteration: + break + try: + num_jobs = int(flag) + except ValueError: + args.append(flag) + elif flag.startswith('-j'): + try: + num_jobs = int(flag[2:]) + except (ValueError, IndexError): + break + else: + args.append(flag) + if allow_parallel: if num_jobs > 0: args.append('-j%d' % num_jobs)