Skip to contentSkip to conversation

Makefile.target: Update clean command to clean hw/ directory

PATCH In review Peter Maydell 1 participant 2 messages Jun 20, 2012 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Makefile.target: Update clean command to clean hw/ directory

Now we create object files in a hierarchy under hw/, so the 'clean' target must also be updated to delete those object files. Rather than using a manual list of subdirectories which will easily drift out of date, we just delete all .o and .d files in the target directory hierarchy.

---
v1->v2: fixed missing "-f" option to rm, fixed grammar flub in commit message.

 Makefile.target |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Makefile.target +2 -2
index 550d889..6d60050 100644
@@ -193,8 +193,8 @@ qmp-commands-old.h: $(SRC_PATH)/qmp-commands.hx
 	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
 
 clean:
-	rm -f *.o *.a *~ $(PROGS) nwfpe/*.o fpu/*.o
-	rm -f *.d */*.d tcg/*.o ide/*.o 9pfs/*.o kvm/*.o
+	rm -f *.a *~ $(PROGS)
+	rm -f $(shell find . -name '*.[od]')
 	rm -f hmp-commands.h qmp-commands-old.h gdbstub-xml.c
 ifdef CONFIG_TRACE_SYSTEMTAP
 	rm -f *.stp
Signature · 1 line
1.7.1
#1 lore raw

This is v2, obviously -- I forgot to change the [PATCH] prefix :-(

-- PMM

Quoted 31 lines · Peter Maydell

Now we create object files in a hierarchy under hw/, so the 'clean' target must also be updated to delete those object files. Rather than using a manual list of subdirectories which will easily drift out of date, we just delete all .o and .d files in the target directory hierarchy.

---
v1->v2: fixed missing "-f" option to rm, fixed grammar flub in commit message.

 Makefile.target |    4 ++--

 1 files changed, 2 insertions(+), 2 deletions(-)
Makefile.target +0 -0
index 550d889..6d60050 100644
@@ -193,8 +193,8 @@ qmp-commands-old.h: $(SRC_PATH)/qmp-commands.hx
        $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
 

 clean:
-       rm -f *.o *.a *~ $(PROGS) nwfpe/*.o fpu/*.o
-       rm -f *.d */*.d tcg/*.o ide/*.o 9pfs/*.o kvm/*.o
+       rm -f *.a *~ $(PROGS)
+       rm -f $(shell find . -name '*.[od]')
       rm -f hmp-commands.h qmp-commands-old.h gdbstub-xml.c ifdef CONFIG_TRACE_SYSTEMTAP
       rm -f *.stp
--
1.7.1