Re: svn commit: r359685 - in head: . etc lib/libc/gen share/mk share/termcap usr.bin/login usr.bin/vgrind usr.sbin/services_mkdb

2020-04-10 Thread Rodney W. Grimes
> On 4/7/2020 3:37 AM, Rodney W. Grimes wrote:
> >> Author: sobomax
> >> Date: Tue Apr  7 02:46:22 2020
> >> New Revision: 359685
> >> URL: https://svnweb.freebsd.org/changeset/base/359685
> >>
> >> Log:
> >>   Normalize deployment tools usage and definitions by putting into one 
> >> place
> >>   instead of sprinkling them out over many disjoint files. This is a 
> >> follow-up
> >>   to achieve the same goal in an incomplete rev.348521.
> > I have concerns that this factoring out of 5 values that have not changed
> > in 25 years is a pessimization, it is one more file that make has to
> > open on each invocation.
> > 
> > 
> 
> The truth is that this additional file read is on top of hundreds of new
> reads per directory in the past few years. It can suck on NFS but
> otherwise this 1 change is very minor compared to other additions. One
> big example is foo.o.depend for each foo.o. Or bmake doing
> realpath(getcwd()) on every invocation. Improving those, or the bmake
> job queue, or bmake's overuse of /bin/sh, would go a lot further than
> the hit from this commit.

True, it was unfair of me to pick on this one change, there are a long
slow gradual increase in the disk I/O intensity of buildworld over
time.  I was more raising that general issue, that we should keep
an eye towards that as we make changes to the build system, we should
be very careful of anything that pessimizes the build.

My concerns are for people, like mdexter, that run Build Option
Serveys, which is basically 240 buildwords in a single invocation
with run times on the order days to complete, or for CI clusters
doing 1000's of builds a week.

> -- 
> Regards,
> Bryan Drewery
-- 
Rod Grimes rgri...@freebsd.org
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r359685 - in head: . etc lib/libc/gen share/mk share/termcap usr.bin/login usr.bin/vgrind usr.sbin/services_mkdb

2020-04-10 Thread Bryan Drewery
On 4/7/2020 3:37 AM, Rodney W. Grimes wrote:
>> Author: sobomax
>> Date: Tue Apr  7 02:46:22 2020
>> New Revision: 359685
>> URL: https://svnweb.freebsd.org/changeset/base/359685
>>
>> Log:
>>   Normalize deployment tools usage and definitions by putting into one place
>>   instead of sprinkling them out over many disjoint files. This is a 
>> follow-up
>>   to achieve the same goal in an incomplete rev.348521.
> I have concerns that this factoring out of 5 values that have not changed
> in 25 years is a pessimization, it is one more file that make has to
> open on each invocation.
> 
> 

The truth is that this additional file read is on top of hundreds of new
reads per directory in the past few years. It can suck on NFS but
otherwise this 1 change is very minor compared to other additions. One
big example is foo.o.depend for each foo.o. Or bmake doing
realpath(getcwd()) on every invocation. Improving those, or the bmake
job queue, or bmake's overuse of /bin/sh, would go a lot further than
the hit from this commit.

-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r359685 - in head: . etc lib/libc/gen share/mk share/termcap usr.bin/login usr.bin/vgrind usr.sbin/services_mkdb

2020-04-09 Thread Ian Lepore
On Thu, 2020-04-09 at 16:16 -0700, Rodney W. Grimes wrote:
> > Well, how many FreeBSD builds have you run in the last year, Rodney,
> > personally to care about 0.1s slowdown that it might have caused? We've run
> > at least a 1,000 here, probably 3x more.
> 
> That is a non technical personal attack.
> 
> > So yes, the cost is there, the
> > cost is well understood and found negligible versus the benefit of having a
> > slightly more extensible build system that is slightly easier to understand
> > and integrate into bigger projects.
> 
> I do not see how moving 5 values adds any extensibility or any ease of use,
> or intergratability.  It added an ease of editing the values to one file,
> values that *should not be edited inplace*.
> 
> If these values need overridden it should always be done on the make command
> line, especially by projects external to FreeBSD.  Your "extensible build 
> system"
> is reaching into internal project build infustructure in a non-supportable way
> if it requires this types of change.
> 

