linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/6] kbuild: remove 'Using ... as source for kernel' message
@ 2019-08-22  4:46 Masahiro Yamada
  2019-08-22  4:46 ` [PATCH 2/6] kbuild: Inform user to pass ARCH= for make mrproper only when necessary Masahiro Yamada
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Masahiro Yamada @ 2019-08-22  4:46 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Geert Uytterhoeven, Masahiro Yamada, Michal Marek, linux-kernel

You already know the location of the source tree without this message.

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

 Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/Makefile b/Makefile
index 7e54a821b4b0..a77102e4ee90 100644
--- a/Makefile
+++ b/Makefile
@@ -1118,7 +1118,6 @@ PHONY += prepare archprepare prepare3
 # 1) Check that make has not been executed in the kernel src $(srctree)
 prepare3: include/config/kernel.release
 ifdef building_out_of_srctree
-	@$(kecho) '  Using $(srctree) as source for kernel'
 	$(Q)if [ -f $(srctree)/.config -o \
 		 -d $(srctree)/include/config -o \
 		 -d $(srctree)/arch/$(SRCARCH)/include/generated ]; then \
-- 
2.17.1


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

* [PATCH 2/6] kbuild: Inform user to pass ARCH= for make mrproper only when necessary
  2019-08-22  4:46 [PATCH 1/6] kbuild: remove 'Using ... as source for kernel' message Masahiro Yamada
@ 2019-08-22  4:46 ` Masahiro Yamada
  2019-08-22  4:46 ` [PATCH 3/6] kbuild: clarify where to run make mrproper when out-of-tree fails Masahiro Yamada
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Masahiro Yamada @ 2019-08-22  4:46 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Geert Uytterhoeven, Masahiro Yamada, Michal Marek, linux-kernel

Since commit 3a475b2166fd ("kbuild: Inform user to pass ARCH= for make
mrproper"), if you try out-of-tree build with an unclean source tree,
it suggests to run 'make ARCH=<ARCH> mrproper'.

This looks odd when you are not cross-compiling the kernel. Show the
'ARCH=<ARCH>' part only when ARCH= was given from the command line.
If ARCH is the default (native build) or came from the environment,
it should simply suggest 'make mrproper' as before.

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

 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index a77102e4ee90..d9cbbc27d4ba 100644
--- a/Makefile
+++ b/Makefile
@@ -1121,7 +1121,7 @@ ifdef building_out_of_srctree
 	$(Q)if [ -f $(srctree)/.config -o \
 		 -d $(srctree)/include/config -o \
 		 -d $(srctree)/arch/$(SRCARCH)/include/generated ]; then \
-		echo >&2 "  $(srctree) is not clean, please run 'make ARCH=$(ARCH) mrproper'"; \
+		echo >&2 "  $(srctree) is not clean, please run 'make$(if $(findstring command line, $(origin ARCH)), ARCH=$(ARCH)) mrproper'"; \
 		echo >&2 "  in the '$(srctree)' directory.";\
 		/bin/false; \
 	fi;
-- 
2.17.1


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

* [PATCH 3/6] kbuild: clarify where to run make mrproper when out-of-tree fails
  2019-08-22  4:46 [PATCH 1/6] kbuild: remove 'Using ... as source for kernel' message Masahiro Yamada
  2019-08-22  4:46 ` [PATCH 2/6] kbuild: Inform user to pass ARCH= for make mrproper only when necessary Masahiro Yamada
@ 2019-08-22  4:46 ` Masahiro Yamada
  2019-08-22  4:46 ` [PATCH 4/6] kbuild: move the clean srctree check to the outputmakefile target Masahiro Yamada
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Masahiro Yamada @ 2019-08-22  4:46 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Geert Uytterhoeven, Masahiro Yamada, Michal Marek, linux-kernel

If you try out-of-tree build with an unclean source tree, Kbuild
suggests to run make mrproper. The path to the source tree may be
shown with a relative path, for example, "make O=foo" emits the
following:

  .. is not clean, please run 'make mrproper'
  in the '..' directory.

This is somewhat confusing if you ran "make O=foo" in the source tree.
Using the absolute path will be clearer.

This commit changes the error message like follows:

