On May 6, 2025, at 13:14, Simon J. Gerraty <s...@juniper.net> wrote:

> Mark Millard <mark...@yahoo.com> wrote:
>>> Of course trying to get too clever can end up being counter productive,
>>> but the tools are there...
>> 
>> I still have the addition that we found was needed
>> in my experiments years ago (white space details
>> below may not have been preserved):
> 
> IIRC there are a few problem locations in the build where this or
> similar caused problems.  I think this relates to some hierarchies being
> built with custom env - which makes it hard for src.sys.obj.mk to always
> get things right.
> 
> I think the change below or close to it has been committed and reverted
> in the past.

Just as a reminder of how you got to the point
of providing me that patch . .  . 

QUOTE (from old, 2023 Email)
>> Perhaps you want to be using
>> 
>> .MAKE.META.IGNORE_PATHS+= ${MAKEOBJDIRPREFIX}/tmp/legacy/usr
>> or is that ${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH}/tmp/legacy/usr
>> 
> 
> I had started with trying to use MAKEOBJDIRPREFIX but it
> appeared to end up with an empty expansion in something
> I'd looked at, making the addition to
> .MAKE.META.IGNORE_PATHS ineffective.
> 
> But with the .info lines in place, I should probably
> recheck an example with ${MAKEOBJDIRPREFIX} in it.
> (Expecting .MAKE.META.IGNORE_PATHS to not work but
> showing what happens for the MAKEOBJDIRPREFIX use.)
> This turns out to be different for "modules" vs.
> "pure kernel". I start with a "modules" example
> below.

