diff options
-rw-r--r-- | Documentation/kbuild/makefiles.txt | 7 | ||||
-rw-r--r-- | Kbuild | 4 | ||||
-rw-r--r-- | Makefile | 33 | ||||
-rw-r--r-- | scripts/Makefile.clean | 2 |
4 files changed, 24 insertions, 22 deletions
diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt index 5c878cc6c0b4..c899192b37bb 100644 --- a/Documentation/kbuild/makefiles.txt +++ b/Documentation/kbuild/makefiles.txt | |||
@@ -779,6 +779,13 @@ This will delete the directory debian, including all subdirectories. | |||
779 | Kbuild will assume the directories to be in the same relative path as the | 779 | Kbuild will assume the directories to be in the same relative path as the |
780 | Makefile if no absolute path is specified (path does not start with '/'). | 780 | Makefile if no absolute path is specified (path does not start with '/'). |
781 | 781 | ||
782 | To exclude certain files from make clean, use the $(no-clean-files) variable. | ||
783 | This is only a special case used in the top level Kbuild file: | ||
784 | |||
785 | Example: | ||
786 | #Kbuild | ||
787 | no-clean-files := $(bounds-file) $(offsets-file) | ||
788 | |||
782 | Usually kbuild descends down in subdirectories due to "obj-* := dir/", | 789 | Usually kbuild descends down in subdirectories due to "obj-* := dir/", |
783 | but in the architecture makefiles where the kbuild infrastructure | 790 | but in the architecture makefiles where the kbuild infrastructure |
784 | is not sufficient this sometimes needs to be explicit. | 791 | is not sufficient this sometimes needs to be explicit. |
@@ -94,5 +94,5 @@ PHONY += missing-syscalls | |||
94 | missing-syscalls: scripts/checksyscalls.sh FORCE | 94 | missing-syscalls: scripts/checksyscalls.sh FORCE |
95 | $(call cmd,syscalls) | 95 | $(call cmd,syscalls) |
96 | 96 | ||
97 | # Delete all targets during make clean | 97 | # Keep these two files during make clean |
98 | clean-files := $(addprefix $(objtree)/,$(filter-out $(bounds-file) $(offsets-file),$(targets))) | 98 | no-clean-files := $(bounds-file) $(offsets-file) |
@@ -1119,21 +1119,13 @@ MRPROPER_FILES += .config .config.old .version .old_version \ | |||
1119 | # | 1119 | # |
1120 | clean: rm-dirs := $(CLEAN_DIRS) | 1120 | clean: rm-dirs := $(CLEAN_DIRS) |
1121 | clean: rm-files := $(CLEAN_FILES) | 1121 | clean: rm-files := $(CLEAN_FILES) |
1122 | clean-dirs := $(addprefix _clean_,$(srctree) $(vmlinux-alldirs) Documentation) | 1122 | clean-dirs := $(addprefix _clean_, . $(vmlinux-alldirs) Documentation) |
1123 | 1123 | ||
1124 | PHONY += $(clean-dirs) clean archclean | 1124 | PHONY += $(clean-dirs) clean archclean |
1125 | $(clean-dirs): | 1125 | $(clean-dirs): |
1126 | $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@) | 1126 | $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@) |
1127 | 1127 | ||
1128 | clean: archclean $(clean-dirs) | 1128 | clean: archclean |
1129 | $(call cmd,rmdirs) | ||
1130 | $(call cmd,rmfiles) | ||
1131 | @find . $(RCS_FIND_IGNORE) \ | ||
1132 | \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ | ||
1133 | -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ | ||
1134 | -o -name '*.symtypes' -o -name 'modules.order' \ | ||
1135 | -o -name modules.builtin -o -name '.tmp_*.o.*' \ | ||
1136 | -o -name '*.gcno' \) -type f -print | xargs rm -f | ||
1137 | 1129 | ||
1138 | # mrproper - Delete all generated files, including .config | 1130 | # mrproper - Delete all generated files, including .config |
1139 | # | 1131 | # |
@@ -1331,16 +1323,7 @@ $(clean-dirs): | |||
1331 | $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@) | 1323 | $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@) |
1332 | 1324 | ||
1333 | clean: rm-dirs := $(MODVERDIR) | 1325 | clean: rm-dirs := $(MODVERDIR) |
1334 | clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers \ | 1326 | clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers |
1335 | $(KBUILD_EXTMOD)/modules.order \ | ||
1336 | $(KBUILD_EXTMOD)/modules.builtin | ||
1337 | clean: $(clean-dirs) | ||
1338 | $(call cmd,rmdirs) | ||
1339 | $(call cmd,rmfiles) | ||
1340 | @find $(KBUILD_EXTMOD) $(RCS_FIND_IGNORE) \ | ||
1341 | \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ | ||
1342 | -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ | ||
1343 | -o -name '*.gcno' \) -type f -print | xargs rm -f | ||
1344 | 1327 | ||
1345 | help: | 1328 | help: |
1346 | @echo ' Building external modules.' | 1329 | @echo ' Building external modules.' |
@@ -1357,6 +1340,16 @@ prepare: ; | |||
1357 | scripts: ; | 1340 | scripts: ; |
1358 | endif # KBUILD_EXTMOD | 1341 | endif # KBUILD_EXTMOD |
1359 | 1342 | ||
1343 | clean: $(clean-dirs) | ||
1344 | $(call cmd,rmdirs) | ||
1345 | $(call cmd,rmfiles) | ||
1346 | @find $(or $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \ | ||
1347 | \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ | ||
1348 | -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ | ||
1349 | -o -name '*.symtypes' -o -name 'modules.order' \ | ||
1350 | -o -name modules.builtin -o -name '.tmp_*.o.*' \ | ||
1351 | -o -name '*.gcno' \) -type f -print | xargs rm -f | ||
1352 | |||
1360 | # Generate tags for editors | 1353 | # Generate tags for editors |
1361 | # --------------------------------------------------------------------------- | 1354 | # --------------------------------------------------------------------------- |
1362 | quiet_cmd_tags = GEN $@ | 1355 | quiet_cmd_tags = GEN $@ |
diff --git a/scripts/Makefile.clean b/scripts/Makefile.clean index 6f89fbb56256..686cb0d31c7c 100644 --- a/scripts/Makefile.clean +++ b/scripts/Makefile.clean | |||
@@ -45,6 +45,8 @@ __clean-files := $(extra-y) $(always) \ | |||
45 | $(host-progs) \ | 45 | $(host-progs) \ |
46 | $(hostprogs-y) $(hostprogs-m) $(hostprogs-) | 46 | $(hostprogs-y) $(hostprogs-m) $(hostprogs-) |
47 | 47 | ||
48 | __clean-files := $(filter-out $(no-clean-files), $(__clean-files)) | ||
49 | |||
48 | # as clean-files is given relative to the current directory, this adds | 50 | # as clean-files is given relative to the current directory, this adds |
49 | # a $(obj) prefix, except for absolute paths | 51 | # a $(obj) prefix, except for absolute paths |
50 | 52 | ||