aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile97
1 files changed, 50 insertions, 47 deletions
diff --git a/Makefile b/Makefile
index 40544a0babdc..1a5f9f3c7a58 100644
--- a/Makefile
+++ b/Makefile
@@ -41,6 +41,29 @@ unexport GREP_OPTIONS
41# descending is started. They are now explicitly listed as the 41# descending is started. They are now explicitly listed as the
42# prepare rule. 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# To put more focus on warnings, be less verbose as default 67# To put more focus on warnings, be less verbose as default
45# Use 'make V=1' to see the full commands 68# Use 'make V=1' to see the full commands
46 69
@@ -51,6 +74,29 @@ ifndef KBUILD_VERBOSE
51 KBUILD_VERBOSE = 0 74 KBUILD_VERBOSE = 0
52endif 75endif
53 76
77ifeq ($(KBUILD_VERBOSE),1)
78 quiet =
79 Q =
80else
81 quiet=quiet_
82 Q = @
83endif
84
85# If the user is running make -s (silent mode), suppress echoing of
86# commands
87
88ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4
89ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),)
90 quiet=silent_
91endif
92else # make-3.8x
93ifneq ($(filter s% -s%,$(MAKEFLAGS)),)
94 quiet=silent_
95endif
96endif
97
98export quiet Q KBUILD_VERBOSE
99
54# Call a source code checker (by default, "sparse") as part of the 100# Call a source code checker (by default, "sparse") as part of the
55# C compilation. 101# C compilation.
56# 102#
@@ -128,8 +174,11 @@ $(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make
128 174
129# Fake the "Entering directory" message once, so that IDEs/editors are 175# Fake the "Entering directory" message once, so that IDEs/editors are
130# able to understand relative filenames. 176# able to understand relative filenames.
177 echodir := @echo
178 quiet_echodir := @echo
179silent_echodir := @:
131sub-make: FORCE 180sub-make: FORCE
132 @echo "make[1]: Entering directory \`$(KBUILD_OUTPUT)'" 181 $($(quiet)echodir) "make[1]: Entering directory \`$(KBUILD_OUTPUT)'"
133 $(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \ 182 $(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \
134 KBUILD_SRC=$(CURDIR) \ 183 KBUILD_SRC=$(CURDIR) \
135 KBUILD_EXTMOD="$(KBUILD_EXTMOD)" -f $(CURDIR)/Makefile \ 184 KBUILD_EXTMOD="$(KBUILD_EXTMOD)" -f $(CURDIR)/Makefile \
@@ -292,52 +341,6 @@ endif
292export KBUILD_MODULES KBUILD_BUILTIN 341export KBUILD_MODULES KBUILD_BUILTIN
293export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD 342export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD
294 343
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
318ifeq ($(KBUILD_VERBOSE),1)
319 quiet =
320 Q =
321else
322 quiet=quiet_
323 Q = @
324endif
325
326# If the user is running make -s (silent mode), suppress echoing of
327# commands
328
329ifneq ($(filter 4.%,$(MAKE_VERSION)),) # make-4
330ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),)
331 quiet=silent_
332endif
333else # make-3.8x
334ifneq ($(filter s% -s%,$(MAKEFLAGS)),)
335 quiet=silent_
336endif
337endif
338
339export quiet Q KBUILD_VERBOSE
340
341ifneq ($(CC),) 344ifneq ($(CC),)
342ifeq ($(shell $(CC) -v 2>&1 | grep -c "clang version"), 1) 345ifeq ($(shell $(CC) -v 2>&1 | grep -c "clang version"), 1)
343COMPILER := clang 346COMPILER := clang