summaryrefslogtreecommitdiffstats
path: root/share/mk/src.sys.mk
diff options
context:
space:
mode:
Diffstat (limited to 'share/mk/src.sys.mk')
-rw-r--r--share/mk/src.sys.mk13
1 files changed, 13 insertions, 0 deletions
diff --git a/share/mk/src.sys.mk b/share/mk/src.sys.mk
index 4bd22e5..e235a64 100644
--- a/share/mk/src.sys.mk
+++ b/share/mk/src.sys.mk
@@ -5,9 +5,22 @@
# 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_)
.sinclude "${SRCCONF}"
_srcconf_included_: .NOTMAIN
.endif
+# If we were found via .../share/mk we need to replace that in
+# with ${SRCTOP} so that we can be found by
+# sub-makes launched from objdir.
+.if ${.MAKEFLAGS:M.../share/mk} != ""
+.MAKEFLAGS:= ${.MAKEFLAGS:S,.../share/mk,${SRCTOP}/share/mk,}
+.endif
+.if ${MAKESYSPATH:Uno:M*.../*} != ""
+MAKESYSPATH:= ${MAKESYSPATH:S,.../share/mk,${SRCTOP}/share/mk,}
+.export MAKESYSPATH
+.endif
OpenPOWER on IntegriCloud