linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masahiro Yamada <yamada.masahiro@socionext.com>
To: linux-kbuild@vger.kernel.org
Cc: Christoph Hellwig <hch@lst.de>, Sam Ravnborg <sam@ravnborg.org>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	Michal Marek <michal.lkml@markovi.net>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 09/11] kbuild: unify clean-dirs rule for in-kernel and external module
Date: Sun, 11 Aug 2019 00:53:05 +0900	[thread overview]
Message-ID: <20190810155307.29322-10-yamada.masahiro@socionext.com> (raw)
In-Reply-To: <20190810155307.29322-1-yamada.masahiro@socionext.com>

Factor out the duplicated code for in-kernel and external module
cleaning.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 Makefile | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile
index e60c09d57b30..871c42e241a6 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)
-- 
2.17.1


  parent reply	other threads:[~2019-08-10 15:55 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-10 15:52 [PATCH 00/11] kbuild: clean-ups and improvement of single targets Masahiro Yamada
2019-08-10 15:52 ` [PATCH 01/11] kbuild: move the Module.symvers check for external module build Masahiro Yamada
2019-08-10 15:52 ` [PATCH 02/11] kbuild: refactor part-of-module more Masahiro Yamada
2019-08-10 15:52 ` [PATCH 03/11] kbuild: fix modkern_aflags implementation Masahiro Yamada
2019-08-10 15:53 ` [PATCH 04/11] kbuild: remove 'make /' support Masahiro Yamada
2019-08-10 15:53 ` [PATCH 05/11] kbuild: remove meaningless 'targets' in ./Kbuild Masahiro Yamada
2019-08-10 15:53 ` [PATCH 06/11] kbuild: do not descend to ./Kbuild when cleaning Masahiro Yamada
2019-08-10 15:53 ` [PATCH 07/11] kbuild: unset variables in top Makefile instead of setting 0 Masahiro Yamada
2019-08-10 15:53 ` [PATCH 08/11] kbuild: unify vmlinux-dirs and module-dirs rules Masahiro Yamada
2019-08-10 15:53 ` Masahiro Yamada [this message]
2019-08-10 15:53 ` [PATCH 10/11] kbuild: make single targets work more correctly Masahiro Yamada
2019-08-10 15:53 ` [PATCH 11/11] treewide: remove dummy Makefiles for single targets Masahiro Yamada
2019-08-11  9:55   ` Leon Romanovsky
2019-08-19 14:52 ` [PATCH 00/11] kbuild: clean-ups and improvement of " Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190810155307.29322-10-yamada.masahiro@socionext.com \
    --to=yamada.masahiro@socionext.com \
    --cc=hch@lst.de \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=sam@ravnborg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).