You did not look at the changes carefully enough.  This doesn't just
gather some values into one place, it replaces instances of hard-coded
tool names with variables.  To do so, those variables need to be
defined somewhere.  A new src.tools.mk is a good sensible place for
that.  Now that you have them all in once place, it doesn't make sense
to still have duplicate definitions in other places, everything should
refer to the one new source.

You have focused in on that last sentence and started complaining about
it as if it were the entire change.  It's just a minor cleanup which is
the natural thing to do given the rest of the change.  And the rest of
the change is useful in exactly the ways Maxim is saying (I say that as
someone who also maintains a large proprietary source base that uses
the freebsd build infrastructure).

-- Ian


___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r359685 - in head: . etc lib/libc/gen share/mk share/termcap usr.bin/login usr.bin/vgrind usr.sbin/services_mkdb

2020-04-09 Thread Rodney W. Grimes
> Well, how many FreeBSD builds have you run in the last year, Rodney,
> personally to care about 0.1s slowdown that it might have caused? We've run
> at least a 1,000 here, probably 3x more.

That is a non technical personal attack.

> So yes, the cost is there, the
> cost is well understood and found negligible versus the benefit of having a
> slightly more extensible build system that is slightly easier to understand
> and integrate into bigger projects.

I do not see how moving 5 values adds any extensibility or any ease of use,
or intergratability.  It added an ease of editing the values to one file,
values that *should not be edited inplace*.

If these values need overridden it should always be done on the make command
line, especially by projects external to FreeBSD.  Your "extensible build 
system"
is reaching into internal project build infustructure in a non-supportable way
if it requires this types of change.

> 
> -Max
> 
> On Wed, Apr 8, 2020 at 5:12 PM Rodney W. Grimes 
> wrote:
> 
> > > On Tue, Apr 7, 2020 at 3:37 AM Rodney W. Grimes <
> > free...@gndrsh.dnsmgr.net>
> > > wrote:
> > >
> > > > > Author: sobomax
> > > > > Date: Tue Apr  7 02:46:22 2020
> > > > > New Revision: 359685
> > > > > URL: https://svnweb.freebsd.org/changeset/base/359685
> > > > >
> > > > > Log:
> > > > >   Normalize deployment tools usage and definitions by putting into
> > one
> > > > place
> > > > >   instead of sprinkling them out over many disjoint files. This is a
> > > > follow-up
> > > > >   to achieve the same goal in an incomplete rev.348521.
> > > >
> > > > I have concerns that this factoring out of 5 values that have not
> > changed
> > > > in 25 years is a pessimization, it is one more file that make has to
> > > > open on each invocation.
> > > >
> > >
> > > Well, luckily enough the cost of opening a file has been exponentially
> > > declining over those 25 years, so we are probably many-orders of
> > magnitude
> > > faster than  we used to be back in 1995. Or so I've heard. :)
> >
> > I believe we are pretty much just on par and no more than 1
> > order of magnitude on time completion of make world.
> >
> > >
> > > Having those variables defined in a centralized manner allows us here for
> > > example to convert the result of what would be
> > > installworld/installkernel/distribution action into a self-extracting
> > > archive (optionally signed) with automatically generated script, which
> > does
> > > the action in question. As such, we can now build in a completely
> > sandboxed
> > > environment with 0 privileges (potentially even on something completely
> > > alien like GNU/Linux) and then deploy it to as many systems as we need or
> > > use to create VM images / Jails.
> > >
> > >
> > https://github.com/sobomax/sysmaker/blob/master/makeargs/distribution.sub
> > >
> > https://github.com/sobomax/sysmaker/blob/master/makeargs/installkernel.sub
> > >
> > https://github.com/sobomax/sysmaker/blob/master/makeargs/installworld.sub
> >
> > I do not see anything in that set of files that requires this change,
> > am I missing something?
> >
> > All of the existing values should of been overridable from the make
> > command line invocation, and it does not mater if they are in 1
> > file or 50 files.
> >
> > > I have very few reasons to believe that our needs to be unique in this, I
> > > am pretty sure others will find some interesting use for this as well
> > (e.g.
> > > signing binaries being installed, etc).
> >
> > I do not see that your needs require this change.
> >
> > >
> > > -Max
> >
> > --
> > Rod Grimes
> > rgri...@freebsd.org
> >
> >

