Re: Default NO_CLEAN=yes in 15+

Brooks Davis <[email protected]>
Newsgroups gmane.os.freebsd.architechture
Message-ID <[email protected]>
On Tue, Jul 23, 2024 at 03:58:13PM -0400, John Baldwin wrote:
> The buildworld and buildkernel targets include a "clean" step before building
> objects dating back before my time to 'make world' (I haven't looked to see
> how far back it goes).  To permit incremental builds, this step can be skipped
> via NO_CLEAN=yes.  This step is a bit unusual in build systems however.  Most
> build systems have separate commands for building vs cleaning (e.g. 'make all'
> vs 'make clean') and over time FreeBSD's build system has gained dedicated
> clean targets as well (cleanworld and cleankernel).  For myself, I always
> use NO_CLEAN=yes when building worlds and kernels.  If I need a clean build
> I use the dedicated clean targets (e.g. cleanworld) first.  In particular,
> cleanworld/cleankernel are far more efficient since they use a single
> recursive 'rm' whereas the "clean" step involves a full tree walk with
> nested make invocations of the 'cleandir' target.
> 
> A few years ago, Ed Maste added a MK_CLEAN option to src.opts.mk to as a
> WITH/WITHOUT knob for the "clean" step similar to NO_CLEAN=yes.  To preserve
> existing behavior this knob currently defaults to on, but I know Ed's goal
> was to eventually flip the default so that NO_CLEAN builds would be the
> default.  I would like us to do that starting in 15.

+1

We should continue spot cleanups for things like foo.c -> foo.S as
required rather than pointlessly rebuilding everything every time.  It's
much better for a small number of people to spend time tidying things up
than to make expensive cleaning the default.

> Further off, I would suggest that we remove the "clean" step outright,
> perhaps in 16.x.  Regardless, we will need to update documentation to
> prefer the clean targets over WITH_CLEAN=yes if our docs do not do this
> already.

I strongly agree.  It's all weird and unnecessary with things like
git-clean(1) available.  Eventually I'd like to get rid of cleandir and
its weird behavior differences based on .OBJDIR's existence.  This is
tooling for the distant past.

-- Brooks
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.