+rRR51Hn4CODdKH1mZ7NkAMh6Wrh6Q185u4XMrMZQtHu2nnaSKNiQ4fa5nLWZZK1P 1Ps9ljmeq2QK12e8d9vzcLoZdE72LTx2LMLUZMoLJ6DI3nPs96pDoGFvMFIvzvE4bPT25l qpWljGQvRxZNRl0t46K5/JsryQFhbT6AFNovLLD4ND4FUqIRY6zJtIM98xsfdA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1738178269; a=rsa-sha256; cv=none; b=eZcztzqO/cYMj011W8+Dz8nOo3LhK/XL8PP8jwxI9rV7oWVB1XqoYmgFvEmpRogc34yTYt /DWyk4BmMeavB5aLd1VwcgHLyGtfMUP/WYbE2KrX+mS0rnEYhV6y+cIPWiEF3samn8PeIs tHPXgmZUXfc+txc5sm2YCj1Q3tO0AkBGmeqRpGnezrkl8kzpOe3m4pzl3/sZUqY1ZA4Lvn eqLyuSoVO2kgZwU6lyPAC120zlOckFzd+wdgPXchTEs2EcUJUx7SZaBb4IG6EBylOv5vrZ +tkI0rELMSOww8FgWq5993CMIwCG/tjB1yeMc0AbEkl7ixws1AtK3zo4VpDFqQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4YjsP93mv9z1CcC; Wed, 29 Jan 2025 19:17:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50TJHn2U004111; Wed, 29 Jan 2025 19:17:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50TJHnr3004108; Wed, 29 Jan 2025 19:17:49 GMT (envelope-from git) Date: Wed, 29 Jan 2025 19:17:49 GMT Message-Id: <202501291917.50TJHnr3004108@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 697fd8476ea7 - main - Makefile: Fix several issues with bmake upgrade List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 697fd8476ea7025e3c79d57669d04ff3274a6e38 Auto-Submitted: auto-generated The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=697fd8476ea7025e3c79d57669d04ff3274a6e38 commit 697fd8476ea7025e3c79d57669d04ff3274a6e38 Author: Jessica Clarke AuthorDate: 2025-01-29 19:17:09 +0000 Commit: Jessica Clarke CommitDate: 2025-01-29 19:17:09 +0000 Makefile: Fix several issues with bmake upgrade Firstly, if NEED_MAKE_UPGRADE isn't set, we shouldn't use whatever bootstrapped bmake happens to be lying around. We're not going to re-run the bmake target, so won't make sure it's up-to-date, and thus it could be some ancient unsupported version. We can still, however, optimise setting SUB_MAKE when the file exists, so long as it's guarded by NEED_MAKE_UPGRADE. Secondly, make kernel-toolchain should also bootstrap bmake if needed, since it's supposed to be the subset of buildworld needed for building a kernel. Finally, if there is a stale bootstrapped bmake lying around that isn't needed, delete it, since it will only cause confusion, and as far as I can tell nothing else will clean it up, not even cleandir twice. So as to ensure nobody's doing anything crazy with MYMAKE that would cause us to delete something unexpected, or that would change behaviour by no longer checking exists(${MYMAKE}) and using that regardless of version checks, emit an error if the definition in use is not our own. Reviewed by: emaste, sjg, imp Differential Revision: https://reviews.freebsd.org/D48708 --- Makefile | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 1970cc736829..b094a7ff8149 100644 --- a/Makefile +++ b/Makefile @@ -258,17 +258,22 @@ WANT_MAKE_VERSION= 20160604 # 20160220 - support .dinclude for FAST_DEPEND. WANT_MAKE_VERSION= 20160220 .endif +.if defined(MYMAKE) +.error MYMAKE cannot be overridden, use as command name instead +.endif MYMAKE= ${OBJROOT}make.${MACHINE}/bmake .if defined(ALWAYS_BOOTSTRAP_MAKE) || \ (defined(WANT_MAKE_VERSION) && ${MAKE_VERSION} < ${WANT_MAKE_VERSION}) NEED_MAKE_UPGRADE= t .endif -.if exists(${MYMAKE}) +.if defined(NEED_MAKE_UPGRADE) +. if exists(${MYMAKE}) SUB_MAKE:= ${MYMAKE} -m ${.CURDIR}/share/mk -.elif defined(NEED_MAKE_UPGRADE) +. else # It may not exist yet but we may cause it to. SUB_MAKE= `test -x ${MYMAKE} && echo ${MYMAKE} || echo ${MAKE}` \ -m ${.CURDIR}/share/mk +. endif .else SUB_MAKE= ${MAKE} -m ${.CURDIR}/share/mk .endif @@ -359,15 +364,16 @@ _assert_target: .PHONY .MAKE .endfor # -# Make sure we have an up-to-date make(1). Only world and buildworld -# should do this as those are the initial targets used for upgrades. -# The user can define ALWAYS_CHECK_MAKE to have this check performed -# for all targets. +# Make sure we have an up-to-date make(1). Only world, buildworld and +# kernel-toolchain should do this as those are the initial targets used +# for upgrades. The user can define ALWAYS_CHECK_MAKE to have this check +# performed for all targets. # .if defined(ALWAYS_CHECK_MAKE) ${TGTS}: upgrade_checks .else buildworld: upgrade_checks +kernel-toolchain: upgrade_checks .endif # @@ -457,6 +463,9 @@ kernel: buildkernel installkernel .PHONY upgrade_checks: .PHONY .if defined(NEED_MAKE_UPGRADE) @${_+_}(cd ${.CURDIR} && ${MAKE} bmake) +.elif exists(${MYMAKE:H}) + @echo "Removing stale bmake(1)" + rm -r ${MYMAKE:H} .endif #