-- 
Rod Grimes rgri...@freebsd.org
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r359685 - in head: . etc lib/libc/gen share/mk share/termcap usr.bin/login usr.bin/vgrind usr.sbin/services_mkdb

2020-04-09 Thread Maxim Sobolev
Well, how many FreeBSD builds have you run in the last year, Rodney,
personally to care about 0.1s slowdown that it might have caused? We've run
at least a 1,000 here, probably 3x more. So yes, the cost is there, the
cost is well understood and found negligible versus the benefit of having a
slightly more extensible build system that is slightly easier to understand
and integrate into bigger projects.

-Max

On Wed, Apr 8, 2020 at 5:12 PM Rodney W. Grimes 
wrote:

> > On Tue, Apr 7, 2020 at 3:37 AM Rodney W. Grimes <
> free...@gndrsh.dnsmgr.net>
> > wrote:
> >
> > > > Author: sobomax
> > > > Date: Tue Apr  7 02:46:22 2020
> > > > New Revision: 359685
> > > > URL: https://svnweb.freebsd.org/changeset/base/359685
> > > >
> > > > Log:
> > > >   Normalize deployment tools usage and definitions by putting into
> one
> > > place
> > > >   instead of sprinkling them out over many disjoint files. This is a
> > > follow-up
> > > >   to achieve the same goal in an incomplete rev.348521.
> > >
> > > I have concerns that this factoring out of 5 values that have not
> changed
> > > in 25 years is a pessimization, it is one more file that make has to
> > > open on each invocation.
> > >
> >
> > Well, luckily enough the cost of opening a file has been exponentially
> > declining over those 25 years, so we are probably many-orders of
> magnitude
> > faster than  we used to be back in 1995. Or so I've heard. :)
>
> I believe we are pretty much just on par and no more than 1
> order of magnitude on time completion of make world.
>
> >
> > Having those variables defined in a centralized manner allows us here for
> > example to convert the result of what would be
> > installworld/installkernel/distribution action into a self-extracting
> > archive (optionally signed) with automatically generated script, which
> does
> > the action in question. As such, we can now build in a completely
> sandboxed
> > environment with 0 privileges (potentially even on something completely
> > alien like GNU/Linux) and then deploy it to as many systems as we need or
> > use to create VM images / Jails.
> >
> >
> https://github.com/sobomax/sysmaker/blob/master/makeargs/distribution.sub
> >
> https://github.com/sobomax/sysmaker/blob/master/makeargs/installkernel.sub
> >
> https://github.com/sobomax/sysmaker/blob/master/makeargs/installworld.sub
>
> I do not see anything in that set of files that requires this change,
> am I missing something?
>
> All of the existing values should of been overridable from the make
> command line invocation, and it does not mater if they are in 1
> file or 50 files.
>
> > I have very few reasons to believe that our needs to be unique in this, I
> > am pretty sure others will find some interesting use for this as well
> (e.g.
> > signing binaries being installed, etc).
>
> I do not see that your needs require this change.
>
> >
> > -Max
>
> --
> Rod Grimes
> rgri...@freebsd.org
>
>
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r359685 - in head: . etc lib/libc/gen share/mk share/termcap usr.bin/login usr.bin/vgrind usr.sbin/services_mkdb

2020-04-08 Thread Rodney W. Grimes
> On Tue, Apr 7, 2020 at 3:37 AM Rodney W. Grimes 
> wrote:
> 
> > > Author: sobomax
> > > Date: Tue Apr  7 02:46:22 2020
> > > New Revision: 359685
> > > URL: https://svnweb.freebsd.org/changeset/base/359685
> > >
> > > Log:
> > >   Normalize deployment tools usage and definitions by putting into one
> > place
> > >   instead of sprinkling them out over many disjoint files. This is a
> > follow-up
> > >   to achieve the same goal in an incomplete rev.348521.
> >
> > I have concerns that this factoring out of 5 values that have not changed
> > in 25 years is a pessimization, it is one more file that make has to
> > open on each invocation.
> >
> 
> Well, luckily enough the cost of opening a file has been exponentially
> declining over those 25 years, so we are probably many-orders of magnitude
> faster than  we used to be back in 1995. Or so I've heard. :)

