On Tue, Jul 31, 2012 at 08:24:58AM -0600, Eric Blake wrote: > On 07/31/2012 08:19 AM, Markus Armbruster wrote: > > Peter Maydell <peter.mayd...@linaro.org> writes: > > > >> Avoid having an explicit list of directories in the 'clean' > >> target by using 'find' to remove all .o and .d files instead. > >> > > >> rm -f qemu-options.def > >> - rm -f *.o *.d *.a *.lo $(TOOLS) $(HELPERS-y) qemu-ga TAGS cscope.* > >> *.pod *~ */*~ > >> + find . -name '*.[od]' | xargs rm -f > >> + rm -f *.a *.lo $(TOOLS) $(HELPERS-y) qemu-ga TAGS cscope.* *.pod *~ */*~ > > > > Shit happens if you somehow manage to create a "mean" file name in the > > build tree. Sure you don't want to -print0 | xargs -0? > > Except that 'find -print0' and 'xargs -0' are both GNU extensions, not > available everywhere. We may be requiring gmake and gcc, but are we > also requiring GNU find? > > The POSIX way to write this, without relying on extensions, is: > > find . -name '*.[od]' -exec rm -f {} + > > (although then you get into the arguments of whether 'find -exec {} +' > is portable yet, even though it has now been required by POSIX for more > than 4 years.)
This portable approach seems reasonable. I have checked the find(1) man page on: FreeBSD, OpenBSD, Solaris 11, Mac OS X. Let's give find -exec + a shot. If it breaks something then the folks who care can provide a buildslave to ensure their host platform continues to be supported in the future. Stefan