build: fix clean to remove all .o and .d files
PATCH v2 1/1 build: fix clean to remove all .o and .d files
In commit 8b6ef9c152edceabecc7f90c811cd538a7b7a110, several files in xen/common/compat were changed to be built using the Makefile in xen/common, by appending the compat prefix to the object files. Additionally, the xen/common/compat directory was removed from the subdirs-y variable, so it is no longer visited by the clean rule. This resulted in some object files and dependency files being generated by inclusion into obj-y, but not cleaned because they lived in a directory that was unvisited by the clean rules.
Since there is a desire for all of the object files and dependency files to be cleaned, just search for all objects and dependency files and delete them on clean. The previous method of only tracking with the $(DEPS) and *.o in the clean rules had the disadvantage that, if the configuration changed between a build and a clean, some of the dependencies or objects could get left behind. This method does not have the same disadvantage.
--- xen/Makefile | 3 ++- xen/Rules.mk | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
xen/Makefile +2 -1
@@ -91,7 +91,8 @@ _clean: delete-unfresh-files $(MAKE) -f $(BASEDIR)/Rules.mk -C xsm clean $(MAKE) -f $(BASEDIR)/Rules.mk -C crypto clean $(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) clean - rm -f include/asm *.o $(TARGET) $(TARGET).gz $(TARGET).efi $(TARGET)-syms *~ core $(DEPS) + find . \( -name "*.o" -o -name "*.d" \) -exec rm -f {} \; + rm -f include/asm $(TARGET) $(TARGET).gz $(TARGET).efi $(TARGET)-syms *~ core rm -f include/asm-*/asm-offsets.h rm -f .banner
xen/Rules.mk +1 -1
@@ -173,7 +173,7 @@ FORCE: .PHONY: clean clean:: $(addprefix _clean_, $(subdir-all)) - rm -f *.o *~ core $(DEPS) + rm -f *~ core _clean_%/: FORCE $(MAKE) -f $(BASEDIR)/Rules.mk -C $* clean
Signature · 1 line
2.6.2
xen/Makefile _clean: delete-unfresh-files · line 94
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 02.12.15 at 16:29, <[email protected]> wrote:
xen/Makefile +1
-1@@ -91,7 +91,8 @@ _clean: delete-unfresh-files $(MAKE) -f $(BASEDIR)/Rules.mk -C xsm clean $(MAKE) -f $(BASEDIR)/Rules.mk -C crypto clean $(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) clean - rm -f include/asm *.o $(TARGET) $(TARGET).gz $(TARGET).efi $(TARGET)-syms *~ core $(DEPS) + find . \( -name "*.o" -o -name "*.d" \) -exec rm -f {} \;
If you really meant *.d, then *.[od] would have done. But in fact I think we want to limit this to ".*.d". Which I could fix up while committing, but then I'm not sure ...
xen/Rules.mk FORCE: · line 176
Quoted 8 lines
xen/Rules.mk +1
-1@@ -173,7 +173,7 @@ FORCE: .PHONY: clean clean:: $(addprefix _clean_, $(subdir-all)) - rm -f *.o *~ core $(DEPS) + rm -f *~ core
... this is a good idea, as it's not clear to me whether "clean" actually works when invoked in sub-trees of xen/.
Jan
Quoted 16 lines · Jan Beulich
xen/Makefile _clean: delete-unfresh-files · line 94
Quoted 10 lines
Quoted 2 lines
Quoted 2 lines · On 02.12.15 at 16:29, <[email protected]> wrote:
xen/Makefile +1
-1@@ -91,7 +91,8 @@ _clean: delete-unfresh-files $(MAKE) -f $(BASEDIR)/Rules.mk -C xsm clean $(MAKE) -f $(BASEDIR)/Rules.mk -C crypto clean $(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) clean - rm -f include/asm *.o $(TARGET) $(TARGET).gz $(TARGET).efi $(TARGET)-syms *~ core $(DEPS) + find . \( -name "*.o" -o -name "*.d" \) -exec rm -f {} \;If you really meant *.d, then *.[od] would have done. But in fact I think we want to limit this to ".*.d". Which I could fix up while committing, but then I'm not sure …
Easy enough to change it to “.*.d”.
Quoted 5 lines
Quoted 5 lines
xen/Rules.mk +0
-0@@ -173,7 +173,7 @@ FORCE:
Quoted 7 lines
xen/Rules.mk FORCE: · line 176
Quoted 4 lines
.PHONY: clean
clean:: $(addprefix _clean_, $(subdir-all))xen/Rules.mk +1
-1- rm -f *.o *~ core $(DEPS) + rm -f *~ core... this is a good idea, as it's not clear to me whether "clean" actually works when invoked in sub-trees of xen/.
I can definitely take that bit out; I just didn’t see the point in replicating the removal of the files. Note that, whether I take it out or leave it in, “clean” still will not totally work when invoked in sub-trees of xen/ because *.o is still not enough to catch all of the object files (which was the whole point of this patch in the first place).
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 34 lines
Quoted 4 lines
Quoted 1 line · On 02.12.15 at 16:41, <[email protected]> wrote:
On Dec 2, 2015, at 9:36 AM, Jan Beulich <[email protected]> wrote:
Quoted 8 lines
xen/Makefile _clean: delete-unfresh-files · line 94
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 02.12.15 at 16:29, <[email protected]> wrote:
xen/Makefile +0
-1@@ -91,7 +91,8 @@ _clean: delete-unfresh-files $(MAKE) -f $(BASEDIR)/Rules.mk -C xsm clean $(MAKE) -f $(BASEDIR)/Rules.mk -C crypto clean $(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) clean - rm -f include/asm *.o $(TARGET) $(TARGET).gz $(TARGET).efi $(TARGET)-syms*~ core $(DEPS)
Quoted 5 lines
xen/Makefile _clean: delete-unfresh-files · line 94
Quoted 1 line
xen/Makefile +1
-0+ find . \( -name "*.o" -o -name "*.d" \) -exec rm -f {} \;If you really meant *.d, then *.[od] would have done. But in fact I think we want to limit this to ".*.d". Which I could fix up while committing, but then I'm not sure …
Easy enough to change it to “.*.d”.
Quoted 5 lines
Quoted 5 lines
xen/Rules.mk +0
-0@@ -173,7 +173,7 @@ FORCE:Quoted 7 lines
xen/Rules.mk FORCE: · line 176
Quoted 4 lines
.PHONY: clean
clean:: $(addprefix _clean_, $(subdir-all))xen/Rules.mk +1
-1- rm -f *.o *~ core $(DEPS) + rm -f *~ core... this is a good idea, as it's not clear to me whether "clean" actually works when invoked in sub-trees of xen/.
Quoted 5 lines
I can definitely take that bit out; I just didn’t see the point in replicating the removal of the files. Note that, whether I take it out or leave it in, “clean” still will not totally work when invoked in sub-trees of xen/ because *.o is still not enough to catch all of the object files (which was the whole point of this patch in the first place).
True, but let's not make matters worse. I'd be fine leaving this second change in only if we knew "clean" doesn't work at all when invoked against sub-trees of xen/.
And again - no reason to re-submit, I can easily tweak the patch upon commit, as long as you're fine with this being done with your S-o-b in place.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 43 lines · Jan Beulich
Quoted 35 lines
Quoted 5 lines
Quoted 2 lines · On 02.12.15 at 16:41, <[email protected]> wrote:
On Dec 2, 2015, at 9:36 AM, Jan Beulich <[email protected]> wrote:
Quoted 8 lines
xen/Makefile _clean: delete-unfresh-files · line 94
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 02.12.15 at 16:29, <[email protected]> wrote:
xen/Makefile +0
-1@@ -91,7 +91,8 @@ _clean: delete-unfresh-files $(MAKE) -f $(BASEDIR)/Rules.mk -C xsm clean $(MAKE) -f $(BASEDIR)/Rules.mk -C crypto clean $(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) clean - rm -f include/asm *.o $(TARGET) $(TARGET).gz $(TARGET).efi $(TARGET)-syms*~ core $(DEPS)
Quoted 5 lines
xen/Makefile _clean: delete-unfresh-files · line 94
Quoted 1 line
xen/Makefile +1
-0+ find . \( -name "*.o" -o -name "*.d" \) -exec rm -f {} \;If you really meant *.d, then *.[od] would have done. But in fact I think we want to limit this to ".*.d". Which I could fix up while committing, but then I'm not sure …
Easy enough to change it to “.*.d”.
Quoted 5 lines
Quoted 5 lines
xen/Rules.mk +0
-0@@ -173,7 +173,7 @@ FORCE:Quoted 7 lines
xen/Rules.mk FORCE: · line 176
Quoted 4 lines
.PHONY: clean
clean:: $(addprefix _clean_, $(subdir-all))xen/Rules.mk +1
-1- rm -f *.o *~ core $(DEPS) + rm -f *~ core... this is a good idea, as it's not clear to me whether "clean" actually works when invoked in sub-trees of xen/.
Quoted 5 lines
I can definitely take that bit out; I just didn’t see the point in replicating the removal of the files. Note that, whether I take it out or leave it in, “clean” still will not totally work when invoked in sub-trees of xen/ because *.o is still not enough to catch all of the object files (which was the whole point of this patch in the first place).
Quoted 8 lines
True, but let's not make matters worse. I'd be fine leaving this second change in only if we knew "clean" doesn't work at all when invoked against sub-trees of xen/.
And again - no reason to re-submit, I can easily tweak the patch upon commit, as long as you're fine with this being done with your S-o-b in place.
Yeah, that is fine.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel