Define SRCTOP in src.sys.mk

Because src.sys.mk should only ever be found in the src tree
we can use its position (.PARSEDIR) to set SRCTOP.

Reviewed by:	bapt, imp
This commit is contained in:
sjg 2015-05-30 15:08:52 +00:00
parent 551209395d
commit dc368d812a

View File

@ -5,13 +5,16 @@
# to preserve historical (and useful) behavior. Changes here need to
# be reflected there so SRCCONF isn't included multiple times.
# make sure this is defined in a consistent manner
SRCTOP:= ${.PARSEDIR:tA:H:H}
# Allow user to configure things that only effect src tree builds.
SRCCONF?= /etc/src.conf
.if (exists(${SRCCONF}) || ${SRCCONF} != "/etc/src.conf") && !target(_srcconf_included_)
.include "${SRCCONF}"
.sinclude "${SRCCONF}"
_srcconf_included_: .NOTMAIN
.endif
# If we were found via .../share/mk we need to replace that in
# 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} != ""