Skip to contentSkip to conversation

'make distclean' silently removes empty files

PATCH New David Howells 3 participants 3 messages Jul 28, 2011 – Aug 10, 2011 Kbuild

lore
Share & tools
lore
#0 lore raw

Hi,

Can 'make distclean' please be altered to _not_ silently remove empty files, especially ones that are checked into GIT and/or are mentioned in Makefiles as being compilable. By all means flag them as requiring removal, remove them noisily or give an error.

A case in point is:

arch/arm/mach-zynq/board_dt.c

which is an empty file checked into GIT.

Thanks,
David

#1 lore raw

Hi,

Quoted 8 lines · David Howells

Hi,

Can 'make distclean' please be altered to _not_ silently remove empty files, especially ones that are checked into GIT and/or are mentioned in Makefiles as being compilable.  By all means flag them as requiring removal, remove them noisily or give an error.

Quoted 6 lines

A case in point is:

       arch/arm/mach-zynq/board_dt.c

which is an empty file checked into GIT.

For the record, it is deleted because of the zero size by:

distclean: mrproper

        @find $(srctree) $(RCS_FIND_IGNORE) \
                \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
                -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
                -o -name '.*.rej' -o -size 0 \
                -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \
                -type f -print | xargs rm -f

in the main makefile.

Could you try:

commit a73f6c8638a75d1bf1bb8b0ace82ddd3b9f0291b

Author: Arnaud Lacombe <[email protected]>
Date:   Thu Jul 28 10:00:33 2011 -0400

Makefile: do not delete zero-sized C file

Makefile +1 -1
index d018956..e9ca6ec 100644
@@ -1198,7 +1198,7 @@ distclean: mrproper
        @find $(srctree) $(RCS_FIND_IGNORE) \
                \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
                -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
-               -o -name '.*.rej' -o -size 0 \
+               -o -name '.*.rej' -o \( -size 0 -a ! -name '*.c' \) \
                -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \
                -type f -print | xargs rm -f
 

[space/tab mangled, but the change is obvious]

- Arnaud

Quoted 7 lines

Thanks,
David
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

#2 lore raw

PATCH 1/1 kbuild: Do not delete empty files in make distclean

In reply to David Howells

Commit 3d64b44 introduced an empty file under arch/arm/mach-zynq/board_dt.c. While this was not intended and the file was removed from the tree by a later commit, we really should only match junk files by known name patterns and not their size.

---
 Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Makefile +1 -1
index b4ca4e1..d714838 100644
@@ -1198,7 +1198,7 @@ distclean: mrproper
 	@find $(srctree) $(RCS_FIND_IGNORE) \
 		\( -name '*.orig' -o -name '*.rej' -o -name '*~' \
 		-o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
-		-o -name '.*.rej' -o -size 0 \
+		-o -name '.*.rej' \
 		-o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \
 		-type f -print | xargs rm -f
 
Signature · 1 line
1.7.6