Makefile: Support three levels of verbosity

At present the EC Makefile supports two levels of verbosity:

V unset: Show an abbreviated build log (operation and file only)
V=1: Show the full build log, including all commands

However, even the abbreviated build log includes a lot of output. It is
basically a long list of filenames and is of little use during
development. It is more useful to show just warnings and errors.

Add a new setting, V=0, which provides this.

BUG=chromium:680243
BRANCH=none
TEST=emerge-reef chromeos-ec; test each of V=, V=0, V=1 and see that the
Makefile does the correct thing.
Change-Id: I85c0423c5299fa3ab624ed9f7f7b6b7f73236611
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/427363
Reviewed-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
Simon Glass
2017-01-11 17:18:17 -07:00
committed by chrome-bot
parent 70d4db19ab
commit 7d40fb380d

View File

@@ -29,10 +29,24 @@ _dir_create := $(foreach d,$(dirs),$(shell [ -d $(out)/$(BLD)/$(d) ] || \
_dir_y_create := $(foreach d,$(dirs-y),$(shell [ -d $(out)/$(BLD)/$(d) ] || \
mkdir -p $(out)/RO/$(d); mkdir -p $(out)/RW/$(d)))
# Decrease verbosity unless you pass V=1
quiet = $(if $(V),,@echo ' $(2)' $(subst $(out)/,,$@) ; )$(cmd_$(1))
silent = $(if $(V),,1>/dev/null)
silent_err = $(if $(V),,2>/dev/null)
# V unset for normal output, V=1 for verbose output, V=0 for silent build
# (warnings/errors only). Use echo thus: $(call echo,"stuff to echo")
ifeq ($(V),0)
Q := @
quiet = echo -n; $(cmd_$(1))
silent = 1>/dev/null
silent_err = 2>/dev/null
else
ifeq ($(V),)
Q := @
quiet = @echo ' $(2)' $(subst $(out)/,,$@) ; $(cmd_$(1))
silent = 1>/dev/null
silent_err = 2>/dev/null
else
Q :=
quiet = $(cmd_$(1))
endif
endif
# commands to build all targets
cmd_lds = $(CPP) -P -C -MMD -MF $@.d -MT $@ $(CPPFLAGS) $< -o $@