path: root/Makefile
diff options
authorPawel Moll <>2012-10-29 11:23:02 +0000
committerMichal Marek <>2012-12-09 15:52:10 +0100
commitbd1ee804af8bdf2fd5131234330615f8aecbd9ed (patch)
treea267117270f2d2ec14947a465cc2b728ad5a7801 /Makefile
parentfc96b211bc6fa917bfb07a8db4cd898663e5f2c6 (diff)
kbuild: Do not remove vmlinux when cleaning external module
Since commit 1f2bfbd00e466ff3489b2ca5cc75b1cccd14c123 "kbuild: link of vmlinux moved to a script" make clean with M=<dir> argument (so cleaning external module) removes vmlinux, and couple of other files from the *main* kernel build directory! This not what was happening before and almost certainly not what one would expect. This patch moves makes the clean target of the script called only when !KBUILD_EXTMOD. Signed-off-by: Pawel Moll <> Cc: [v3.5+] Signed-off-by: Michal Marek <>
Diffstat (limited to 'Makefile')
1 files changed, 5 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 6744909b345f..4781b534873b 100644
--- a/Makefile
+++ b/Makefile
@@ -1008,11 +1008,14 @@ clean: rm-dirs := $(CLEAN_DIRS)
clean: rm-files := $(CLEAN_FILES)
clean-dirs := $(addprefix _clean_, . $(vmlinux-alldirs) Documentation samples)
-PHONY += $(clean-dirs) clean archclean
+PHONY += $(clean-dirs) clean archclean vmlinuxclean
$(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
-clean: archclean
+ $(Q)$(CONFIG_SHELL) $(srctree)/scripts/ clean
+clean: archclean vmlinuxclean
# mrproper - Delete all generated files, including .config
@@ -1239,7 +1242,6 @@ scripts: ;
clean: $(clean-dirs)
- $(Q)$(CONFIG_SHELL) $(srctree)/scripts/ clean
$(call cmd,rmdirs)
$(call cmd,rmfiles)