Adding 'realclean' target to /usr/src/Makefile

Garance A Drosihn drosih at rpi.edu
Sun Feb 15 12:34:53 PST 2004


At 10:19 AM -0700 2/15/04, M. Warner Losh wrote:
>In message: <p0602040fbc54cd0d3342@[128.113.24.47]>
>             Garance A Drosihn <drosih at 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 at gilead.netel.rpi.edu
Senior Systems Programmer           or  gad at freebsd.org
Rensselaer Polytechnic Institute    or  drosih at rpi.edu


More information about the freebsd-hackers mailing list