Skip to content

Commit 76cd306

Browse files
committed
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>
1 parent c99f391 commit 76cd306

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

‎Makefile‎

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,6 +1017,7 @@ vmlinux-alldirs := $(sort $(vmlinux-dirs) Documentation \
10171017
$(drivers-) $(net-) $(libs-) $(virt-))))
10181018

10191019
build-dirs := $(vmlinux-dirs)
1020+
clean-dirs := $(vmlinux-alldirs)
10201021

10211022
init-y := $(patsubst %/, %/built-in.a, $(init-y))
10221023
core-y := $(patsubst %/, %/built-in.a, $(core-y))
@@ -1388,11 +1389,8 @@ DISTCLEAN_FILES += tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS
13881389
#
13891390
clean: rm-dirs := $(CLEAN_DIRS)
13901391
clean: 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

13971395
vmlinuxclean:
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)
16381631
clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers
16391632

16401633
PHONY += /
@@ -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+
16671665
clean: $(clean-dirs)
16681666
$(call cmd,rmdirs)
16691667
$(call cmd,rmfiles)

0 commit comments

Comments
 (0)