linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] kbuild: better implementation to display "Entering directory ..."
@ 2014-09-09 11:02 Masahiro Yamada
  2014-09-09 11:02 ` [PATCH 1/3] kbuild: fake the "Entering directory ..." message more simply Masahiro Yamada
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Masahiro Yamada @ 2014-09-09 11:02 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, linux-kernel, Michal Marek




Masahiro Yamada (3):
  kbuild: fake the "Entering directory ..." message more simply
  kbuild: use $(Q) for sub-make target
  kbuild: handle C=... and M=... after entering into build directory

 Makefile | 82 ++++++++++++++++++++++++++++++----------------------------------
 1 file changed, 38 insertions(+), 44 deletions(-)

-- 
1.9.1


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

* [PATCH 1/3] kbuild: fake the "Entering directory ..." message more simply
  2014-09-09 11:02 [PATCH 0/3] kbuild: better implementation to display "Entering directory ..." Masahiro Yamada
@ 2014-09-09 11:02 ` Masahiro Yamada
  2014-09-09 16:28   ` Peter Foley
  2014-10-01 21:21   ` Michal Marek
  2014-09-09 11:02 ` [PATCH 2/3] kbuild: use $(Q) for sub-make target Masahiro Yamada
  2014-09-09 11:02 ` [PATCH 3/3] kbuild: handle C=... and M=... after entering into build directory Masahiro Yamada
  2 siblings, 2 replies; 9+ messages in thread
From: Masahiro Yamada @ 2014-09-09 11:02 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, Michal Marek, linux-kernel

Commit c2e28dc975ea87feed84415006ae143424912ac7
(kbuild: Print the name of the build directory)
added a gimmick to show the "Entering directory ...".

Instead of echoing the hard-coded message (that is, we need to know
the exact message), moving --no-print-directory would be easier.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
---

 Makefile | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/Makefile b/Makefile
index f7b9174..c1bd5a4 100644
--- a/Makefile
+++ b/Makefile
@@ -10,11 +10,9 @@ NAME = Shuffling Zombie Juror
 # Comments in this file are targeted only to the developer, do not
 # expect to learn how to build the kernel reading this file.
 
-# Do not:
-# o  use make's built-in rules and variables
-#    (this increases performance and avoids hard-to-debug behaviour);
-# o  print "Entering directory ...";
-MAKEFLAGS += -rR --no-print-directory
+# Do not use make's built-in rules and variables
+# (this increases performance and avoids hard-to-debug behaviour);
+MAKEFLAGS += -rR
 
 # Avoid funny character set dependencies
 unexport LC_ALL
