Commit 0c8846a5 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] kbuild: Cause `make clean' to remove more files

From: Sam Ravnborg <sam@ravnborg.org>

Make the difference between 'make clean' and 'make distclean/mrproper' more
explicit.

make clean now removes all generated files except .config* and .version.
The result is much easier to understand now.

make clean deletes all generated files (except .config* and .version).
make mrproper deletes configuration and all temporary files left by patch,
editors and the like.

Example output:
> make mrproper
  CLEAN   init
  CLEAN   usr
  CLEAN   scripts/kconfig
  CLEAN   scripts
  CLEAN   .tmp_versions include/config
  CLEAN   include/asm-i386/asm_offsets.h include/linux/autoconf.h include/linux/version.h include/asm .tmp_versions
  CLEAN   .version .config

Form the list of files/directories deleted during make clean, removed all
references that is no longer relevant for the current kernel.
parent 22a5dad8
...@@ -757,26 +757,15 @@ endef ...@@ -757,26 +757,15 @@ endef
# Any core files spread around are deleted as well # Any core files spread around are deleted as well
# make distclean Remove editor backup files, patch leftover files and the like # make distclean Remove editor backup files, patch leftover files and the like
# Files removed with 'make clean' # Directories & files removed with 'make clean'
CLEAN_FILES += vmlinux System.map MC* CLEAN_DIRS += $(MODVERDIR) include/config include2
CLEAN_FILES += vmlinux System.map \
include/linux/autoconf.h include/linux/version.h \
include/asm include/linux/modversions.h \
kernel.spec .tmp*
# Files removed with 'make mrproper' # Files removed with 'make mrproper'
MRPROPER_FILES += \ MRPROPER_FILES += .version .config .config.old tags TAGS cscope*
include/linux/autoconf.h include/linux/version.h \
.version .config .config.old config.in config.old \
.menuconfig.log \
include/asm \
.hdepend include/linux/modversions.h \
tags TAGS cscope* kernel.spec \
.tmp*
# Directories removed with 'make mrproper'
MRPROPER_DIRS += \
$(MODVERDIR) \
.tmp_export-objs \
include/config \
include/linux/modules \
include2
# clean - Delete all intermediate files # clean - Delete all intermediate files
# #
...@@ -785,28 +774,36 @@ clean-dirs += $(addprefix _clean_,$(ALL_SUBDIRS) Documentation/DocBook scripts) ...@@ -785,28 +774,36 @@ clean-dirs += $(addprefix _clean_,$(ALL_SUBDIRS) Documentation/DocBook scripts)
$(clean-dirs): $(clean-dirs):
$(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@) $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
quiet_cmd_rmclean = RM $$(CLEAN_FILES) clean: rm-dirs := $(wildcard $(CLEAN_DIRS))
cmd_rmclean = rm -f $(CLEAN_FILES) mrproper: rm-dirs := $(wildcard $(MRPROPER_DIRS))
quiet_cmd_rmdirs = $(if $(rm-dirs),CLEAN $(rm-dirs))
cmd_rmdirs = rm -rf $(rm-dirs)
clean: rm-files := $(wildcard $(CLEAN_FILES))
mrproper: rm-files := $(wildcard $(MRPROPER_FILES))
quiet_cmd_rmfiles = $(if $(rm-files),CLEAN $(rm-files))
cmd_rmfiles = rm -rf $(rm-files)
clean: archclean $(clean-dirs) clean: archclean $(clean-dirs)
$(call cmd,rmclean) $(call cmd,rmdirs)
$(call cmd,rmfiles)
@find . $(RCS_FIND_IGNORE) \ @find . $(RCS_FIND_IGNORE) \
\( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \) \ -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \) \
-type f -print | xargs rm -f -type f -print | xargs rm -f
# mrproper - delete configuration + modules + core files # mrproper
# #
quiet_cmd_mrproper = RM $$(MRPROPER_DIRS) + $$(MRPROPER_FILES) distclean: mrproper
cmd_mrproper = rm -rf $(MRPROPER_DIRS) && rm -f $(MRPROPER_FILES) mrproper: clean archmrproper
mrproper distclean: clean archmrproper $(call cmd,rmdirs)
@echo ' Making $@ in the srctree' $(call cmd,rmfiles)
@find . $(RCS_FIND_IGNORE) \ @find . $(RCS_FIND_IGNORE) \
\( -name '*.orig' -o -name '*.rej' -o -name '*~' \ \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
-o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \ -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
-o -name '.*.rej' -o -size 0 \ -o -name '.*.rej' -o -size 0 \
-o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \ -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \
-type f -print | xargs rm -f -type f -print | xargs rm -f
$(call cmd,mrproper)
# Generate tags for editors # Generate tags for editors
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment