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
This commit is contained in:
lukem 2023-05-19 10:42:34 +00:00
parent 895746d7ed
commit cf4db277d4
3 changed files with 6 additions and 6 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.6 2023/02/20 02:12:35 mrg Exp $
# $NetBSD: Makefile,v 1.7 2023/05/19 10:42:34 lukem Exp $
BUILD_ENV= \
AR=${HOST_AR:Q} \
@ -19,7 +19,7 @@ BUILD_ENV= \
RANLIB=${HOST_RANLIB:Q} \
YACC=${YACC:Q}
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} ${TOOL_GMAKE} ${GMAKE_J_ARGS} -e
libcpp/libcpp.a:

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.5 2020/06/24 05:06:08 rin Exp $
# $NetBSD: Makefile,v 1.6 2023/05/19 10:42:34 lukem Exp $
BUILD_ENV= \
AR=${HOST_AR:Q} \
@ -19,7 +19,7 @@ BUILD_ENV= \
RANLIB=${HOST_RANLIB:Q} \
YACC=${YACC:Q}
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} ${TOOL_GMAKE} ${GMAKE_J_ARGS} -e
libcpp/libcpp.a:

View File

@ -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