***
*** The source tree is not clean, please run 'make mrproper'
*** in /absolute/path/to/linux
***

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

 Makefile | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index d9cbbc27d4ba..901fcb8fffbe 100644
--- a/Makefile
+++ b/Makefile
@@ -1121,8 +1121,10 @@ ifdef building_out_of_srctree
 	$(Q)if [ -f $(srctree)/.config -o \
 		 -d $(srctree)/include/config -o \
 		 -d $(srctree)/arch/$(SRCARCH)/include/generated ]; then \
-		echo >&2 "  $(srctree) is not clean, please run 'make$(if $(findstring command line, $(origin ARCH)), ARCH=$(ARCH)) mrproper'"; \
-		echo >&2 "  in the '$(srctree)' directory.";\
+		echo >&2 "***"; \
+		echo >&2 "*** The source tree is not clean, please run 'make$(if $(findstring command line, $(origin ARCH)), ARCH=$(ARCH)) mrproper'"; \
+		echo >&2 "*** in $(abs_srctree)";\
+		echo >&2 "***"; \
 		/bin/false; \
 	fi;
 endif
-- 
2.17.1


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

* [PATCH 4/6] kbuild: move the clean srctree check to the outputmakefile target
  2019-08-22  4:46 [PATCH 1/6] kbuild: remove 'Using ... as source for kernel' message Masahiro Yamada
  2019-08-22  4:46 ` [PATCH 2/6] kbuild: Inform user to pass ARCH= for make mrproper only when necessary Masahiro Yamada
  2019-08-22  4:46 ` [PATCH 3/6] kbuild: clarify where to run make mrproper when out-of-tree fails Masahiro Yamada
