Skip to contentSkip to conversation

xen: Improvements to clean and distclean targets

PATCH In review Andrew Cooper 5 participants 10 messages Jan 18, 2016 – Jan 20, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen: Improvements to clean and distclean targets

* Move '*~' and 'core' into the find rule.
* Remove 'System.map' along with the other primary targets
* Remove include/config/ and include/generated/ on clean
* Remove .config.old in distclean

---
CC: Jan Beulich <[email protected]>

---
 xen/Makefile | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
xen/Makefile +4 -3
index 8b530c2..ff0d0d0 100644
@@ -106,14 +106,15 @@ _clean: delete-unfresh-files
 	$(MAKE) -f $(BASEDIR)/Rules.mk -C crypto clean
 	$(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) clean
 	$(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) SRCARCH=$(SRCARCH) clean
-	find . \( -name "*.o" -o -name ".*.d" \) -exec rm -f {} \;
-	rm -f include/asm $(TARGET) $(TARGET).gz $(TARGET).efi $(TARGET)-syms *~ core
+	find . \( -name "*.o" -o -name ".*.d" -o -name "*~" -o -name core \) -exec rm -f {} \;
+	rm -f include/asm $(TARGET) $(TARGET).gz $(TARGET).efi $(TARGET)-syms System.map
 	rm -f include/asm-*/asm-offsets.h
+	rm -rf include/config/ include/generated/
 	rm -f .banner
 
 .PHONY: _distclean
 _distclean: clean
-	rm -f tags TAGS cscope.files cscope.in.out cscope.out cscope.po.out GTAGS GPATH GRTAGS GSYMS .config
+	rm -f tags TAGS cscope.files cscope.in.out cscope.out cscope.po.out GTAGS GPATH GRTAGS GSYMS .config .config.old
 
 $(TARGET).gz: $(TARGET)
 	gzip -f -9 < $< > [email protected]
Signature · 1 line
2.1.4
#1 lore raw
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 18.01.16 at 17:27, <[email protected]> wrote:

* Move '*~' and 'core' into the find rule.

I don't understand this part: Where in the build process do such get generated? I'm tempted to instead recommend to just drop those from the rm invocation...

Quoted 3 lines

* Remove 'System.map' along with the other primary targets
* Remove include/config/ and include/generated/ on clean
* Remove .config.old in distclean

Everything else if fine with me.

Jan

#2 lore raw
Quoted 5 lines · Jan Beulich
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 18.01.16 at 17:27, <[email protected]> wrote:

* Move '*~' and 'core' into the find rule.

I don't understand this part: Where in the build process do such get generated? I'm tempted to instead recommend to just drop those from the rm invocation...

No idea about 'core' files, but *~ are emacs backup files.

Most clean rules do "rm *.o *.d *~ core" in the local directory, but there are some directories in the the public header area which don't get recursed into, and therefore missed.

~Andrew

#3 lore raw
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 18.01.16 at 17:45, <[email protected]> wrote:
Quoted 5 lines · Jan Beulich
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 18.01.16 at 17:27, <[email protected]> wrote:

* Move '*~' and 'core' into the find rule.

I don't understand this part: Where in the build process do such get generated? I'm tempted to instead recommend to just drop those from the rm invocation...

No idea about 'core' files, but *~ are emacs backup files.

But emacs should clean up after itself; this shouldn't be the job of our clean rule.

Quoted 3 lines

Most clean rules do "rm *.o *.d *~ core" in the local directory, but there are some directories in the the public header area which don't get recursed into, and therefore missed.

Well - the same holds here than: I'd rather remove those than extend the bogus use.

Jan

#4 lore raw
Quoted 10 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 18.01.16 at 17:45, <[email protected]> wrote:
Quoted 5 lines · Jan Beulich
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 18.01.16 at 17:27, <[email protected]> wrote:

* Move '*~' and 'core' into the find rule.

I don't understand this part: Where in the build process do such get generated? I'm tempted to instead recommend to just drop those from the rm invocation...

No idea about 'core' files, but *~ are emacs backup files.

