public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] make clean fixes
@ 2010-09-06 11:48 Michal Marek
  2010-09-06 11:48 ` [PATCH 1/3] kbuild: Really don't clean bounds.h and asm-offsets.h Michal Marek
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Michal Marek @ 2010-09-06 11:48 UTC (permalink / raw)
  To: linux-kbuild; +Cc: linux-kernel

Two fixes and one cleanup of 'make clean'

Michal

Michal Marek (3):
  kbuild: Really don't clean bounds.h and asm-offsets.h
  kbuild: Do not run make clean in $(srctree)
  kbuild: Use a single clean rule for kernel and external modules

 Documentation/kbuild/makefiles.txt |    7 +++++++
 Kbuild                             |    4 ++--
 Makefile                           |   33 +++++++++++++--------------------
 scripts/Makefile.clean             |    2 ++
 4 files changed, 24 insertions(+), 22 deletions(-)


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] kbuild: Really don't clean bounds.h and asm-offsets.h
  2010-09-06 11:48 [PATCH 0/3] make clean fixes Michal Marek
@ 2010-09-06 11:48 ` Michal Marek
  2010-09-06 11:48 ` [PATCH 2/3] kbuild: Do not run make clean in $(srctree) Michal Marek
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Michal Marek @ 2010-09-06 11:48 UTC (permalink / raw)
  To: linux-kbuild; +Cc: linux-kernel

Commit 7d3cc8b tried to keep bounds.h and asm-offsets.h during make
clean by filtering these out of $(clean-files), but they are listed in
$(targets) and $(always) and thus removed automatically. Introduce a new
$(no-clean-files) variable to really skip such files in Makefile.clean.

Signed-off-by: Michal Marek <mmarek@suse.cz>
---
 Documentation/kbuild/makefiles.txt |    7 +++++++
 Kbuild                             |    4 ++--
 scripts/Makefile.clean             |    2 ++
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt
index 0135155..fcd1a98 100644
--- a/Documentation/kbuild/makefiles.txt
+++ b/Documentation/kbuild/makefiles.txt
@@ -779,6 +779,13 @@ This will delete the directory debian, including all subdirectories.
 Kbuild will assume the directories to be in the same relative path as the
 Makefile if no absolute path is specified (path does not start with '/').
 
+To exclude certain files from make clean, use the $(no-clean-files) variable.
+This is only a special case used in the top level Kbuild file:
+
+	Example:
+		#Kbuild
+		no-clean-files := $(bounds-file) $(offsets-file)
+
 Usually kbuild descends down in subdirectories due to "obj-* := dir/",
 but in the architecture makefiles where the kbuild infrastructure
 is not sufficient this sometimes needs to be explicit.
diff --git a/Kbuild b/Kbuild
index e3737ad..18a8bfb 100644
--- a/Kbuild
+++ b/Kbuild
@@ -94,5 +94,5 @@ PHONY += missing-syscalls
 missing-syscalls: scripts/checksyscalls.sh FORCE
 	$(call cmd,syscalls)
 
-# Delete all targets during make clean
-clean-files := $(addprefix $(objtree)/,$(filter-out $(bounds-file) $(offsets-file),$(targets)))
+# Keep these two files during make clean
+no-clean-files := $(bounds-file) $(offsets-file)
diff --git a/scripts/Makefile.clean b/scripts/Makefile.clean
index 6f89fbb..686cb0d 100644
--- a/scripts/Makefile.clean
+++ b/scripts/Makefile.clean
@@ -45,6 +45,8 @@ __clean-files	:= $(extra-y) $(always)                  \
 		   $(host-progs)                         \
 		   $(hostprogs-y) $(hostprogs-m) $(hostprogs-)
 
+__clean-files   := $(filter-out $(no-clean-files), $(__clean-files))
+
 # as clean-files is given relative to the current directory, this adds
 # a $(obj) prefix, except for absolute paths
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] kbuild: Do not run make clean in $(srctree)
  2010-09-06 11:48 [PATCH 0/3] make clean fixes Michal Marek
  2010-09-06 11:48 ` [PATCH 1/3] kbuild: Really don't clean bounds.h and asm-offsets.h Michal Marek