I believe we are pretty much just on par and no more than 1
order of magnitude on time completion of make world.

> 
> Having those variables defined in a centralized manner allows us here for
> example to convert the result of what would be
> installworld/installkernel/distribution action into a self-extracting
> archive (optionally signed) with automatically generated script, which does
> the action in question. As such, we can now build in a completely sandboxed
> environment with 0 privileges (potentially even on something completely
> alien like GNU/Linux) and then deploy it to as many systems as we need or
> use to create VM images / Jails.
> 
> https://github.com/sobomax/sysmaker/blob/master/makeargs/distribution.sub
> https://github.com/sobomax/sysmaker/blob/master/makeargs/installkernel.sub
> https://github.com/sobomax/sysmaker/blob/master/makeargs/installworld.sub

I do not see anything in that set of files that requires this change,
am I missing something?

All of the existing values should of been overridable from the make
command line invocation, and it does not mater if they are in 1
file or 50 files.

> I have very few reasons to believe that our needs to be unique in this, I
> am pretty sure others will find some interesting use for this as well (e.g.
> signing binaries being installed, etc).

I do not see that your needs require this change.

> 
> -Max

-- 
Rod Grimes rgri...@freebsd.org
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r359685 - in head: . etc lib/libc/gen share/mk share/termcap usr.bin/login usr.bin/vgrind usr.sbin/services_mkdb

2020-04-08 Thread Maxim Sobolev
On Tue, Apr 7, 2020 at 3:37 AM Rodney W. Grimes 
wrote:

> > Author: sobomax
> > Date: Tue Apr  7 02:46:22 2020
> > New Revision: 359685
> > URL: https://svnweb.freebsd.org/changeset/base/359685
> >
> > Log:
> >   Normalize deployment tools usage and definitions by putting into one
> place
> >   instead of sprinkling them out over many disjoint files. This is a
> follow-up
> >   to achieve the same goal in an incomplete rev.348521.
>
> I have concerns that this factoring out of 5 values that have not changed
> in 25 years is a pessimization, it is one more file that make has to
> open on each invocation.
>

Well, luckily enough the cost of opening a file has been exponentially
declining over those 25 years, so we are probably many-orders of magnitude
faster than  we used to be back in 1995. Or so I've heard. :)

Having those variables defined in a centralized manner allows us here for
example to convert the result of what would be
installworld/installkernel/distribution action into a self-extracting
archive (optionally signed) with automatically generated script, which does
the action in question. As such, we can now build in a completely sandboxed
environment with 0 privileges (potentially even on something completely
alien like GNU/Linux) and then deploy it to as many systems as we need or
use to create VM images / Jails.

https://github.com/sobomax/sysmaker/blob/master/makeargs/distribution.sub
https://github.com/sobomax/sysmaker/blob/master/makeargs/installkernel.sub
https://github.com/sobomax/sysmaker/blob/master/makeargs/installworld.sub

I have very few reasons to believe that our needs to be unique in this, I
am pretty sure others will find some interesting use for this as well (e.g.
signing binaries being installed, etc).

-Max
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r359685 - in head: . etc lib/libc/gen share/mk share/termcap usr.bin/login usr.bin/vgrind usr.sbin/services_mkdb

2020-04-07 Thread Rodney W. Grimes
> Author: sobomax
> Date: Tue Apr  7 02:46:22 2020
> New Revision: 359685
> URL: https://svnweb.freebsd.org/changeset/base/359685
> 
> Log:
>   Normalize deployment tools usage and definitions by putting into one place
>   instead of sprinkling them out over many disjoint files. This is a follow-up
>   to achieve the same goal in an incomplete rev.348521.

I have concerns that this factoring out of 5 values that have not changed
in 25 years is a pessimization, it is one more file that make has to
open on each invocation.


