diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 97 |
1 files changed, 50 insertions, 47 deletions
@@ -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 |
52 | endif | 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 | # 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 | ||
179 | silent_echodir := @: | ||
131 | sub-make: FORCE | 180 | sub-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 | |||
292 | export KBUILD_MODULES KBUILD_BUILTIN | 341 | export KBUILD_MODULES KBUILD_BUILTIN |
293 | export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD | 342 | export 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 | |||
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 | |||
341 | ifneq ($(CC),) | 344 | ifneq ($(CC),) |
342 | ifeq ($(shell $(CC) -v 2>&1 | grep -c "clang version"), 1) | 345 | ifeq ($(shell $(CC) -v 2>&1 | grep -c "clang version"), 1) |
343 | COMPILER := clang | 346 | COMPILER := clang |