@ 2010-09-06 11:48 ` Michal Marek
  2010-09-06 11:48 ` [PATCH 3/3] kbuild: Use a single clean rule for kernel and external modules Michal Marek
  2010-09-13 15:24 ` [PATCH 0/3] make clean fixes Michal Marek
  3 siblings, 0 replies; 5+ messages in thread
From: Michal Marek @ 2010-09-06 11:48 UTC (permalink / raw)
  To: linux-kbuild; +Cc: linux-kernel

Signed-off-by: Michal Marek <mmarek@suse.cz>
---
 Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index b98943a..d71bfde 100644
--- a/Makefile
+++ b/Makefile
@@ -1180,7 +1180,7 @@ MRPROPER_FILES += .config .config.old .version .old_version             \
 #
 clean: rm-dirs  := $(CLEAN_DIRS)
 clean: rm-files := $(CLEAN_FILES)
-clean-dirs      := $(addprefix _clean_,$(srctree) $(vmlinux-alldirs) Documentation)
+clean-dirs      := $(addprefix _clean_, . $(vmlinux-alldirs) Documentation)
 
 PHONY += $(clean-dirs) clean archclean
 $(clean-dirs):
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] kbuild: Use a single clean rule for kernel and external modules
  2010-09-06 11:48 [PATCH 0/3] make clean fixes Michal Marek
  2010-09-06 11:48 ` [PATCH 1/3] kbuild: Really don't clean bounds.h and asm-offsets.h Michal Marek
  2010-09-06 11:48 ` [PATCH 2/3] kbuild: Do not run make clean in $(srctree) Michal Marek
@ 2010-09-06 11:48 ` Michal Marek
  2010-09-13 15:24 ` [PATCH 0/3] make clean fixes Michal Marek
  3 siblings, 0 replies; 5+ messages in thread
From: Michal Marek @ 2010-09-06 11:48 UTC (permalink / raw)
  To: linux-kbuild; +Cc: linux-kernel

The list of patterns for the external modules case was constantly
lagging behind.

Signed-off-by: Michal Marek <mmarek@suse.cz>
---
 Makefile |   31 ++++++++++++-------------------
 1 files changed, 12 insertions(+), 19 deletions(-)

diff --git a/Makefile b/Makefile
index d71bfde..414a646 100644
--- a/Makefile
+++ b/Makefile
@@ -1186,15 +1186,7 @@ PHONY += $(clean-dirs) clean archclean
 $(clean-dirs):
 	$(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
 
-clean: archclean $(clean-dirs)
-	$(call cmd,rmdirs)
-	$(call cmd,rmfiles)
-	@find . $(RCS_FIND_IGNORE) \
-		\( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
-		-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
-		-o -name '*.symtypes' -o -name 'modules.order' \
-		-o -name modules.builtin -o -name '.tmp_*.o.*' \
-		-o -name '*.gcno' \) -type f -print | xargs rm -f
+clean: archclean
 
 # mrproper - Delete all generated files, including .config
 #
@@ -1392,16 +1384,7 @@ $(clean-dirs):
 	$(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
 
 clean:	rm-dirs := $(MODVERDIR)
-clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers \
-                   $(KBUILD_EXTMOD)/modules.order \
-                   $(KBUILD_EXTMOD)/modules.builtin
-clean: $(clean-dirs)
-	$(call cmd,rmdirs)
-	$(call cmd,rmfiles)
-	@find $(KBUILD_EXTMOD) $(RCS_FIND_IGNORE) \
-		\( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
-		-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
-		-o -name '*.gcno' \) -type f -print | xargs rm -f
+clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers
 
 help:
 	@echo  '  Building external modules.'
@@ -1418,6 +1401,16 @@ prepare: ;
 scripts: ;
 endif # KBUILD_EXTMOD
 
+clean: $(clean-dirs)
+	$(call cmd,rmdirs)
+	$(call cmd,rmfiles)
+	@find $(or $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \
+		\( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
+		-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
+		-o -name '*.symtypes' -o -name 'modules.order' \
+		-o -name modules.builtin -o -name '.tmp_*.o.*' \
+		-o -name '*.gcno' \) -type f -print | xargs rm -f
+
 # Generate tags for editors
 # ---------------------------------------------------------------------------
 quiet_cmd_tags = GEN     $@
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/3] make clean fixes
  2010-09-06 11:48 [PATCH 0/3] make clean fixes Michal Marek
                   ` (2 preceding siblings ...)
  2010-09-06 11:48 ` [PATCH 3/3] kbuild: Use a single clean rule for kernel and external modules Michal Marek
@ 2010-09-13 15:24 ` Michal Marek
  3 siblings, 0 replies; 5+ messages in thread
From: Michal Marek @ 2010-09-13 15:24 UTC (permalink / raw)
  To: linux-kbuild; +Cc: linux-kernel

On 6.9.2010 13:48, Michal Marek wrote:
> Two fixes and one cleanup of 'make clean'
> 
> Michal
> 
> Michal Marek (3):
>   kbuild: Really don't clean bounds.h and asm-offsets.h
>   kbuild: Do not run make clean in $(srctree)
>   kbuild: Use a single clean rule for kernel and external modules
> 
>  Documentation/kbuild/makefiles.txt |    7 +++++++
>  Kbuild                             |    4 ++--
>  Makefile                           |   33 +++++++++++++--------------------
>  scripts/Makefile.clean             |    2 ++
>  4 files changed, 24 insertions(+), 22 deletions(-)

I added this to the kbuild tree.

Michal

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-09-13 15:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-06 11:48 [PATCH 0/3] make clean fixes Michal Marek
2010-09-06 11:48 ` [PATCH 1/3] kbuild: Really don't clean bounds.h and asm-offsets.h Michal Marek
2010-09-06 11:48 ` [PATCH 2/3] kbuild: Do not run make clean in $(srctree) Michal Marek
2010-09-06 11:48 ` [PATCH 3/3] kbuild: Use a single clean rule for kernel and external modules Michal Marek
2010-09-13 15:24 ` [PATCH 0/3] make clean fixes Michal Marek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox