diff mbox

Makefile.hw: avoid overly large 'make clean' rm command

Message ID 1340117738-15225-1-git-send-email-peter.maydell@linaro.org
State New
Headers show

Commit Message

Peter Maydell June 19, 2012, 2:55 p.m. UTC
Avoid 'make clean' producing an 'rm' command which has a lot
of duplicate 'hw//*.o' arguments, by using $(sort $(dir ..))
rather than $(dir $(sort ..)) so Make's sort function will
remove the duplicates for us. We can also remove the double
'//' safely because $(dir ..) is guaranteed to return a string
ending in '/'.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
Mostly cosmetic, although I guess there's a faint chance that expanding
all those hw/*.o would hit the command line argument buffer limit...

 Makefile.hw |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Comments

Stefan Hajnoczi June 22, 2012, 9:04 a.m. UTC | #1
On Tue, Jun 19, 2012 at 03:55:38PM +0100, Peter Maydell wrote:
> Avoid 'make clean' producing an 'rm' command which has a lot
> of duplicate 'hw//*.o' arguments, by using $(sort $(dir ..))
> rather than $(dir $(sort ..)) so Make's sort function will
> remove the duplicates for us. We can also remove the double
> '//' safely because $(dir ..) is guaranteed to return a string
> ending in '/'.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> Mostly cosmetic, although I guess there's a faint chance that expanding
> all those hw/*.o would hit the command line argument buffer limit...
> 
>  Makefile.hw |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)

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

Stefan
diff mbox

Patch

diff --git a/Makefile.hw b/Makefile.hw
index 2bcbaff..28fe100 100644
--- a/Makefile.hw
+++ b/Makefile.hw
@@ -19,8 +19,8 @@  all: $(hw-obj-y)
 	@true
 
 clean:
-	rm -f $(addsuffix /*.o, $(dir $(sort $(hw-obj-y))))
-	rm -f $(addsuffix /*.d, $(dir $(sort $(hw-obj-y))))
+	rm -f $(addsuffix *.o, $(sort $(dir $(hw-obj-y))))
+	rm -f $(addsuffix *.d, $(sort $(dir $(hw-obj-y))))
 
 # Include automatically generated dependency files
 -include $(patsubst %.o, %.d, $(hw-obj-y))