@@ -172,13 +170,7 @@ PHONY += $(MAKECMDGOALS) sub-make
 $(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make
 	@:
 
-# Fake the "Entering directory" message once, so that IDEs/editors are
-# able to understand relative filenames.
-       echodir := @echo
- quiet_echodir := @echo
-silent_echodir := @:
 sub-make: FORCE
-	$($(quiet)echodir) "make[1]: Entering directory \`$(KBUILD_OUTPUT)'"
 	$(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \
 	KBUILD_SRC=$(CURDIR) \
 	KBUILD_EXTMOD="$(KBUILD_EXTMOD)" -f $(CURDIR)/Makefile \
@@ -192,6 +184,11 @@ endif # ifeq ($(KBUILD_SRC),)
 # We process the rest of the Makefile if this is the final invocation of make
 ifeq ($(skip-makefile),)
 
+# Do not print "Entering directory ...",
+# but we want to display it when entering to the output directory
+# so that IDEs/editors are able to understand relative filenames.
+MAKEFLAGS += --no-print-directory
+
 # If building an external module we do not care about the all: rule
 # but instead _all depend on modules
 PHONY += all
-- 
1.9.1


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

* [PATCH 2/3] kbuild: use $(Q) for sub-make target
  2014-09-09 11:02 [PATCH 0/3] kbuild: better implementation to display "Entering directory ..." Masahiro Yamada
  2014-09-09 11:02 ` [PATCH 1/3] kbuild: fake the "Entering directory ..." message more simply Masahiro Yamada
@ 2014-09-09 11:02 ` Masahiro Yamada
  2014-09-09 16:25   ` Peter Foley
  2014-09-09 11:02 ` [PATCH 3/3] kbuild: handle C=... and M=... after entering into build directory Masahiro Yamada
  2 siblings, 1 reply; 9+ messages in thread
From: Masahiro Yamada @ 2014-09-09 11:02 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, Michal Marek, linux-kernel

Since commit 066b7ed9558087a7957a1128f27d7a3462ff117f
(kbuild: Do not print the build directory with make -s),
"Q" is defined above the sub-make target.

This commit takes advantage of that and replaces
"$(if $(KBUILD_VERBOSE:1=),@)" with "$(Q)".

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
---

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

diff --git a/Makefile b/Makefile
index c1bd5a4..105919a 100644
--- a/Makefile
+++ b/Makefile
@@ -171,8 +171,7 @@ $(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make
 	@:
 
 sub-make: FORCE
-	$(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \
-	KBUILD_SRC=$(CURDIR) \
+	$(Q)$(MAKE) -C $(KBUILD_OUTPUT) KBUILD_SRC=$(CURDIR) \
 	KBUILD_EXTMOD="$(KBUILD_EXTMOD)" -f $(CURDIR)/Makefile \
 	$(filter-out _all sub-make,$(MAKECMDGOALS))
 
-- 
1.9.1


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

* [PATCH 3/3] kbuild: handle C=... and M=... after entering into build directory
  2014-09-09 11:02 [PATCH 0/3] kbuild: better implementation to display "Entering directory ..." Masahiro Yamada
  2014-09-09 11:02 ` [PATCH 1/3] kbuild: fake the "Entering directory ..." message more simply Masahiro Yamada
  2014-09-09 11:02 ` [PATCH 2/3] kbuild: use $(Q) for sub-make target Masahiro Yamada
@ 2014-09-09 11:02 ` Masahiro Yamada
  2014-09-09 16:27   ` Peter Foley
  2014-10-01 21:25   ` Michal Marek
  2 siblings, 2 replies; 9+ messages in thread
From: Masahiro Yamada @ 2014-09-09 11:02 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, Michal Marek, linux-kernel

This commit avoids processing C=... and M=... twice
when O=... is also given.

Besides, we can also remove KBUILD_EXTMOD="$(KBUILD_EXTMOD)"
in the sub-make target.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
---

 Makefile | 60 +++++++++++++++++++++++++++++-------------------------------
 1 file changed, 29 insertions(+), 31 deletions(-)

diff --git a/Makefile b/Makefile
index 105919a..48c8ee1 100644
--- a/Makefile
+++ b/Makefile
@@ -95,34 +95,6 @@ endif
 
 export quiet Q KBUILD_VERBOSE
 
-# Call a source code checker (by default, "sparse") as part of the
-# C compilation.
-#
-# Use 'make C=1' to enable checking of only re-compiled files.
-# Use 'make C=2' to enable checking of *all* source files, regardless
-# of whether they are re-compiled or not.
-#
-# See the file "Documentation/sparse.txt" for more details, including
-# where to get the "sparse" utility.
-
-ifeq ("$(origin C)", "command line")
-  KBUILD_CHECKSRC = $(C)
-endif
-ifndef KBUILD_CHECKSRC
-  KBUILD_CHECKSRC = 0
-endif
-
-# Use make M=dir to specify directory of external module to build
-# Old syntax make ... SUBDIRS=$PWD is still supported
-# Setting the environment variable KBUILD_EXTMOD take precedence
-ifdef SUBDIRS
-  KBUILD_EXTMOD ?= $(SUBDIRS)
-endif
-
-ifeq ("$(origin M)", "command line")
-  KBUILD_EXTMOD := $(M)
-endif
-
 # kbuild supports saving output files in a separate directory.
 # To locate output files in a separate directory two syntaxes are supported.
 # In both cases the working directory must be the root of the kernel src.
@@ -138,7 +110,6 @@ endif
 # The O= assignment takes precedence over the KBUILD_OUTPUT environment
 # variable.
 
-
 # KBUILD_SRC is set on invocation of make in OBJ directory
 # KBUILD_SRC is not intended to be used by the regular user (for now)
 ifeq ($(KBUILD_SRC),)
@@ -172,8 +143,7 @@ $(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make
 
 sub-make: FORCE
 	$(Q)$(MAKE) -C $(KBUILD_OUTPUT) KBUILD_SRC=$(CURDIR) \
-	KBUILD_EXTMOD="$(KBUILD_EXTMOD)" -f $(CURDIR)/Makefile \
-	$(filter-out _all sub-make,$(MAKECMDGOALS))
+	-f $(CURDIR)/Makefile $(filter-out _all sub-make,$(MAKECMDGOALS))
 
 # Leave processing to above invocation of make
 skip-makefile := 1
@@ -188,6 +158,34 @@ ifeq ($(skip-makefile),)
 # so that IDEs/editors are able to understand relative filenames.
 MAKEFLAGS += --no-print-directory
 
+# Call a source code checker (by default, "sparse") as part of the
+# C compilation.
+#
+# Use 'make C=1' to enable checking of only re-compiled files.
+# Use 'make C=2' to enable checking of *all* source files, regardless
+# of whether they are re-compiled or not.
+#
+# See the file "Documentation/sparse.txt" for more details, including
+# where to get the "sparse" utility.
+
+ifeq ("$(origin C)", "command line")
+  KBUILD_CHECKSRC = $(C)
+endif
+ifndef KBUILD_CHECKSRC
+  KBUILD_CHECKSRC = 0
+endif
+
+# Use make M=dir to specify directory of external module to build
+# Old syntax make ... SUBDIRS=$PWD is still supported
+# Setting the environment variable KBUILD_EXTMOD take precedence
+ifdef SUBDIRS
+  KBUILD_EXTMOD ?= $(SUBDIRS)
+endif
+
+ifeq ("$(origin M)", "command line")
+  KBUILD_EXTMOD := $(M)
+endif
+
 # If building an external module we do not care about the all: rule
 # but instead _all depend on modules
 PHONY += all
-- 
1.9.1


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

* Re: [PATCH 2/3] kbuild: use $(Q) for sub-make target
  2014-09-09 11:02 ` [PATCH 2/3] kbuild: use $(Q) for sub-make target Masahiro Yamada
@ 2014-09-09 16:25   ` Peter Foley
  0 siblings, 0 replies; 9+ messages in thread
From: Peter Foley @ 2014-09-09 16:25 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: linux-kbuild, Michal Marek, LKML

On Tue, Sep 9, 2014 at 7:02 AM, Masahiro Yamada
<yamada.m@jp.panasonic.com> wrote:
> Since commit 066b7ed9558087a7957a1128f27d7a3462ff117f
> (kbuild: Do not print the build directory with make -s),
> "Q" is defined above the sub-make target.
>
> This commit takes advantage of that and replaces
> "$(if $(KBUILD_VERBOSE:1=),@)" with "$(Q)".
>
> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

Acked-by: Peter Foley <pefoley2@pefoley.com>

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

* Re: [PATCH 3/3] kbuild: handle C=... and M=... after entering into build directory
  2014-09-09 11:02 ` [PATCH 3/3] kbuild: handle C=... and M=... after entering into build directory Masahiro Yamada
@ 2014-09-09 16:27   ` Peter Foley
  2014-10-01 21:25   ` Michal Marek
  1 sibling, 0 replies; 9+ messages in thread
From: Peter Foley @ 2014-09-09 16:27 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: linux-kbuild, Michal Marek, LKML

On Tue, Sep 9, 2014 at 7:02 AM, Masahiro Yamada
<yamada.m@jp.panasonic.com> wrote:
> This commit avoids processing C=... and M=... twice
> when O=... is also given.
>
> Besides, we can also remove KBUILD_EXTMOD="$(KBUILD_EXTMOD)"
> in the sub-make target.
>
> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

Acked-by: Peter Foley <pefoley2@pefoley.com>

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

* Re: [PATCH 1/3] kbuild: fake the "Entering directory ..." message more simply
  2014-09-09 11:02 ` [PATCH 1/3] kbuild: fake the "Entering directory ..." message more simply Masahiro Yamada
@ 2014-09-09 16:28   ` Peter Foley
  2014-10-01 21:21   ` Michal Marek
  1 sibling, 0 replies; 9+ messages in thread
From: Peter Foley @ 2014-09-09 16:28 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: linux-kbuild, Michal Marek, LKML

On Tue, Sep 9, 2014 at 7:02 AM, Masahiro Yamada
<yamada.m@jp.panasonic.com> wrote:
> Commit c2e28dc975ea87feed84415006ae143424912ac7
> (kbuild: Print the name of the build directory)
> added a gimmick to show the "Entering directory ...".
>
> Instead of echoing the hard-coded message (that is, we need to know
> the exact message), moving --no-print-directory would be easier.
>
> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>

Acked-by: Peter Foley <pefoley2@pefoley.com>

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

* Re: [PATCH 1/3] kbuild: fake the "Entering directory ..." message more simply
  2014-09-09 11:02 ` [PATCH 1/3] kbuild: fake the "Entering directory ..." message more simply Masahiro Yamada
  2014-09-09 16:28   ` Peter Foley
@ 2014-10-01 21:21   ` Michal Marek
  1 sibling, 0 replies; 9+ messages in thread
From: Michal Marek @ 2014-10-01 21:21 UTC (permalink / raw)
  To: Masahiro Yamada, linux-kbuild; +Cc: linux-kernel

Dne 9.9.2014 13:02, Masahiro Yamada napsal(a):
> Commit c2e28dc975ea87feed84415006ae143424912ac7
> (kbuild: Print the name of the build directory)
> added a gimmick to show the "Entering directory ...".
> 
> Instead of echoing the hard-coded message (that is, we need to know
> the exact message), moving --no-print-directory would be easier.

It now prints the localized text for me. But I guess I'm getting what I
asked for :). Applied to kbuild.git#kbuild.

Michal

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

* Re: [PATCH 3/3] kbuild: handle C=... and M=... after entering into build directory
  2014-09-09 11:02 ` [PATCH 3/3] kbuild: handle C=... and M=... after entering into build directory Masahiro Yamada
  2014-09-09 16:27   ` Peter Foley
@ 2014-10-01 21:25   ` Michal Marek
  1 sibling, 0 replies; 9+ messages in thread
From: Michal Marek @ 2014-10-01 21:25 UTC (permalink / raw)
  To: Masahiro Yamada, linux-kbuild; +Cc: linux-kernel

Dne 9.9.2014 13:02, Masahiro Yamada napsal(a):
>  sub-make: FORCE
>  	$(Q)$(MAKE) -C $(KBUILD_OUTPUT) KBUILD_SRC=$(CURDIR) \
> -	KBUILD_EXTMOD="$(KBUILD_EXTMOD)" -f $(CURDIR)/Makefile \
> -	$(filter-out _all sub-make,$(MAKECMDGOALS))
> +	-f $(CURDIR)/Makefile $(filter-out _all sub-make,$(MAKECMDGOALS))
>  
>  # Leave processing to above invocation of make
>  skip-makefile := 1
> @@ -188,6 +158,34 @@ ifeq ($(skip-makefile),)
>  # so that IDEs/editors are able to understand relative filenames.
>  MAKEFLAGS += --no-print-directory
>  
> +# Call a source code checker (by default, "sparse") as part of the
> +# C compilation.
> +#
> +# Use 'make C=1' to enable checking of only re-compiled files.
> +# Use 'make C=2' to enable checking of *all* source files, regardless
> +# of whether they are re-compiled or not.
> +#
> +# See the file "Documentation/sparse.txt" for more details, including
> +# where to get the "sparse" utility.
> +
> +ifeq ("$(origin C)", "command line")

I thought that the origin check would not work in the sub-make, because
the variables are part of the environment. But the sub-makes learn about
commandline variables from the MAKEFLAGS variable, so it works as
expected. Nice cleanup!

Michal

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

end of thread, other threads:[~2014-10-01 21:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-09 11:02 [PATCH 0/3] kbuild: better implementation to display "Entering directory ..." Masahiro Yamada
2014-09-09 11:02 ` [PATCH 1/3] kbuild: fake the "Entering directory ..." message more simply Masahiro Yamada
2014-09-09 16:28   ` Peter Foley
2014-10-01 21:21   ` Michal Marek
2014-09-09 11:02 ` [PATCH 2/3] kbuild: use $(Q) for sub-make target Masahiro Yamada
2014-09-09 16:25   ` Peter Foley
2014-09-09 11:02 ` [PATCH 3/3] kbuild: handle C=... and M=... after entering into build directory Masahiro Yamada
2014-09-09 16:27   ` Peter Foley
2014-10-01 21:25   ` Michal Marek

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