But emacs should clean up after itself; this shouldn't be the job of our clean rule.

Why? the point is to have a one-revision old version of the file to hand.

Quoted 6 lines
Quoted 4 lines

Most clean rules do "rm *.o *.d *~ core" in the local directory, but there are some directories in the the public header area which don't get recursed into, and therefore missed.

Well - the same holds here than: I'd rather remove those than extend the bogus use.

Bogus is a matter of opinion, and there are a lot of emacs users (myself included) who will disagree with you here.

~Andrew

#5 lore raw
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 18.01.16 at 19:19, <[email protected]> wrote:
Quoted 4 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 18.01.16 at 17:45, <[email protected]> wrote:
Quoted 2 lines · Jan Beulich
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 18.01.16 at 17:27, <[email protected]> wrote:

* Move '*~' and 'core' into the find rule.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 3 lines

I don't understand this part: Where in the build process do such get generated? I'm tempted to instead recommend to just drop those from the rm invocation...

No idea about 'core' files, but *~ are emacs backup files.

But emacs should clean up after itself; this shouldn't be the job of our clean rule.

Why? the point is to have a one-revision old version of the file to hand.

I guess there may be different strategies here: My editor also creates such named files, but deletes them as the program gets shut down. I.e. the one-revision old backup exists as long as the program is running. I can see benefits from the alternative model, but still it shouldn't be our scripts to clean up such backups. After all - what if another program used another name patter for its backups? Would we go clean those up then too?

Jan

#6 lore raw
Quoted 17 lines · Jan Beulich
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 18.01.16 at 19:19, <[email protected]> wrote:
Quoted 8 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 18.01.16 at 17:45, <[email protected]> wrote:
Quoted 6 lines · Jan Beulich
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 18.01.16 at 17:27, <[email protected]> wrote:

* Move '*~' and 'core' into the find rule.

I don't understand this part: Where in the build process do such get
generated? I'm tempted to instead recommend to just drop those from the rm invocation...

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

No idea about 'core' files, but *~ are emacs backup files.

But emacs should clean up after itself; this shouldn't be the job of our clean rule.

Why? the point is to have a one-revision old version of the file to hand.

Quoted 7 lines

I guess there may be different strategies here: My editor also creates such named files, but deletes them as the program gets shut down. I.e. the one-revision old backup exists as long as the program is running. I can see benefits from the alternative model, but still it shouldn't be our scripts to clean up such backups. After all - what if another program used another name patter for its backups? Would we go clean those up then too?

