1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-04 09:09:56 +00:00
freebsd/share/mk/src.sys.env.mk
Simon J. Gerraty 073ccb9d55 Allow site.*.mk to augment local.*.mk and src.*.mk
Add some extra customization points so that FreeBSD build
can be adapted to local requirements.
We use these to minimize changes to share/mk

Reviewed by:	stevek
Sponsored by:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D37617
2022-12-07 11:30:35 -08:00

97 lines
2.8 KiB
Makefile

# $FreeBSD$
# early setup only see also src.sys.mk
# bmake-20170301 started taking '-C' "as is" for some cases, notably absolute
# paths. Some later comparisons will assume .CURDIR is resolved and matches
# what we would get with 'cd'. So just force resolve it now if it is an
# absolute path.
.if ${MAKE_VERSION} >= 20170301 && !empty(.CURDIR:M/*)
.CURDIR:= ${.CURDIR:tA}
.endif
# make sure this is defined in a consistent manner
SRCTOP:= ${.PARSEDIR:tA:H:H}
.if ${.CURDIR} == ${SRCTOP}
RELDIR= .
RELTOP= .
.elif ${.CURDIR:M${SRCTOP}/*}
RELDIR:= ${.CURDIR:S,${SRCTOP}/,,}
.endif
RELTOP?= ${RELDIR:C,[^/]+,..,g}
RELOBJTOP?= ${RELTOP}
RELSRCTOP?= ${RELTOP}
.if !defined(OS_REVISION)
OS_REVISION!=eval `sh ${SRCTOP}/sys/conf/newvers.sh -V REVISION` && echo $$REVISION || echo
.export OS_REVISION
.endif
# site customizations that do not depend on anything!
# Save MAKEOBJDIRPREFIX and don't let src-env.conf modify it.
# MAKEOBJDIRPREFIX is only needed in MAKELEVEL=0. In sub-makes it will
# either be read from environment or OBJDIR/MAKEOBJDIR according to
# src.sys.obj.mk.
.if !(${.MAKE.LEVEL} == 0 || empty(OBJROOT))
.if defined(MAKEOBJDIRPREFIX)
_saveMAKEOBJDIRPREFIX:= ${MAKEOBJDIRPREFIX}
.else
_undefMAKEOBJDIRPREFIX= t
.endif
.endif
.-include <site.src.sys.env.mk>
SRC_ENV_CONF?= /etc/src-env.conf
.if !empty(SRC_ENV_CONF) && !target(_src_env_conf_included_)
.-include "${SRC_ENV_CONF}"
_src_env_conf_included_: .NOTMAIN
.endif
.if defined(_saveMAKEOBJDIRPREFIX) || defined(_undefMAKEOBJDIRPREFIX)
.if defined(MAKEOBJDIRPREFIX) && ((defined(_saveMAKEOBJDIRPREFIX) && \
${_saveMAKEOBJDIRPREFIX} != ${MAKEOBJDIRPREFIX}) || \
defined(_undefMAKEOBJDIRPREFIX))
.warning ${SRC_ENV_CONF}: Ignoring MAKEOBJDIRPREFIX entry in sub-make. Use '?=' to avoid this warning.
.endif
.if defined(_saveMAKEOBJDIRPREFIX)
MAKEOBJDIRPREFIX:= ${_saveMAKEOBJDIRPREFIX}
.undef _saveMAKEOBJDIRPREFIX
.elif defined(_undefMAKEOBJDIRPREFIX)
.undef MAKEOBJDIRPREFIX
.undef _undefMAKEOBJDIRPREFIX
.endif
.endif
.include <bsd.mkopt.mk>
# Top-level installs should not use meta mode as it may prevent installing
# based on cookies. It's fine with filemon though.
.if !empty(META_MODE:Mnofilemon) && \
make(*install*) && ${.MAKE.LEVEL} == 0
META_MODE= normal
MK_META_MODE= no
.export MK_META_MODE
.endif
# If we were found via .../share/mk we need to replace that
# with ${.PARSEDIR:tA} so that we can be found by
# sub-makes launched from objdir.
.if ${.MAKEFLAGS:M.../share/mk} != ""
.MAKEFLAGS:= ${.MAKEFLAGS:S,.../share/mk,${.PARSEDIR:tA},}
.endif
.if ${MAKESYSPATH:Uno:M*.../*} != ""
MAKESYSPATH:= ${MAKESYSPATH:S,.../share/mk,${.PARSEDIR:tA},}
.export MAKESYSPATH
.elif empty(MAKESYSPATH)
MAKESYSPATH:= ${.PARSEDIR:tA}
.export MAKESYSPATH
.endif
.if ${RELDIR:U} == "." && ${.MAKE.LEVEL} == 0
.-include "${.CURDIR}/Makefile.sys.inc"
.endif
.include <src.sys.obj.mk>