git: 883a1b00fd13 - main - Makefile: Deorbit fmake support

From: Warner Losh <imp_at_FreeBSD.org>
Date: Wed, 03 Jan 2024 19:16:00 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=883a1b00fd13dbc0e63ae49cdf73f88ee389d52a

commit 883a1b00fd13dbc0e63ae49cdf73f88ee389d52a
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2024-01-02 16:17:21 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-01-03 19:13:26 +0000

    Makefile: Deorbit fmake support
    
    fmake has been out of the tree for 10 years / 5 major releases now. The
    need to bootstrap from it has been gone for at least 6 if not 8
    years. While we may still need to bootstrap bmake, we don't need to do
    it from fmake, so only retail the infrastructure to update from bmake to
    bmake. Retain, for now, the WANT_MAKE_VERSION stuff, though we're always
    up to date when building from supported and quasi-supported platforms.
    
    Also remove all the checks to see if .PARSEDIR is defined. It is always
    defined and was an early, fail-safe way to tell fmake from bmake during
    the transition.
    
    Adjust comments that refer to old fmake and remove those no longer
    relevant.
    
    Sponsored by:           Netflix
    Reviewed by: brooks
    Pull Request: https://github.com/freebsd/freebsd-src/pull/980
---
 Makefile | 33 +++++++--------------------------
 1 file changed, 7 insertions(+), 26 deletions(-)

diff --git a/Makefile b/Makefile
index 4a6f4bfd425e..2c4f7aaebca0 100644
--- a/Makefile
+++ b/Makefile
@@ -137,15 +137,11 @@ __DO_WORLDS=no
 __DO_WORLDS?=yes
 __DO_KERNELS?=yes
 
-# This is included so CC is set to ccache for -V, and COMPILER_TYPE/VERSION
-# can be cached for sub-makes. We can't do this while still running on the
-# old fmake from FreeBSD 9.x or older, so avoid including it then to avoid
-# heartburn upgrading from older systems. The need for CC is done with new
-# make later in the build, and caching COMPILER_TYPE/VERSION is only an
-# optimization. Also sinclude it to be friendlier to foreign OS hosted builds.
-.if ${MAKE_VERSION} >= 20140620 && defined(.PARSEDIR)
+# This is included so CC is set to ccache for -V, and COMPILER_TYPE/VERSION can
+# be cached for sub-makes. The need for CC is done with new make later in the
+# build, and caching COMPILER_TYPE/VERSION is only an optimization. Also
+# sinclude it to be friendlier to foreign OS hosted builds.
 .sinclude <bsd.compiler.mk>
-.endif
 
 # Note: we use this awkward construct to be compatible with FreeBSD's
 # old make used in 10.0 and 9.2 and earlier.
@@ -252,10 +248,6 @@ _MAKEOBJDIRPREFIX!= /usr/bin/env -i PATH=${PATH:Q} ${MAKE} MK_AUTO_OBJ=no \
 .endif
 
 # We often need to use the tree's version of make to build it.
-# Choices add to complexity though.
-# We cannot blindly use a make which may not be the one we want
-# so be explicit - until all choice is removed.
-WANT_MAKE=	bmake
 .if !empty(.MAKE.MODE:Mmeta)
 # 20160604 - support missing-meta,missing-filemon and performance improvements
 WANT_MAKE_VERSION= 20160604
@@ -263,14 +255,8 @@ WANT_MAKE_VERSION= 20160604
 # 20160220 - support .dinclude for FAST_DEPEND.
 WANT_MAKE_VERSION= 20160220
 .endif
-MYMAKE=		${OBJROOT}make.${MACHINE}/${WANT_MAKE}
-.if defined(.PARSEDIR)
-HAVE_MAKE=	bmake
-.else
-HAVE_MAKE=	fmake
-.endif
+MYMAKE=		${OBJROOT}make.${MACHINE}/bmake
 .if defined(ALWAYS_BOOTSTRAP_MAKE) || \
-    ${HAVE_MAKE} != ${WANT_MAKE} || \
     (defined(WANT_MAKE_VERSION) && ${MAKE_VERSION} < ${WANT_MAKE_VERSION})
 NEED_MAKE_UPGRADE= t
 .endif
@@ -278,7 +264,6 @@ NEED_MAKE_UPGRADE= t
 SUB_MAKE:= ${MYMAKE} -m ${.CURDIR}/share/mk
 .elif defined(NEED_MAKE_UPGRADE)
 # It may not exist yet but we may cause it to.
-# In the case of fmake, upgrade_checks may cause a newer version to be built.
 SUB_MAKE= `test -x ${MYMAKE} && echo ${MYMAKE} || echo ${MAKE}` \
 	-m ${.CURDIR}/share/mk
 .else
@@ -301,9 +286,7 @@ _CAN_USE_META_MODE?= yes
 .if !defined(_CAN_USE_META_MODE)
 _MAKE+=	MK_META_MODE=no
 MK_META_MODE= no
-.if defined(.PARSEDIR)
 .unexport META_MODE
-.endif
 .endif	# !defined(_CAN_USE_META_MODE)
 .endif	# empty(.MAKEOVERRIDES:MMK_META_MODE)
 
@@ -378,7 +361,7 @@ _assert_target: .PHONY .MAKE
 # The user can define ALWAYS_CHECK_MAKE to have this check performed
 # for all targets.
 #
-.if defined(ALWAYS_CHECK_MAKE) || !defined(.PARSEDIR)
+.if defined(ALWAYS_CHECK_MAKE)
 ${TGTS}: upgrade_checks
 .else
 buildworld: upgrade_checks
@@ -470,7 +453,7 @@ kernel: buildkernel installkernel .PHONY
 #
 upgrade_checks: .PHONY
 .if defined(NEED_MAKE_UPGRADE)
-	@${_+_}(cd ${.CURDIR} && ${MAKE} ${WANT_MAKE:S,^f,,})
+	@${_+_}(cd ${.CURDIR} && ${MAKE} bmake)
 .endif
 
 #
@@ -802,7 +785,6 @@ universe_epilogue: .PHONY
 .endif
 .endif
 
-.if defined(.PARSEDIR)
 # This makefile does not run in meta mode
 .MAKE.MODE= normal
 # Normally the things we run from here don't either.
@@ -822,6 +804,5 @@ UPDATE_DEPENDFILE= NO
 MAKE_JOB_ERROR_TOKEN= no
 .export MAKE_JOB_ERROR_TOKEN
 .endif
-.endif # bmake
 
 .endif				# DIRDEPS_BUILD