aboutsummaryrefslogtreecommitdiff
path: root/contrib/bmake/mk/sys.mk
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/bmake/mk/sys.mk')
-rw-r--r--contrib/bmake/mk/sys.mk43
1 files changed, 31 insertions, 12 deletions
diff --git a/contrib/bmake/mk/sys.mk b/contrib/bmake/mk/sys.mk
index e39d5ac74548..b950d991e321 100644
--- a/contrib/bmake/mk/sys.mk
+++ b/contrib/bmake/mk/sys.mk
@@ -1,6 +1,8 @@
-# $Id: sys.mk,v 1.53 2021/12/13 05:50:13 sjg Exp $
+# SPDX-License-Identifier: BSD-2-Clause
#
-# @(#) Copyright (c) 2003-2009, Simon J. Gerraty
+# $Id: sys.mk,v 1.60 2024/02/17 17:26:57 sjg Exp $
+#
+# @(#) Copyright (c) 2003-2023, Simon J. Gerraty
#
# This file is provided in the hope that it will
# be of use. There is absolutely NO WARRANTY.
@@ -15,6 +17,9 @@
# Avoid putting anything platform specific in here.
+# just in case we are an older bmake
+.MAKE.OS ?= ${HOST_OS}
+
# _DEBUG_MAKE_FLAGS etc.
.include <sys.debug.mk>
@@ -43,13 +48,24 @@ _TARGETS := ${.TARGETS}
# Popular suffixes for C++
CXX_SUFFIXES += .cc .cpp .cxx .C
CXX_SUFFIXES := ${CXX_SUFFIXES:O:u}
+# and C++ Modules
+CCM_SUFFIXES += .ccm
+CCM_SUFFIXES := ${CCM_SUFFIXES:O:u}
+# precompiled modules
+PCM ?= .pcm
+
+SYS_MK ?= ${.PARSEDIR:tA}/${.PARSEFILE}
+SYS_MK := ${SYS_MK}
+
+# for systems that have an incompatible install
+INSTALL_SH ?= ${SYS_MK:H}/install-sh
# find the OS specifics
.if defined(SYS_OS_MK)
.include <${SYS_OS_MK}>
.else
_sys_mk =
-.for x in ${HOST_OSTYPE} ${HOST_TARGET} ${HOST_OS} ${MACHINE} Generic
+.for x in ${HOST_TARGET} ${.MAKE.OS} ${.MAKE.OS:S,64,,} ${HOST_OSTYPE} ${MACHINE} Generic
.if empty(_sys_mk)
.-include <sys/$x.mk>
_sys_mk := ${.MAKE.MAKEFILES:M*/$x.mk}
@@ -62,12 +78,18 @@ _sys_mk := sys/${_sys_mk:T}
.-include <$x.sys.mk>
_sys_mk := ${.MAKE.MAKEFILES:M*/$x.sys.mk:T}
.endif
+.if !empty(_sys_mk) && ${MAKE_VERSION} >= 20220924
+.break
+.endif
.endfor
SYS_OS_MK := ${_sys_mk}
.export SYS_OS_MK
.endif
+# some sys/ may have set this to grep -E
+EGREP ?= egrep
+
# some options we need to know early
OPTIONS_DEFAULT_NO += \
DIRDEPS_BUILD \
@@ -82,6 +104,9 @@ OPTIONS_DEFAULT_DEPENDENT += \
.-include <options.mk>
# :Uno incase options.mk not installed
+.if ${MK_DIRDEPS_BUILD:Uno} == "yes"
+.-include <sys.dirdeps.mk>
+.endif
.if ${MK_META_MODE:Uno} == "yes"
.-include <meta.sys.mk>
.MAKE.MODE ?= meta verbose {META_MODE}
@@ -110,7 +135,7 @@ MACHINE_ARCH = ${MACHINE_ARCH.${MACHINE}}
.endif
.ifndef ROOT_GROUP
-ROOT_GROUP != sed -n /:0:/s/:.*//p /etc/group
+ROOT_GROUP != sed -n '/:0:/{s/:.*//p;q;}' /etc/group
.export ROOT_GROUP
.endif
@@ -134,14 +159,8 @@ Mkdirs= Mkdirs() { \
mkdir $$d || exit $$?; \
done; }
-# this often helps with debugging
-.SUFFIXES: .cpp-out
-
-.c.cpp-out:
- @${COMPILE.c:N-c} -E ${.IMPSRC} | grep -v '^[ ]*$$'
-
-${CXX_SUFFIXES:%=%.cpp-out}:
- @${COMPILE.cc:N-c} -E ${.IMPSRC} | grep -v '^[ ]*$$'
+# pick up generic suffix rules
+.include <suffixes.mk>
# late customizations
.-include <local.sys.mk>