diff options
author | Oliver Smith <osmith@sysmocom.de> | 2023-11-22 11:25:04 +0100 |
---|---|---|
committer | Oliver Smith <osmith@sysmocom.de> | 2023-11-22 11:43:11 +0100 |
commit | 9d83a72e856841871f459411959479824cdcf6ea (patch) | |
tree | 5ab68f21d0c1ce0c232ce01feb625f963ef19deb | |
parent | 8590b898e9788f76d05d6893d43c455d5125d821 (diff) |
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
-rwxr-xr-x | gen_makefile.py | 5 |
1 files changed, 4 insertions, 1 deletions
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 @@ EXAMPLE: 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('-p', '--push-url', dest='push_url', default='', 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', |