Patchwork [v2] Makefile: Avoid explicit list of directories in clean target

login
register
mail settings
Submitter Peter Maydell
Date Aug. 15, 2012, 11:29 a.m.
Message ID <1345030164-2496-1-git-send-email-peter.maydell@linaro.org>
Download mbox | patch
Permalink /patch/177637/
State New
Headers show

Comments

Peter Maydell - Aug. 15, 2012, 11:29 a.m.
Avoid having an explicit list of directories in the 'clean'
target by using 'find' to remove all .o and .d files instead.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
Changes v1->v2: use portable 'find -exec' rather than unsafe 'find | xargs'
or unportable 'find -print0 | xargs -0'.

 Makefile |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
Eric Blake - Aug. 15, 2012, 1:25 p.m.
On 08/15/2012 05:29 AM, Peter Maydell wrote:
> Avoid having an explicit list of directories in the 'clean'
> target by using 'find' to remove all .o and .d files instead.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> Changes v1->v2: use portable 'find -exec' rather than unsafe 'find | xargs'
> or unportable 'find -print0 | xargs -0'.
> 
>  Makefile |    7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)

Reviewed-by: Eric Blake <eblake@redhat.com>
Stefan Hajnoczi - Aug. 15, 2012, 1:33 p.m.
On Wed, Aug 15, 2012 at 12:29:24PM +0100, Peter Maydell wrote:
> Avoid having an explicit list of directories in the 'clean'
> target by using 'find' to remove all .o and .d files instead.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> Changes v1->v2: use portable 'find -exec' rather than unsafe 'find | xargs'
> or unportable 'find -print0 | xargs -0'.
> 
>  Makefile |    7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)

Thanks, applied to the trivial patches tree:
https://github.com/stefanha/qemu/commits/trivial-patches

Stefan

Patch

diff --git a/Makefile b/Makefile
index d736ea5..2964d5c 100644
--- a/Makefile
+++ b/Makefile
@@ -214,13 +214,10 @@  clean:
 # avoid old build problems by removing potentially incorrect old files
 	rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
 	rm -f qemu-options.def
-	rm -f *.o *.d *.a *.lo $(TOOLS) $(HELPERS-y) qemu-ga TAGS cscope.* *.pod *~ */*~
+	find . -name '*.[od]' -exec rm -f {} +
+	rm -f *.a *.lo $(TOOLS) $(HELPERS-y) qemu-ga TAGS cscope.* *.pod *~ */*~
 	rm -Rf .libs
-	rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d block/*.o block/*.d net/*.o net/*.d fsdev/*.o fsdev/*.d ui/*.o ui/*.d qapi/*.o qapi/*.d qga/*.o qga/*.d
-	rm -f qom/*.o qom/*.d libuser/qom/*.o libuser/qom/*.d
-	rm -f hw/usb/*.o hw/usb/*.d hw/*.o hw/*.d
 	rm -f qemu-img-cmds.h
-	rm -f trace/*.o trace/*.d
 	rm -f trace-dtrace.dtrace trace-dtrace.dtrace-timestamp
 	@# May not be present in GENERATED_HEADERS
 	rm -f trace-dtrace.h trace-dtrace.h-timestamp