Yes, if the value of MAKEOBJDIRPREFIX isn't consistent that's going to
cause problems (I'd call it a bug). If so don't use MAKEOBJDIRPREFIX
directly, set some other variable and export that.
Hmm src.sys.obj.mk plays games with MAKEOBJDIRPREFIX so that's
probably not a good option.
Perhaps:

diff --git a/share/mk/src.sys.obj.mk b/share/mk/src.sys.obj.mk
index 3b48fc3c5514..3c7e570dbdbd 100644
--- a/share/mk/src.sys.obj.mk
+++ b/share/mk/src.sys.obj.mk
@@ -67,6 +67,9 @@ SB_OBJROOT?= ${SB}/obj/
OBJROOT?= ${SB_OBJROOT}
.endif
OBJROOT?= ${_default_makeobjdirprefix}${SRCTOP}/
+# save the value before we mess with it
+_OBJROOT:= ${OBJROOT:tA}
+.export _OBJROOT
.if ${OBJROOT:M*/} != ""
OBJROOT:= ${OBJROOT:H:tA}/
.else

and then something like?

.MAKE.META.IGNORE_PATHS +=
${_OBJROOT}/${MACHINE}.${MACHINE_ARCH}/tmp/legacy/usr

> and still not right (MAKEOBJDIRPREFIX expanded
> to empty).

See above
END QUOTE

My understanding was that, without something new like
what is named _OBJROOT here, the .MAKE.META.IGNORE_PATHS
usage simply would not work reliably, just like it did
not work with anything I tried before you supplied the
_OBJROOT definition to use.

See the more cmoplete text for how it is used that I've
added later below.

>> # git -C /usr/main-src/ diff share/
>> diff --git a/share/mk/src.sys.obj.mk b/share/mk/src.sys.obj.mk
>> index 708559edcdb8..e710ae057fc6 100644
>> --- a/share/mk/src.sys.obj.mk
>> +++ b/share/mk/src.sys.obj.mk
>> @@ -66,6 +66,9 @@ SB_OBJROOT?=  ${SB}/obj/
>> OBJROOT?=      ${SB_OBJROOT}
>> .endif
>> OBJROOT?=      ${_default_makeobjdirprefix}${SRCTOP}/
>> +# save the value before we mess with it
>> +_OBJROOT:= ${OBJROOT:tA}
>> +.export _OBJROOT
>> .if ${OBJROOT:M*/} != ""
>> OBJROOT:=      ${OBJROOT:H:tA}/
>> .else
>> 
>> where I had to use _OBJROOT to have 2 appropriate paths
>> built. (See later below.)
>> 
>> It is still not part of the official share/mk/src.sys.obj.mk
>> so I normally avoid referencing it or what would involve
>> its use. But I've not checked if it has been added via some
>> other place providing the definition.
>> 
>> Used via:
>> 
>> # grep -r "\<_OBJROOT\>" ~/src.configs/
>> /root/src.configs/make.conf:# _OBJROOT is an addition to 
>> share/mk/src.sys.obj.mk
>> /root/src.configs/make.conf:# +_OBJROOT:= ${OBJROOT:tA}
>> /root/src.configs/make.conf:# +.export _OBJROOT
>> /root/src.configs/make.conf:IGNORELEGACY_NOSYMLINKPREFIX= 
>> ${_OBJROOT}/${TARGET}.${TARGET_ARCH}/tmp/legacy/usr
>> /root/src.configs/make.conf:IGNOREOTHER_NOSYMLINKPREFIX=  
>> ${_OBJROOT}/${TARGET}.${TARGET_ARCH}/tmp/usr/bin
>> 
>> It was associated with symbolic links begin involved.
> 
> Your use of _OBJROOT looks similar to how we (Juniper) use SB_OBJROOT.
> We run make via a wrapper which defines SB (location of the tree) and a
> number of SB_* variables which can be assumed correct.  It also obviates
> the need for make.conf
> 
> Of course our build is never used to "install" anything - we just build
> packages which are then installed, so it is much simpler.

As for  more detail on how _OBJROOT was used:

QUOTE
For reference, I'm using the below block of text
for the .MAKE.META.IGNORE_PATHS adjustments now.

# _OBJROOT is an addition to share/mk/src.sys.obj.mk
# provided by Simon J. Gerraty for my experimentation
# with this avoidance of some unnecessary build
# activity in META MODE:
#
#  OBJROOT?=      ${_default_makeobjdirprefix}${SRCTOP}/
# +# save the value before we mess with it
# +_OBJROOT:= ${OBJROOT:tA}
# +.export _OBJROOT
#
# TARGET.TARGET_ARCH   for amd64 stays as  amd64.amd64 for obj-lib32 (correct 
for the purpose)
# MACHINE.MACHINE_ARCH for amd64 turns into i386.i386  for obj-lib32 (wrong   
for the purpose)
#
IGNORELEGACY_NOSYMLINKPREFIX= 
${_OBJROOT}/${TARGET}.${TARGET_ARCH}/tmp/legacy/usr
IGNOREOTHER_NOSYMLINKPREFIX=  ${_OBJROOT}/${TARGET}.${TARGET_ARCH}/tmp/usr/bin
#
.for ignore_legacy_tool in awk basename cap_mkdb cat chmod cmp cp crunchgen 
crunchide cut date dd dirname echo egrep env expr fgrep file2c find gencat grep 
gzip head hostname jot lex lb ln ls m4 make
mkcsmapper mkdir mktemp mtree mv nawk patch realpath rm sed sh sort touch tr 
truncate uudecode uuencode wc xargs
.MAKE.META.IGNORE_PATHS+= 
${IGNORELEGACY_NOSYMLINKPREFIX}/sbin/${ignore_legacy_tool}
.endfor
#
.for ignore_other_tool in ctfconvert objcopy nm
.MAKE.META.IGNORE_PATHS+= ${IGNOREOTHER_NOSYMLINKPREFIX}/${ignore_other_tool}
.endfor
#
.MAKE.META.IGNORE_PATHS:= ${.MAKE.META.IGNORE_PATHS}
END QUOTE

===
Mark Millard
marklmi at yahoo.com


Reply via email to