From 2ad46929121277456fdab2c946bf99ad91c1d8f1 Mon Sep 17 00:00:00 2001 From: "Simon J. Gerraty" Date: Tue, 24 Feb 2015 19:03:31 +0000 Subject: [PATCH] If sys.mk were found via the magic path .../share/mk replace it with the absolute path of .PARSEDIR, so that sub-makes launched from objdirs (eg kernel) can still find the correct mk files. Reviewed by: obrien --- share/mk/src.sys.mk | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/share/mk/src.sys.mk b/share/mk/src.sys.mk index 2682dca0d7b..78a0c237867 100644 --- a/share/mk/src.sys.mk +++ b/share/mk/src.sys.mk @@ -11,3 +11,13 @@ SRCCONF?= /etc/src.conf .include "${SRCCONF}" _srcconf_included_: .NOTMAIN .endif +# If we were found via .../share/mk we need to replace that in +# 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 +.endif