@@ -1017,6 +1017,7 @@ vmlinux-alldirs := $(sort $(vmlinux-dirs) Documentation \
10171017 $(drivers- ) $(net- ) $(libs- ) $(virt- ) ) ) )
10181018
10191019build-dirs := $(vmlinux-dirs )
1020+ clean-dirs := $(vmlinux-alldirs )
10201021
10211022init-y := $(patsubst % /, % /built-in.a, $(init-y ) )
10221023core-y := $(patsubst % /, % /built-in.a, $(core-y ) )
@@ -1388,11 +1389,8 @@ DISTCLEAN_FILES += tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS
13881389#
13891390clean : rm-dirs := $(CLEAN_DIRS )
13901391clean : rm-files := $(CLEAN_FILES )
1391- clean-dirs := $(addprefix _clean_, $(vmlinux-alldirs ) )
13921392
1393- PHONY += $(clean-dirs ) clean archclean vmlinuxclean
1394- $(clean-dirs ) :
1395- $(Q )$(MAKE ) $(clean ) =$(patsubst _clean_% ,% ,$@ )
1393+ PHONY += archclean vmlinuxclean
13961394
13971395vmlinuxclean :
13981396 $(Q )$(CONFIG_SHELL ) $(srctree ) /scripts/link-vmlinux.sh clean
@@ -1629,12 +1627,7 @@ PHONY += _emodinst_post
16291627_emodinst_post : _emodinst_
16301628 $(call cmd,depmod)
16311629
1632- clean-dirs := $(addprefix _clean_,$(KBUILD_EXTMOD ) )
1633-
1634- PHONY += $(clean-dirs ) clean
1635- $(clean-dirs ) :
1636- $(Q )$(MAKE ) $(clean ) =$(patsubst _clean_% ,% ,$@ )
1637-
1630+ clean-dirs := $(KBUILD_EXTMOD )
16381631clean : rm-files := $(KBUILD_EXTMOD ) /Module.symvers
16391632
16401633PHONY += /
@@ -1664,6 +1657,11 @@ descend: $(build-dirs)
16641657$(build-dirs ) : prepare
16651658 $(Q )$(MAKE ) $(build ) =$@ need-builtin=1 need-modorder=1
16661659
1660+ clean-dirs := $(addprefix _clean_, $(clean-dirs ) )
1661+ PHONY += $(clean-dirs ) clean
1662+ $(clean-dirs ) :
1663+ $(Q )$(MAKE ) $(clean ) =$(patsubst _clean_% ,% ,$@ )
1664+
16671665clean : $(clean-dirs )
16681666 $(call cmd,rmdirs)
16691667 $(call cmd,rmfiles)
0 commit comments