commit da18238af4829f20f48924f4cc23958d7e66045c Author: Bryan Drewery Date: Fri Nov 3 21:24:58 2017 -0700 Fix nested MAKEOBJDIRPREFIX in some cases. For the release(7) targets, some will run mm-mtree.sh which itself runs make with a MAKEOBJDIRPREFIX. The execution of that script leaks OBJROOT, MAKEOBJDIR, and MAKELEVEL=1 in the environment. This causes the mm-mtree makes to not do some basic setup of OBJROOT and only use this special MAKEOBJDIRPREFIX case which fails to empty out MAKEOBJDIRPREFIX for further nested makes, such as a tree walk. If that tree walk sets OBJROOT/OBJTOP such as r325329 is doing, then the wrong OBJDIRs end up being used due to the unemptied MAKEOBJDIRPREFIX being preferred over the proper MAKEOBJDIR. The impact of this change is that release(7) targets are fixed, and that nested sub-makes with additional MAKEOBJDIRPREFIX set will have TARGET.TARGET_ARCH added redundantly into them. That can be avoided by setting a make argument OBJTOP/OBJROOT like in r325329 or r325350. Some other method may be done in the future to avoid this automatically. Pointyhat to: bdrewery Sponsored by: Dell EMC Isilon diff --git share/mk/src.sys.obj.mk share/mk/src.sys.obj.mk index fe28f84206f2..88294faa47f5 100644 --- share/mk/src.sys.obj.mk +++ share/mk/src.sys.obj.mk @@ -25,7 +25,7 @@ _default_makeobjdir= $${.CURDIR:S,^$${SRCTOP},$${OBJTOP},} .include -.if ${.MAKE.LEVEL} == 0 || empty(OBJROOT) +.if ${.MAKE.LEVEL} == 0 || empty(OBJROOT) || !empty(MAKEOBJDIRPREFIX) .if ${MK_UNIFIED_OBJDIR} == "no" # Fall back to historical behavior. # We always want to set a default MAKEOBJDIRPREFIX... @@ -84,16 +84,6 @@ OBJTOP:= ${OBJROOT:H} .endif .endif -# Fixup OBJROOT/OBJTOP if using MAKEOBJDIRPREFIX but leave it alone -# for DIRDEPS_BUILD which really wants to know the absolute top at -# all times. This intenionally comes after adding TARGET.TARGET_ARCH -# so that is truncated away for nested objdirs. This logic also -# will not trigger if the OBJROOT block above unsets MAKEOBJDIRPREFIX. -.if !empty(MAKEOBJDIRPREFIX) && ${MK_DIRDEPS_BUILD} == "no" -OBJTOP:= ${MAKEOBJDIRPREFIX}${SRCTOP} -OBJROOT:= ${OBJTOP}/ -.endif - # Try to enable MK_AUTO_OBJ by default if we can write to the OBJROOT. Only # do this if AUTO_OBJ is not disabled by the user, not cleaning, and this # is the first make ran.