osmith submitted this change.
gen_makefile: don't shell out to nproc
Use python's multiprocessing.cpu_count() instead of "$(nproc)". The
latter didn't work properly in Makefiles, the right syntax would have
been "$(shell nproc)". Make didn't complain about it and assumed that we
want to use all CPUs with an empty argument "-j ", but meson doesn't
accept this syntax.
Change-Id: I58ca082339f3aff813f587f4c2be9c0951b9b2dd
---
M gen_makefile.py
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/gen_makefile.py b/gen_makefile.py
index 9a8a5cf..7fc2bd2 100755
--- a/gen_makefile.py
+++ b/gen_makefile.py
@@ -49,6 +49,7 @@
import sys
import os
import argparse
+import multiprocessing
topdir = os.path.dirname(os.path.realpath(__file__))
all_deps_file = os.path.join(topdir, "all.deps")
@@ -85,7 +86,9 @@
parser.add_argument('-o', '--output', dest='output', default='Makefile',
help='''Makefile filename (default: 'Makefile').''')
-parser.add_argument('-j', '--jobs', dest='jobs', default='$(nproc)', nargs='?', const='$(nproc)',
+parser.add_argument('-j', '--jobs', dest='jobs', type=int,
+ default=multiprocessing.cpu_count(), nargs='?',
+ const=multiprocessing.cpu_count(),
help='''-j option to pass to 'make'.''')
parser.add_argument('-I', '--sudo-make-install', dest='sudo_make_install',
To view, visit change 35112. To unsubscribe, or for help writing mail filters, visit settings.