configs.py: Allow to override --jobs param for build system

Different CI jobs have different needs for parallelization. While normally
we build multiple configs in parallel (and so need to limit --jobs value),
for ECLAIR MISRA testing we may need to build configs sequentially, but
then parallelize each build using higher --jobs.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Change-Id: I0fb6eb21692e7fd00bb20ff992a2a63ca8f12044
diff --git a/configs.py b/configs.py
index ee370af..61fc4b2 100755
--- a/configs.py
+++ b/configs.py
@@ -50,10 +50,10 @@
     build_manager.print_config_environment(config, silence_stderr=silence_stderr)
 
 
-def print_build_commands(config, group=None):
+def print_build_commands(config, group=None, jobs=None):
     """Prints particular configuration environment variables"""
     build_manager = get_build_manager(group)
-    build_manager.print_build_commands(config, silence_stderr=True)
+    build_manager.print_build_commands(config, silence_stderr=True, jobs=jobs)
 
 
 if __name__ == "__main__":
@@ -84,6 +84,11 @@
         "Leaving blank will just look at config 'all'.",
         choices=list(_builtin_configs.keys())+['all'],
     )
+    PARSER.add_argument(
+        "-j",
+        "--jobs",
+        help="Pass -j option down to the build system (# of parallel jobs)."
+    )
     ARGS = PARSER.parse_args()
     if not ARGS.group or ARGS.group == ['all']:
         ARGS.group = list(_builtin_configs.keys())
@@ -98,7 +103,7 @@
                 if not ARGS.build_commands:
                     print_config_environment(ARGS.config, group=group, silence_stderr=True)
                 else:
-                    print_build_commands(ARGS.config, group=group)
+                    print_build_commands(ARGS.config, group=group, jobs=ARGS.jobs)
                 break
             except (SystemExit, KeyError):
                 if group == ARGS.group[-1] or ARGS.group == []: