summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2019-08-11 00:53:05 +0900
committerMasahiro Yamada <yamada.masahiro@socionext.com>2019-08-21 21:05:21 +0900
commit76cd306d797923aabcf373289b231bf8d9a9340a (patch)
tree2cd40a33a105c9f13057000409904a49f221958d
parentc99f3918cf0a64b99ac145591c7984891c64baa4 (diff)
downloadlinux-stable-76cd306d797923aabcf373289b231bf8d9a9340a.tar.gz
linux-stable-76cd306d797923aabcf373289b231bf8d9a9340a.tar.bz2
linux-stable-76cd306d797923aabcf373289b231bf8d9a9340a.zip
kbuild: unify clean-dirs rule for in-kernel and external module
Factor out the duplicated code for in-kernel and external module cleaning. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
-rw-r--r--Makefile18
1 files changed, 8 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index b68954827dd0..9661fa37158f 100644
--- a/Makefile
+++ b/Makefile
@@ -1017,6 +1017,7 @@ vmlinux-alldirs := $(sort $(vmlinux-dirs) Documentation \
$(drivers-) $(net-) $(libs-) $(virt-))))
build-dirs := $(vmlinux-dirs)
+clean-dirs := $(vmlinux-alldirs)
init-y := $(patsubst %/, %/built-in.a, $(init-y))
core-y := $(patsubst %/, %/built-in.a, $(core-y))
@@ -1388,11 +1389,8 @@ DISTCLEAN_FILES += tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS
#
clean: rm-dirs := $(CLEAN_DIRS)
clean: rm-files := $(CLEAN_FILES)
-clean-dirs := $(addprefix _clean_, $(vmlinux-alldirs))
-PHONY += $(clean-dirs) clean archclean vmlinuxclean
-$(clean-dirs):
- $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
+PHONY += archclean vmlinuxclean
vmlinuxclean:
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/link-vmlinux.sh clean
@@ -1629,12 +1627,7 @@ PHONY += _emodinst_post
_emodinst_post: _emodinst_
$(call cmd,depmod)
-clean-dirs := $(addprefix _clean_,$(KBUILD_EXTMOD))
-
-PHONY += $(clean-dirs) clean
-$(clean-dirs):
- $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
-
+clean-dirs := $(KBUILD_EXTMOD)
clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers
PHONY += /
@@ -1664,6 +1657,11 @@ descend: $(build-dirs)
$(build-dirs): prepare
$(Q)$(MAKE) $(build)=$@ need-builtin=1 need-modorder=1
+clean-dirs := $(addprefix _clean_, $(clean-dirs))
+PHONY += $(clean-dirs) clean
+$(clean-dirs):
+ $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
+
clean: $(clean-dirs)
$(call cmd,rmdirs)
$(call cmd,rmfiles)