The default MAKEOBJDIR is based on OBJTOP not OBJROOT. Without this some
recursive makes for various targets compute an .OBJDIR under / and make
prints various warnings of the form:
make[5] warning: /lib: Permission denied.
Differential D30990
src.sys.obj.mk: Export OBJTOP like OBJROOT Authored by jrtc27 on Jul 2 2021, 12:38 AM. Tags None Referenced Files
Details
Diff Detail
Event TimelineComment Actions More scrutiny for this would be good, these parts of the build system always risk being like a game of whack-a-mole...
Comment Actions I see that this review has kind of stalled. I've just given a test to the change and I see a problem (maybe related to what @sjg warned about): + make installworld distrib-dirs installkernel -s -j6 '__MAKE_CONF=/usr/home/avg/devel/builds/rock/make.conf' 'SRCCONF=/usr/home/avg/devel/builds/rock/src.conf' 'KERNCONFDIR=/usr/home/avg/devel/builds/rock' 'KERNCONF=KERNEL' 'DESTDIR=/usr/obj/rock/image' 'DB_FROM_SRC=t' 'NO_ROOT=t' make[1]: "/usr/devel/git/rock/Makefile.inc1" line 106: A build is required first. You may have the wrong MAKEOBJDIRPREFIX set. Seems like it could be related to this line: .-include "${OBJTOP}/toolchain-metadata.mk"Comment Actions The patch below, builds buildworld ok, avoids these warnings (due to OBJTOP being empty when evaluatinng MAKEOBJDIR which is set to ${.CURDIR:S,${SRCTOP},${OBJTOP},} diff --git a/share/mk/src.sys.obj.mk b/share/mk/src.sys.obj.mk index e4fe3fa9a2aa..67af0b833faa 100644 --- a/share/mk/src.sys.obj.mk +++ b/share/mk/src.sys.obj.mk @@ -88,18 +88,22 @@ SB_OBJROOT:= ${OBJROOT} # in the source tree. .if ${MK_UNIFIED_OBJDIR} == "yes" && ${SRCTOP} != ${OBJROOT:tA} .if defined(TARGET) && defined(TARGET_ARCH) -OBJTOP:= ${OBJROOT}${TARGET}.${TARGET_ARCH} +OBJTOP:= ${OBJROOT}$${TARGET}.$${TARGET_ARCH} .elif defined(TARGET) && ${.CURDIR} == ${SRCTOP} # Not enough information, just use basic OBJDIR. This can happen with some # 'make universe' targets or if TARGET is not being used as expected. OBJTOP:= ${OBJROOT:H} .else -OBJTOP:= ${OBJROOT}${MACHINE}.${MACHINE_ARCH} +OBJTOP:= ${OBJROOT}$${MACHINE}.$${MACHINE_ARCH} .endif .else # TARGET.TARGET_ARCH handled in OBJROOT already. OBJTOP:= ${OBJROOT:H} .endif # ${MK_UNIFIED_OBJDIR} == "yes" +# export but do not track +.export-env OBJTOP +# resolve if needed +OBJTOP:= ${OBJTOP} .endif # empty(OBJTOP) # Fixup OBJROOT/OBJTOP if using MAKEOBJDIRPREFIX.
Comment Actions FWIW this simple .export OBJTOP works ok for buildworld but not for targets like universe where multiple arches try to use the same OBJTOP which quickly ends in tears. | ||||||||||||||||||||||||||||||||||||||||||||||||||