From 7d40fb380d1dd7a0720ef8f7e2f1bf052f826b4f Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 11 Jan 2017 17:18:17 -0700 Subject: [PATCH] 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 Reviewed-on: https://chromium-review.googlesource.com/427363 Reviewed-by: Randall Spangler --- Makefile.rules | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/Makefile.rules b/Makefile.rules index cc6ac278eb..a5e79f9f25 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -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 $@