src.sys.obj.mk: Export OBJTOP

If we had to set OBJTOP we want to .export it (if .MAKE.LEVEL > 0)
for the benefit of things like x!= ${.MAKE} -r ... and similar.

Without OBJTOP, the default MAKEOBJDIR setting will result in
attempting to use an objdir like /lib or /bin etc in some cases.

This patch is based on D30990
with the addition of the check for level > 0.

Reviewed by: jrtc27
Differential Revision:        <https://reviews.freebsd.org/D30990>
This commit is contained in:
Simon J. Gerraty 2024-05-28 11:51:31 -07:00
parent c867ba7288
commit 2b7c1402f9

View file

@ -94,6 +94,9 @@ OBJTOP:= ${OBJROOT}${MACHINE}.${MACHINE_ARCH}
# TARGET.TARGET_ARCH handled in OBJROOT already.
OBJTOP:= ${OBJROOT:H}
.endif # ${MK_UNIFIED_OBJDIR} == "yes"
.if ${.MAKE.LEVEL} > 0
.export OBJTOP
.endif
.endif # empty(OBJTOP)
# Fixup OBJROOT/OBJTOP if using MAKEOBJDIRPREFIX.