Commit 066b7ed9558087a7957a1128f27d7a3462ff117f

Authored by Michal Marek
1 parent c2e28dc975

kbuild: Do not print the build directory with make -s

Commit c2e28dc9 (kbuild: Print the name of the build directory) prints
the name of the build directory for O= builds, but we should not be
doing this in make -s mode, so that commands like

  make -s O=<dir> kernelrelease

can be used by scripts. This matches the behavior of make itself, where
the -s option implies --no-print-directory.

Signed-off-by: Michal Marek <mmarek@suse.cz>

Showing 1 changed file with 50 additions and 47 deletions Side-by-side Diff

... ... @@ -41,6 +41,29 @@
41 41 # descending is started. They are now explicitly listed as the
42 42 # prepare rule.
43 43  
  44 +# Beautify output
  45 +# ---------------------------------------------------------------------------
  46 +#
  47 +# Normally, we echo the whole command before executing it. By making
  48 +# that echo $($(quiet)$(cmd)), we now have the possibility to set
  49 +# $(quiet) to choose other forms of output instead, e.g.
  50 +#
  51 +# quiet_cmd_cc_o_c = Compiling $(RELDIR)/$@
  52 +# cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
  53 +#
  54 +# If $(quiet) is empty, the whole command will be printed.
  55 +# If it is set to "quiet_", only the short version will be printed.
  56 +# If it is set to "silent_", nothing will be printed at all, since
  57 +# the variable $(silent_cmd_cc_o_c) doesn't exist.
  58 +#
  59 +# A simple variant is to prefix commands with $(Q) - that's useful
  60 +# for commands that shall be hidden in non-verbose mode.
  61 +#
  62 +# $(Q)ln $@ :<
  63 +#
  64 +# If KBUILD_VERBOSE equals 0 then the above command will be hidden.
  65 +# If KBUILD_VERBOSE equals 1 then the above command is displayed.
  66 +#
44 67 # To put more focus on warnings, be less verbose as default
45 68 # Use 'make V=1' to see the full commands
46 69  
... ... @@ -51,6 +74,29 @@
51 74 KBUILD_VERBOSE = 0
52 75 endif
53 76  
  77 +ifeq ($(KBUILD_VERBOSE),1)
  78 + quiet =
  79 + Q =
  80 +else
  81 + quiet=quiet_
  82 + Q = @
  83 +endif
  84 +
  85 +# If the user is running make -s (silent mode), suppress echoing of
  86 +# commands
  87 +
  88 +ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4
  89 +ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),)
  90 + quiet=silent_
  91 +endif
  92 +else # make-3.8x
  93 +ifneq ($(filter s% -s%,$(MAKEFLAGS)),)
  94 + quiet=silent_
  95 +endif
  96 +endif
  97 +
  98 +export quiet Q KBUILD_VERBOSE
  99 +
54 100 # Call a source code checker (by default, "sparse") as part of the
55 101 # C compilation.
56 102 #
57 103  
... ... @@ -128,8 +174,11 @@
128 174  
129 175 # Fake the "Entering directory" message once, so that IDEs/editors are
130 176 # able to understand relative filenames.
  177 + echodir := @echo
  178 + quiet_echodir := @echo
  179 +silent_echodir := @:
131 180 sub-make: FORCE
132   - @echo "make[1]: Entering directory - @echo$(KBUILD_OUTPUT)'"
  181 + $($(quiet)echodir) "make[1]: Entering directory + $($(quiet)echodir)$(KBUILD_OUTPUT)'"
133 182 $(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \
134 183 KBUILD_SRC=$(CURDIR) \
135 184 KBUILD_EXTMOD="$(KBUILD_EXTMOD)" -f $(CURDIR)/Makefile \
... ... @@ -291,52 +340,6 @@
291 340  
292 341 export KBUILD_MODULES KBUILD_BUILTIN
293 342 export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD
294   -
295   -# Beautify output
296   -# ---------------------------------------------------------------------------
297   -#
298   -# Normally, we echo the whole command before executing it. By making
299   -# that echo $($(quiet)$(cmd)), we now have the possibility to set
300   -# $(quiet) to choose other forms of output instead, e.g.
301   -#
302   -# quiet_cmd_cc_o_c = Compiling $(RELDIR)/$@
303   -# cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
304   -#
305   -# If $(quiet) is empty, the whole command will be printed.
306   -# If it is set to "quiet_", only the short version will be printed.
307   -# If it is set to "silent_", nothing will be printed at all, since
308   -# the variable $(silent_cmd_cc_o_c) doesn't exist.
309   -#
310   -# A simple variant is to prefix commands with $(Q) - that's useful
311   -# for commands that shall be hidden in non-verbose mode.
312   -#
313   -# $(Q)ln $@ :<
314   -#
315   -# If KBUILD_VERBOSE equals 0 then the above command will be hidden.
316   -# If KBUILD_VERBOSE equals 1 then the above command is displayed.
317   -
318   -ifeq ($(KBUILD_VERBOSE),1)
319   - quiet =
320   - Q =
321   -else
322   - quiet=quiet_
323   - Q = @
324   -endif
325   -
326   -# If the user is running make -s (silent mode), suppress echoing of
327   -# commands
328   -
329   -ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4
330   -ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),)
331   - quiet=silent_
332   -endif
333   -else # make-3.8x
334   -ifneq ($(filter s% -s%,$(MAKEFLAGS)),)
335   - quiet=silent_
336   -endif
337   -endif
338   -
339   -export quiet Q KBUILD_VERBOSE
340 343  
341 344 ifneq ($(CC),)
342 345 ifeq ($(shell $(CC) -v 2>&1 | grep -c "clang version"), 1)