Page MenuHomeFreeBSD

src.sys.obj.mk: Export OBJTOP like OBJROOT
AcceptedPublic

Authored by jrtc27 on Jul 2 2021, 12:38 AM.

Details

Reviewers
bdrewery
imp
sjg
Summary

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.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 40226
Build 37115: arc lint + arc unit

Event Timeline

Solves it for me too. I'd add sjg as well

This revision is now accepted and ready to land.Jul 2 2021, 12:41 AM

More scrutiny for this would be good, these parts of the build system always risk being like a game of whack-a-mole...

share/mk/src.sys.obj.mk
99

This is dangerous depending on build mode.
In DIRDEPS build, we do not want to .export anything from level 0 (responsible only for build orchestration) that is not constant.

`.if ${.MAKE.LEVEL} > 0
.export OBJTOP
.endif`

would be safe. Does that work for your case?

share/mk/src.sys.obj.mk
99

This is all under .if ${MK_DIRDEPS_BUILD} == "no" (line 79). But yes it probably does; OBJROOT and SRCDIR get an .if ${.MAKE.LEVEL} == 0 already for free as all of their logic is guarded by that. I'll give it a test tomorrow.

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"