IMHO these files should be in .gitignore (so they don't clutter "git status", AFAICT this is already done correctly) but it's not really necessary for "make clean" (or distclean) to get rid of them, that's up to either the editor or the user. IOW I'd be happy removing the existing rules.

Removing "core" is even odder -- it implies people have been running segfaulting binaries directory out of the source tree, which is a little odd for tools/* but very odd for xen/*. I suppose one could argue that if some host binary run by the build system segfaults (and causes a build failure) that make clean ought to clean it up, that's a very edge case IMHO and, if arguing for doing it at all, would argue either for only doing "rm core" in directories which have such host build tools or doing it in a central/common location, but not spread around every subdirectory on the off chance there might be such a segfaulting binary in the future.

Quoted 9 lines

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#7 lore raw
Quoted 26 lines · Ian Campbell
Quoted 17 lines · Jan Beulich
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 18.01.16 at 19:19, <[email protected]> wrote:
Quoted 8 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 18.01.16 at 17:45, <[email protected]> wrote:
Quoted 6 lines · Jan Beulich
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 18.01.16 at 17:27, <[email protected]> wrote:

* Move '*~' and 'core' into the find rule.

I don't understand this part: Where in the build process do such get
generated? I'm tempted to instead recommend to just drop those from the rm invocation...

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

No idea about 'core' files, but *~ are emacs backup files.

But emacs should clean up after itself; this shouldn't be the job of our clean rule.

Why? the point is to have a one-revision old version of the file to hand.

Quoted 7 lines

I guess there may be different strategies here: My editor also creates such named files, but deletes them as the program gets shut down. I.e. the one-revision old backup exists as long as the program is running. I can see benefits from the alternative model, but still it shouldn't be our scripts to clean up such backups. After all - what if another program used another name patter for its backups? Would we go clean those up then too?

Quoted 5 lines

IMHO these files should be in .gitignore (so they don't clutter "git status", AFAICT this is already done correctly) but it's not really necessary for "make clean" (or distclean) to get rid of them, that's up to either the editor or the user. IOW I'd be happy removing the existing rules.

What about adding a "make gitclean" which will remove all files ignored by git? It could use .gitignore (or even "git clean -dffq"). This way "make [dist]clean" could be limited to the files created by the build process on purpose.

Juergen

#8 lore raw
Quoted 38 lines · Juergen Gross
Quoted 30 lines · Ian Campbell
Quoted 20 lines · Jan Beulich
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 18.01.16 at 19:19, <[email protected]> wrote:
Quoted 11 lines · Jan Beulich
Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 18.01.16 at 17:45, <[email protected]> wrote:
Quoted 9 lines · Jan Beulich
Quoted 3 lines
Quoted 2 lines
Quoted 2 lines

On 18.01.16 at 17:27, <[email protected]>
wrote:

* Move '*~' and 'core' into the find rule.

I don't understand this part: Where in the build process do such
get
generated? I'm tempted to instead recommend to just drop those
from the rm invocation...

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

No idea about 'core' files, but *~ are emacs backup files.

But emacs should clean up after itself; this shouldn't be the job of our clean rule.

Why? the point is to have a one-revision old version of the file to hand.

Quoted 8 lines

I guess there may be different strategies here: My editor also creates such named files, but deletes them as the program gets shut down. I.e. the one-revision old backup exists as long as the program is running. I can see benefits from the alternative model, but still it shouldn't be our scripts to clean up such backups.
After all - what if another program used another name patter for its backups? Would we go clean those up then too?

Quoted 6 lines

IMHO these files should be in .gitignore (so they don't clutter "git status", AFAICT this is already done correctly) but it's not really necessary for "make clean" (or distclean) to get rid of them, that's up to
either the editor or the user. IOW I'd be happy removing the existing rules.

Quoted 4 lines

What about adding a "make gitclean" which will remove all files ignored by git? It could use .gitignore (or even "git clean -dffq"). This way "make [dist]clean" could be limited to the files created by the build process on purpose.

IMHO people should just use "git clean" in whichever way suits them if this is they want.

Ian.

#9 lore raw
In reply to Ian Campbell
Quoted 26 lines · Ian Campbell
Quoted 17 lines · Jan Beulich
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 18.01.16 at 19:19, <[email protected]> wrote:
Quoted 8 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 18.01.16 at 17:45, <[email protected]> wrote:
Quoted 6 lines · Jan Beulich
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 18.01.16 at 17:27, <[email protected]> wrote:

* Move '*~' and 'core' into the find rule.

I don't understand this part: Where in the build process do such get
generated? I'm tempted to instead recommend to just drop those from the rm invocation...

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

No idea about 'core' files, but *~ are emacs backup files.

But emacs should clean up after itself; this shouldn't be the job of our clean rule.

Why? the point is to have a one-revision old version of the file to hand.

Quoted 7 lines

I guess there may be different strategies here: My editor also creates such named files, but deletes them as the program gets shut down. I.e. the one-revision old backup exists as long as the program is running. I can see benefits from the alternative model, but still it shouldn't be our scripts to clean up such backups. After all - what if another program used another name patter for its backups? Would we go clean those up then too?

Quoted 5 lines

IMHO these files should be in .gitignore (so they don't clutter "git status", AFAICT this is already done correctly) but it's not really necessary for "make clean" (or distclean) to get rid of them, that's up to either the editor or the user. IOW I'd be happy removing the existing rules.

As an emacs user, I agree with this. The purpose of "make clean" IMO is be to make sure that the *build* operates cleanly (i.e., doesn't end up using any output generated from a previous build), not to get rid of extraneous random files that don't affect the build. "git clean" is the proper tool for cleaning out the tree for git commands.

-George