linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] trace-cmd: refactor print_update
@ 2019-10-25  6:39 Greg Thelen
  2019-10-25  6:39 ` [PATCH 2/2] trace-cmd: respect -s/--silent Greg Thelen
  2019-10-26 15:46 ` [PATCH 1/2] trace-cmd: refactor print_update Steven Rostedt
  0 siblings, 2 replies; 3+ messages in thread
From: Greg Thelen @ 2019-10-25  6:39 UTC (permalink / raw)
  To: Steven Rostedt, Yordan Karadzhov (VMware); +Cc: linux-trace-devel, Greg Thelen

Match utils.mk convention and use a conditional macro for printing
'UPDATE' messages.

Signed-off-by: Greg Thelen <gthelen@google.com>
---
 scripts/utils.mk | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/scripts/utils.mk b/scripts/utils.mk
index 98d7b3c726d8..8e4e4b5f3a4a 100644
--- a/scripts/utils.mk
+++ b/scripts/utils.mk
@@ -22,6 +22,7 @@ ifeq ($(VERBOSE),1)
   print_plugin_obj_compile =
   print_plugin_build =
   print_install =
+  print_update =
 else
   Q = @
   S = -s
@@ -33,6 +34,7 @@ else
   print_plugin_build =		echo '  $(GUI)BUILD PLUGIN       '$(GOBJ);
   print_static_lib_build =	echo '  $(GUI)BUILD STATIC LIB   '$(GOBJ);
   print_install =		echo '  $(GUI)INSTALL     '$(GSPACE)$1'	to	$(DESTDIR_SQ)$2';
+  print_update =		echo '  $(GUI)UPDATE             '$(GOBJ);
 endif
 
 do_fpic_compile =					\
@@ -96,7 +98,7 @@ define update_version.h
 	if [ -r $@ ] && cmp -s $@ $@.tmp; then				\
 		rm -f $@.tmp;						\
 	else								\
-		echo '  UPDATE                 '$(notdir $(strip $@));	\
+		$(print_update)						\
 		mv -f $@.tmp $@;					\
 	fi);
 endef
@@ -106,7 +108,7 @@ define update_dir
 	if [ -r $@ ] && cmp -s $@ $@.tmp; then				\
 		rm -f $@.tmp;						\
 	else								\
-		echo '  UPDATE                 '$(notdir $(strip $@));	\
+		$(print_update)						\
 		mv -f $@.tmp $@;					\
 	fi);
 endef
-- 
2.24.0.rc0.303.g954a862665-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] trace-cmd: respect -s/--silent
  2019-10-25  6:39 [PATCH 1/2] trace-cmd: refactor print_update Greg Thelen
@ 2019-10-25  6:39 ` Greg Thelen
  2019-10-26 15:46 ` [PATCH 1/2] trace-cmd: refactor print_update Steven Rostedt
  1 sibling, 0 replies; 3+ messages in thread
From: Greg Thelen @ 2019-10-25  6:39 UTC (permalink / raw)
  To: Steven Rostedt, Yordan Karadzhov (VMware); +Cc: linux-trace-devel, Greg Thelen

Keep make -s,--silent from printing any progress messages.  Only show
warnings and errors.  By default (without -s), there's no change.

Signed-off-by: Greg Thelen <gthelen@google.com>
---
 Makefile         | 4 +++-
 scripts/utils.mk | 9 +++++++--
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index bbdf15ea7af6..8f9eb0203c01 100644
--- a/Makefile
+++ b/Makefile
@@ -101,6 +101,8 @@ ifndef VERBOSE
   VERBOSE = 0
 endif
 
+SILENT := $(if $(findstring s,$(filter-out --%,$(MAKEFLAGS))),1)
+
 SWIG_DEFINED := $(shell if command -v swig; then echo 1; else echo 0; fi)
 ifeq ($(SWIG_DEFINED), 0)
 BUILD_PYTHON := report_noswig
@@ -188,7 +190,7 @@ export LIBTRACEEVENT_DIR LIBTRACECMD_DIR
 export LIBTRACECMD_STATIC LIBTRACECMD_SHARED
 export LIBTRACEEVENT_STATIC LIBTRACEEVENT_SHARED
 
-export Q VERBOSE EXT
+export Q SILENT VERBOSE EXT
 
 # Include the utils
 include scripts/utils.mk
diff --git a/scripts/utils.mk b/scripts/utils.mk
index 8e4e4b5f3a4a..d1d5135063fc 100644
--- a/scripts/utils.mk
+++ b/scripts/utils.mk
@@ -15,6 +15,13 @@ endif
 ifeq ($(VERBOSE),1)
   Q =
   S =
+else
+  Q = @
+  S = -s
+endif
+
+# Use empty print_* macros if either SILENT or VERBOSE.
+ifeq ($(findstring 1,$(SILENT)$(VERBOSE)),1)
   print_compile =
   print_app_build =
   print_fpic_compile =
@@ -24,8 +31,6 @@ ifeq ($(VERBOSE),1)
   print_install =
   print_update =
 else
-  Q = @
-  S = -s
   print_compile =		echo '  $(GUI)COMPILE            '$(GOBJ);
   print_app_build =		echo '  $(GUI)BUILD              '$(GOBJ);
   print_fpic_compile =		echo '  $(GUI)COMPILE FPIC       '$(GOBJ);
-- 
2.24.0.rc0.303.g954a862665-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] trace-cmd: refactor print_update
  2019-10-25  6:39 [PATCH 1/2] trace-cmd: refactor print_update Greg Thelen
  2019-10-25  6:39 ` [PATCH 2/2] trace-cmd: respect -s/--silent Greg Thelen
@ 2019-10-26 15:46 ` Steven Rostedt
  1 sibling, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2019-10-26 15:46 UTC (permalink / raw)
  To: Greg Thelen; +Cc: Yordan Karadzhov (VMware), linux-trace-devel

On Thu, 24 Oct 2019 23:39:56 -0700
Greg Thelen <gthelen@google.com> wrote:

> Match utils.mk convention and use a conditional macro for printing
> 'UPDATE' messages.
> 
> Signed-off-by: Greg Thelen <gthelen@google.com>
> ---
>  scripts/utils.mk | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>

Thanks Greg! I applied both patches.

-- Steve

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-10-26 15:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-25  6:39 [PATCH 1/2] trace-cmd: refactor print_update Greg Thelen
2019-10-25  6:39 ` [PATCH 2/2] trace-cmd: respect -s/--silent Greg Thelen
2019-10-26 15:46 ` [PATCH 1/2] trace-cmd: refactor print_update Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).