@ 2019-08-22  4:46 ` Masahiro Yamada
  2019-08-22  4:46 ` [PATCH 5/6] kbuild: remove prepare3 target Masahiro Yamada
  2019-08-22  4:46 ` [PATCH 6/6] kbuild: check clean srctree even earlier Masahiro Yamada
  4 siblings, 0 replies; 7+ messages in thread
From: Masahiro Yamada @ 2019-08-22  4:46 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Geert Uytterhoeven, Masahiro Yamada, Michal Marek, linux-kernel

With this commit, the error report is shown earlier, even before
running kconfig.

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

 Makefile | 24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/Makefile b/Makefile
index 901fcb8fffbe..ca6851f5ebc9 100644
--- a/Makefile
+++ b/Makefile
@@ -522,6 +522,7 @@ scripts_basic:
 	$(Q)rm -f .tmp_quiet_recordmcount
 
 PHONY += outputmakefile
+# Before starting out-of-tree build, make sure the source tree is clean.
 # outputmakefile generates a Makefile in the output directory, if using a
 # separate output directory. This allows convenient use of make in the
 # output directory.
@@ -529,6 +530,15 @@ PHONY += outputmakefile
 # ignore whole output directory
 outputmakefile:
 ifdef building_out_of_srctree
+	$(Q)if [ -f $(srctree)/.config -o \
+		 -d $(srctree)/include/config -o \
+		 -d $(srctree)/arch/$(SRCARCH)/include/generated ]; then \
+		echo >&2 "***"; \
+		echo >&2 "*** The source tree is not clean, please run 'make$(if $(findstring command line, $(origin ARCH)), ARCH=$(ARCH)) mrproper'"; \
+		echo >&2 "*** in $(abs_srctree)";\
+		echo >&2 "***"; \
+		false; \
+	fi
 	$(Q)ln -fsn $(srctree) source
 	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile $(srctree)
 	$(Q)test -e .gitignore || \
@@ -1113,21 +1123,7 @@ scripts: scripts_basic scripts_dtc
 
 PHONY += prepare archprepare prepare3
 
-# prepare3 is used to check if we are building in a separate output directory,
-# and if so do:
-# 1) Check that make has not been executed in the kernel src $(srctree)
 prepare3: include/config/kernel.release
-ifdef building_out_of_srctree
-	$(Q)if [ -f $(srctree)/.config -o \
-		 -d $(srctree)/include/config -o \
-		 -d $(srctree)/arch/$(SRCARCH)/include/generated ]; then \
-		echo >&2 "***"; \
-		echo >&2 "*** The source tree is not clean, please run 'make$(if $(findstring command line, $(origin ARCH)), ARCH=$(ARCH)) mrproper'"; \
-		echo >&2 "*** in $(abs_srctree)";\
-		echo >&2 "***"; \
-		/bin/false; \
-	fi;
-endif
 
 archprepare: archheaders archscripts scripts prepare3 outputmakefile \
 	asm-generic $(version_h) $(autoksyms_h) include/generated/utsrelease.h
-- 
2.17.1


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

* [PATCH 5/6] kbuild: remove prepare3 target
  2019-08-22  4:46 [PATCH 1/6] kbuild: remove 'Using ... as source for kernel' message Masahiro Yamada
                   ` (2 preceding siblings ...)
  2019-08-22  4:46 ` [PATCH 4/6] kbuild: move the clean srctree check to the outputmakefile target Masahiro Yamada
@ 2019-08-22  4:46 ` Masahiro Yamada
  2019-08-22  4:46 ` [PATCH 6/6] kbuild: check clean srctree even earlier Masahiro Yamada
  4 siblings, 0 replies; 7+ messages in thread
From: Masahiro Yamada @ 2019-08-22  4:46 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Geert Uytterhoeven, Masahiro Yamada, Michal Marek, linux-kernel

Now prepare3 does nothing but depends on include/config/kernel.release

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

 Makefile | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index ca6851f5ebc9..960df4d35b15 100644
--- a/Makefile
+++ b/Makefile
@@ -1121,11 +1121,9 @@ scripts: scripts_basic scripts_dtc
 # archprepare is used in arch Makefiles and when processed asm symlink,
 # version.h and scripts_basic is processed / created.
 
-PHONY += prepare archprepare prepare3
+PHONY += prepare archprepare
 
-prepare3: include/config/kernel.release
-
-archprepare: archheaders archscripts scripts prepare3 outputmakefile \
+archprepare: archheaders archscripts scripts include/config/kernel.release outputmakefile \
 	asm-generic $(version_h) $(autoksyms_h) include/generated/utsrelease.h
 
 prepare0: archprepare
@@ -1261,11 +1259,11 @@ endif
 
 ifneq ($(dtstree),)
 
-%.dtb: prepare3 scripts_dtc
+%.dtb: include/config/kernel.release scripts_dtc
 	$(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@
 
 PHONY += dtbs dtbs_install dt_binding_check
-dtbs dtbs_check: prepare3 scripts_dtc
+dtbs dtbs_check: include/config/kernel.release scripts_dtc
 	$(Q)$(MAKE) $(build)=$(dtstree)
 
 dtbs_check: export CHECK_DTBS=1
-- 
2.17.1


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

* [PATCH 6/6] kbuild: check clean srctree even earlier
  2019-08-22  4:46 [PATCH 1/6] kbuild: remove 'Using ... as source for kernel' message Masahiro Yamada
                   ` (3 preceding siblings ...)
  2019-08-22  4:46 ` [PATCH 5/6] kbuild: remove prepare3 target Masahiro Yamada
@ 2019-08-22  4:46 ` Masahiro Yamada
  2019-08-29 16:25   ` Masahiro Yamada
  4 siblings, 1 reply; 7+ messages in thread
From: Masahiro Yamada @ 2019-08-22  4:46 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Geert Uytterhoeven, Masahiro Yamada, Michal Marek, linux-kernel

Move the outputmakefile target to the leftmost in the prerequisite list
so that this is checked first. There is no guarantee that Make runs the
prerequisites from left to right, but at least the released versions of
GNU Make work like that when the parallel build option is not given.

Of course, when the parallel option -j given, other targets will be run
simultaneously but it is nice to show the error as early as possible.

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

 Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 960df4d35b15..089983a8a028 100644
--- a/Makefile
+++ b/Makefile
@@ -581,10 +581,10 @@ ifdef config-build
 include arch/$(SRCARCH)/Makefile
 export KBUILD_DEFCONFIG KBUILD_KCONFIG CC_VERSION_TEXT
 
-config: scripts_basic outputmakefile FORCE
+config: outputmakefile scripts_basic FORCE
 	$(Q)$(MAKE) $(build)=scripts/kconfig $@
 
-%config: scripts_basic outputmakefile FORCE
+%config: outputmakefile scripts_basic FORCE
 	$(Q)$(MAKE) $(build)=scripts/kconfig $@
 
 else #!config-build
@@ -1123,7 +1123,7 @@ scripts: scripts_basic scripts_dtc
 
 PHONY += prepare archprepare
 
-archprepare: archheaders archscripts scripts include/config/kernel.release outputmakefile \
+archprepare: outputmakefile archheaders archscripts scripts include/config/kernel.release \
 	asm-generic $(version_h) $(autoksyms_h) include/generated/utsrelease.h
 
 prepare0: archprepare
-- 
2.17.1


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

* Re: [PATCH 6/6] kbuild: check clean srctree even earlier
  2019-08-22  4:46 ` [PATCH 6/6] kbuild: check clean srctree even earlier Masahiro Yamada