>   Approved by:imp
>   MFC after:  1 month
>   Differential Revision:  https://reviews.freebsd.org/D20520
> 
> Added:
>   head/share/mk/src.tools.mk   (contents, props changed)
> Modified:
>   head/Makefile.inc1
>   head/etc/Makefile
>   head/lib/libc/gen/Makefile.inc
>   head/share/mk/sys.mk
>   head/share/termcap/Makefile
>   head/usr.bin/login/Makefile
>   head/usr.bin/vgrind/Makefile
>   head/usr.sbin/services_mkdb/Makefile
> 
> Modified: head/Makefile.inc1
> ==
> --- head/Makefile.inc1Tue Apr  7 02:45:24 2020(r359684)
> +++ head/Makefile.inc1Tue Apr  7 02:46:22 2020(r359685)
> @@ -57,6 +57,8 @@ _MKSHOWCONFIG=  t
>  SRCDIR?= ${.CURDIR}
>  LOCALBASE?=  /usr/local
>  
> +.include "share/mk/src.tools.mk"
> +
>  # Cross toolchain changes must be in effect before bsd.compiler.mk
>  # so that gets the right CC, and pass CROSS_TOOLCHAIN to submakes.
>  .if defined(CROSS_TOOLCHAIN)
> @@ -874,8 +876,8 @@ MTREEFLAGS+=  -W
>  INSTALLFLAGS+=   -h sha256
>  .endif
>  .if defined(DB_FROM_SRC) || defined(NO_ROOT)
> -IMAKE_INSTALL=   INSTALL="install ${INSTALLFLAGS}"
> -IMAKE_MTREE= MTREE_CMD="mtree ${MTREEFLAGS}"
> +IMAKE_INSTALL=   INSTALL="${INSTALL_CMD} ${INSTALLFLAGS}"
> +IMAKE_MTREE= MTREE_CMD="${MTREE_CMD} ${MTREEFLAGS}"
>  .endif
>  
>  DESTDIR_MTREEFLAGS=  -deU
> @@ -887,12 +889,12 @@ WORLDTMP_MTREEFLAGS=-deUW
>  # that are created by mtree to be owned by root/wheel.
>  DESTDIR_MTREEFLAGS+= -W
>  .endif
> -MTREE?=  mtree
> +DISTR_MTREE= ${MTREE_CMD}
>  .if ${BUILD_WITH_STRICT_TMPPATH} != 0
> -MTREE=   ${WORLDTMP}/legacy/usr/sbin/mtree
> +DISTR_MTREE= ${WORLDTMP}/legacy/usr/sbin/mtree
>  .endif
> -WORLDTMP_MTREE=  ${MTREE} ${WORLDTMP_MTREEFLAGS}
> -DESTDIR_MTREE=   ${MTREE} ${DESTDIR_MTREEFLAGS}
> +WORLDTMP_MTREE=  ${DISTR_MTREE} ${WORLDTMP_MTREEFLAGS}
> +DESTDIR_MTREE=   ${DISTR_MTREE} ${DESTDIR_MTREEFLAGS}
>  
>  # kernel stage
>  KMAKEENV=${WMAKEENV:NSYSROOT=*}
> @@ -1363,14 +1365,14 @@ distributeworld installworld stageworld: _installcheck
>  .endif
>  .endif
>  .if defined(NO_ROOT)
> - ${IMAKEENV} ${MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \
> + ${IMAKEENV} ${DISTR_MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \
>   sed -e 's#^\./#./${dist}/#' >> ${METALOG}
> - ${IMAKEENV} ${MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.usr.dist | \
> + ${IMAKEENV} ${DISTR_MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.usr.dist | \
>   sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG}
> - ${IMAKEENV} ${MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.include.dist | \
> + ${IMAKEENV} ${DISTR_MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.include.dist 
> | \
>   sed -e 's#^\./#./${dist}/usr/include/#' >> ${METALOG}
>  .if defined(_LIBCOMPAT)
> - ${IMAKEENV} ${MTREE} -C -f 
> ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist | \
> + ${IMAKEENV} ${DISTR_MTREE} -C -f 
> ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist | \
>   sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG}
>  .endif
>  .endif
> 
> Modified: head/etc/Makefile
> ==
> --- head/etc/Makefile Tue Apr  7 02:45:24 2020(r359684)
> +++ head/etc/Makefile Tue Apr  7 02:46:22 2020(r359685)
> @@ -2,11 +2,11 @@
>  # $FreeBSD$
>  
>  .include 
> +.include 
>  
>  FILESGROUPS= FILES
>  NLS_ALIASES= POSIX C \
>   en_US.US_ASCII C
> -PWD_MKDB_CMD?=   pwd_mkdb
>  
>  # No need as it is empty and just causes rebuilds since this file does so 
> much.
>  UPDATE_DEPENDFILE=   no
> @@ -98,8 +98,6 @@ distribution:
>   ${DESTDIR}/boot/device.hints
>  .endif
>  .endif
> -
> -MTREE_CMD?=  mtree
>  
>  MTREES=  mtree/BSD.root.dist /   \
>   mtree/BSD.var.dist  /var\
> 
> Modified: head/lib/libc/gen/Makefile.inc
> ==
> --- head/lib/libc/gen/Makefile.incTue Apr  7 02:45:24 2020
> (r359684)
> +++ head/lib/libc/gen/Makefile.incTue Apr  7 02:46:22 2020
> (r359685)
> @@ -550,11 +550,13 @@ MLINKS+=vis.3 nvis.3 \
>  
>  MLINKS+=wordexp.3 wordfree.3
>  
> +.include 
> +
>  afterinstallconfig:
>  .if ${MK_TCSH} == "no"
>   sed -i "" -e 's;/bin/csh;/bin/sh;' ${DESTDIR}/etc/master.passwd
>  

svn commit: r359685 - in head: . etc lib/libc/gen share/mk share/termcap usr.bin/login usr.bin/vgrind usr.sbin/services_mkdb

2020-04-06 Thread Maxim Sobolev
Author: sobomax
Date: Tue Apr  7 02:46:22 2020
New Revision: 359685
URL: https://svnweb.freebsd.org/changeset/base/359685

Log:
  Normalize deployment tools usage and definitions by putting into one place
  instead of sprinkling them out over many disjoint files. This is a follow-up
  to achieve the same goal in an incomplete rev.348521.
  
  Approved by:  imp
  MFC after:1 month
  Differential Revision:https://reviews.freebsd.org/D20520

Added:
  head/share/mk/src.tools.mk   (contents, props changed)
Modified:
  head/Makefile.inc1
  head/etc/Makefile
  head/lib/libc/gen/Makefile.inc
  head/share/mk/sys.mk
  head/share/termcap/Makefile
  head/usr.bin/login/Makefile
  head/usr.bin/vgrind/Makefile
  head/usr.sbin/services_mkdb/Makefile

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Tue Apr  7 02:45:24 2020(r359684)
+++ head/Makefile.inc1  Tue Apr  7 02:46:22 2020(r359685)
@@ -57,6 +57,8 @@ _MKSHOWCONFIG=t
 SRCDIR?=   ${.CURDIR}
 LOCALBASE?=/usr/local
 
+.include "share/mk/src.tools.mk"
+
 # Cross toolchain changes must be in effect before bsd.compiler.mk
 # so that gets the right CC, and pass CROSS_TOOLCHAIN to submakes.
 .if defined(CROSS_TOOLCHAIN)
@@ -874,8 +876,8 @@ MTREEFLAGS+=-W
 INSTALLFLAGS+= -h sha256
 .endif
 .if defined(DB_FROM_SRC) || defined(NO_ROOT)
-IMAKE_INSTALL= INSTALL="install ${INSTALLFLAGS}"
-IMAKE_MTREE=   MTREE_CMD="mtree ${MTREEFLAGS}"
+IMAKE_INSTALL= INSTALL="${INSTALL_CMD} ${INSTALLFLAGS}"
+IMAKE_MTREE=   MTREE_CMD="${MTREE_CMD} ${MTREEFLAGS}"
 .endif
 
 DESTDIR_MTREEFLAGS=-deU
@@ -887,12 +889,12 @@ WORLDTMP_MTREEFLAGS=  -deUW
 # that are created by mtree to be owned by root/wheel.
 DESTDIR_MTREEFLAGS+=   -W
 .endif
-MTREE?=mtree
+DISTR_MTREE=   ${MTREE_CMD}
 .if ${BUILD_WITH_STRICT_TMPPATH} != 0
-MTREE= ${WORLDTMP}/legacy/usr/sbin/mtree
+DISTR_MTREE=   ${WORLDTMP}/legacy/usr/sbin/mtree
 .endif
-WORLDTMP_MTREE=${MTREE} ${WORLDTMP_MTREEFLAGS}
-DESTDIR_MTREE= ${MTREE} ${DESTDIR_MTREEFLAGS}
+WORLDTMP_MTREE=${DISTR_MTREE} ${WORLDTMP_MTREEFLAGS}
+DESTDIR_MTREE= ${DISTR_MTREE} ${DESTDIR_MTREEFLAGS}
 
 # kernel stage
 KMAKEENV=  ${WMAKEENV:NSYSROOT=*}
@@ -1363,14 +1365,14 @@ distributeworld installworld stageworld: _installcheck
 .endif
 .endif
 .if defined(NO_ROOT)
-   ${IMAKEENV} ${MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \
+   ${IMAKEENV} ${DISTR_MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \
sed -e 's#^\./#./${dist}/#' >> ${METALOG}
-   ${IMAKEENV} ${MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.usr.dist | \
+   ${IMAKEENV} ${DISTR_MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.usr.dist | \
sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG}
-   ${IMAKEENV} ${MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.include.dist | \
+   ${IMAKEENV} ${DISTR_MTREE} -C -f ${.CURDIR}/etc/mtree/BSD.include.dist 
| \
sed -e 's#^\./#./${dist}/usr/include/#' >> ${METALOG}
 .if defined(_LIBCOMPAT)
-   ${IMAKEENV} ${MTREE} -C -f 
${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist | \
+   ${IMAKEENV} ${DISTR_MTREE} -C -f 
${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist | \
sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG}
 .endif
 .endif

Modified: head/etc/Makefile
==
--- head/etc/Makefile   Tue Apr  7 02:45:24 2020(r359684)
+++ head/etc/Makefile   Tue Apr  7 02:46:22 2020(r359685)
@@ -2,11 +2,11 @@
 # $FreeBSD$
 
 .include 
+.include 
 
 FILESGROUPS=   FILES
 NLS_ALIASES=   POSIX C \
en_US.US_ASCII C
-PWD_MKDB_CMD?= pwd_mkdb
 
 # No need as it is empty and just causes rebuilds since this file does so much.
 UPDATE_DEPENDFILE= no
@@ -98,8 +98,6 @@ distribution:
${DESTDIR}/boot/device.hints
 .endif
 .endif
-
-MTREE_CMD?=mtree
 
 MTREES=mtree/BSD.root.dist /   \
mtree/BSD.var.dist  /var\

Modified: head/lib/libc/gen/Makefile.inc
==
--- head/lib/libc/gen/Makefile.inc  Tue Apr  7 02:45:24 2020
(r359684)
+++ head/lib/libc/gen/Makefile.inc  Tue Apr  7 02:46:22 2020
(r359685)
@@ -550,11 +550,13 @@ MLINKS+=vis.3 nvis.3 \
 
 MLINKS+=wordexp.3 wordfree.3
 
+.include 
+
 afterinstallconfig:
 .if ${MK_TCSH} == "no"
sed -i "" -e 's;/bin/csh;/bin/sh;' ${DESTDIR}/etc/master.passwd
 .endif
-   pwd_mkdb -i -p -d ${DESTDIR}/etc ${DESTDIR}/etc/master.passwd
+   ${PWD_MKDB_CMD} -i -p -d ${DESTDIR}/etc ${DESTDIR}/etc/master.passwd
 .if defined(NO_ROOT) && defined(METALOG)
( \
echo "./etc/pwd.db type=file mode=0644 uname=root gname=wheel"; 
\

Added: head/share/mk/src.tools.mk
==
---