summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorlukem <lukem@NetBSD.org>2023-05-19 10:42:34 +0000
committerlukem <lukem@NetBSD.org>2023-05-19 10:42:34 +0000
commit84e88788d07c665478b20b5c0df3b08272bf46d8 (patch)
tree484a2111a701f3de7f1e06c6433cc24fb05f622f /tools
parentb5935544d31f720c99205504f144e2694646cd31 (diff)
Fix passing -j NNN to gmake
Use a more restrictive pattern to extract -j NNN from MAKEFLAGS into GMAKE_J_ARGS, to avoid false positives when the source directory has "-j" in the path (e.g "amd64-job-000012" or "src-j9999"). Previously this could pass either -"-j" or "-j BIGNUM" to gmake and result in "vfork: Resource temporarily unavailable" failures. PR misc/54456
Diffstat (limited to 'tools')
-rw-r--r--tools/Makefile.gnuhost4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/Makefile.gnuhost b/tools/Makefile.gnuhost
index 62f34635fd6..15b92025dc3 100644
--- a/tools/Makefile.gnuhost
+++ b/tools/Makefile.gnuhost
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.gnuhost,v 1.55 2023/05/15 21:24:56 lukem Exp $
+# $NetBSD: Makefile.gnuhost,v 1.56 2023/05/19 10:42:34 lukem Exp $
#
# Rules used when building a GNU host package. Expects MODULE to be set.
#
@@ -100,7 +100,7 @@ BUILD_COMMAND= ${BUILD_ENV} ${MAKE} ${MAKE_ARGS}
# gmake version of this puts MAKE_ARGS in the environment to be sure that
# sub-gmake's get them, otherwise tools/gcc tries to build libgcc and
# fails. it also uses "env -i" to entirely clear out MAKEFLAGS.
-GMAKE_J_ARGS?= ${MAKEFLAGS:[*]:M*-j*:C/.*(-j ?[0-9]*).*/\1/W}
+GMAKE_J_ARGS?= ${MAKEFLAGS:[*]:M*-j*:C/(^|.* )(-j ?[0-9][0-9]*).*/\2/W}
BUILD_COMMAND= /usr/bin/env -i ${BUILD_ENV} ${MAKE_ARGS:N-*} ${TOOL_GMAKE} ${GMAKE_J_ARGS} -e ${MAKE_ARGS}
.endif