@ 2019-08-29 16:25   ` Masahiro Yamada
  0 siblings, 0 replies; 7+ messages in thread
From: Masahiro Yamada @ 2019-08-29 16:25 UTC (permalink / raw)
  To: Linux Kbuild mailing list
  Cc: Geert Uytterhoeven, Michal Marek, Linux Kernel Mailing List

On Thu, Aug 22, 2019 at 1:46 PM Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
>
> Move the outputmakefile target to the leftmost in the prerequisite list
> so that this is checked first. There is no guarantee that Make runs the
> prerequisites from left to right,

Looks like this is guaranteed.

I did not know POSIX defined this.


I will reword the commit log as follows:


"
kbuild: check clean srctree even earlier

Move the outputmakefile target to the leftmost in the prerequisite list
so that this is checked first. GNU Make processes the prerequisites
left to right.

GNU Make will keep to stick to this behavior, and it seems even
POSIX standard, according to this:
https://lists.gnu.org/archive/html/bug-make/2019-08/msg00030.html

The POSIX standard of make is available here:
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html

Of course, when the parallel option -j given, other targets will be run
simultaneously but it is nice to show the error as early as possible.
"




> but at least the released versions of
> GNU Make work like that when the parallel build option is not given.
>
> Of course, when the parallel option -j given, other targets will be run
> simultaneously but it is nice to show the error as early as possible.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>
>  Makefile | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 960df4d35b15..089983a8a028 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -581,10 +581,10 @@ ifdef config-build
>  include arch/$(SRCARCH)/Makefile
>  export KBUILD_DEFCONFIG KBUILD_KCONFIG CC_VERSION_TEXT
>
> -config: scripts_basic outputmakefile FORCE
> +config: outputmakefile scripts_basic FORCE
>         $(Q)$(MAKE) $(build)=scripts/kconfig $@
>
> -%config: scripts_basic outputmakefile FORCE
> +%config: outputmakefile scripts_basic FORCE
>         $(Q)$(MAKE) $(build)=scripts/kconfig $@
>
>  else #!config-build
> @@ -1123,7 +1123,7 @@ scripts: scripts_basic scripts_dtc
>
>  PHONY += prepare archprepare
>
> -archprepare: archheaders archscripts scripts include/config/kernel.release outputmakefile \
> +archprepare: outputmakefile archheaders archscripts scripts include/config/kernel.release \
>         asm-generic $(version_h) $(autoksyms_h) include/generated/utsrelease.h
>
>  prepare0: archprepare
> --
> 2.17.1
>


-- 
Best Regards
Masahiro Yamada

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

end of thread, other threads:[~2019-08-29 16:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-22  4:46 [PATCH 1/6] kbuild: remove 'Using ... as source for kernel' message Masahiro Yamada
2019-08-22  4:46 ` [PATCH 2/6] kbuild: Inform user to pass ARCH= for make mrproper only when necessary Masahiro Yamada
2019-08-22  4:46 ` [PATCH 3/6] kbuild: clarify where to run make mrproper when out-of-tree fails Masahiro Yamada
2019-08-22  4:46 ` [PATCH 4/6] kbuild: move the clean srctree check to the outputmakefile target Masahiro Yamada
2019-08-22  4:46 ` [PATCH 5/6] kbuild: remove prepare3 target Masahiro Yamada
2019-08-22  4:46 ` [PATCH 6/6] kbuild: check clean srctree even earlier Masahiro Yamada
2019-08-29 16:25   ` Masahiro Yamada

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).