Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Feb 2004 15:34:46 -0500
From:      Garance A Drosihn <drosih@rpi.edu>
To:        "M. Warner Losh" <imp@bsdimp.com>
Cc:        hackers@freebsd.org
Subject:   Re: Adding 'realclean' target to /usr/src/Makefile
Message-ID:  <p06020411bc5584b53edd@[128.113.24.47]>
In-Reply-To: <20040215.101900.20429400.imp@bsdimp.com>
References:  <p0602040fbc54cd0d3342@[128.113.24.47]> <20040215.101900.20429400.imp@bsdimp.com>

next in thread | previous in thread | raw e-mail | index | archive | help
At 10:19 AM -0700 2/15/04, M. Warner Losh wrote:
>In message: <p0602040fbc54cd0d3342@[128.113.24.47]>
>             Garance A Drosihn <drosih@rpi.edu> writes:
>: realclean :
>:	rm -Rf ${.OBJDIR}/*
>
>I'd make that be more like:
>
>realclean :
>	@chflags -R 0 ${.OBJDIR}/*
>	@rm -Rf ${.OBJDIR}/*
>
>If you can tolerate errors in the output, the following is
>faster because the chflags has lots less work to do:
>
>realclean :
>	@rm -Rf ${.OBJDIR}/*
>	@chflags -R 0 ${.OBJDIR}/*
>	@rm -Rf ${.OBJDIR}/*

The more foolproof/reliable we can make it for everybody, the
more I like it.  I'll see your chflags, and add one redirection
of stderr so the user won't see errors that we don't really
care about:

realclean :
	@rm -Rf ${.OBJDIR}/*  2>/dev/null
	@chflags -R 0 ${.OBJDIR}/*
	@rm -Rf ${.OBJDIR}/*

Any errors that showed up on the first 'rm' should also show up
on the second 'rm', so we shouldn't really lose any useful info.
I might also try wrapping the second two commands in an 'if', so
they will be executed only if there's still something left over
after the first 'rm'.

-- 
Garance Alistair Drosehn            =   gad@gilead.netel.rpi.edu
Senior Systems Programmer           or  gad@freebsd.org
Rensselaer Polytechnic Institute    or  drosih@rpi.edu



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?p06020411bc5584b53edd>