From 8d2306e1dae84af9ccbadd2518beaf8543d4413b Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Wed, 15 May 2019 14:35:41 -0500 Subject: [PATCH 1/1] Add --quiet option to lwptool Add an option to lwptool, called --quiet, to suppress printing the literal commands run. On error, we still print the exact failed command to stderr. For "pretty" V=0 builds, use this new option, to make our lwptool-using compile rules look more like our other compile rules. Change-Id: I3fed6db3205f8de5e275e9b70aba9e1995afd02f Reviewed-on: https://gerrit.openafs.org/13594 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk --- src/config/Makefile.config.in | 4 +++- src/config/lwptool | 29 +++++++++++++++++++++-------- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/config/Makefile.config.in b/src/config/Makefile.config.in index f29d64d..ed4a5c5 100644 --- a/src/config/Makefile.config.in +++ b/src/config/Makefile.config.in @@ -158,7 +158,9 @@ COMPILE_ET = @COMPILE_ET_PATH@ CONFIGTOOL = @CONFIGTOOL_PATH@ RXGEN = @RXGEN_PATH@ SHELL = @SHELL@ -LWPTOOL = ${TOP_SRCDIR}/config/lwptool + +LWPTOOL_FLAGS_V0 = --quiet +LWPTOOL = ${TOP_SRCDIR}/config/lwptool $(LWPTOOL_FLAGS_V$(V)) # # "Pretty" build line stuff diff --git a/src/config/lwptool b/src/config/lwptool index 2cb55e6..3604611 100755 --- a/src/config/lwptool +++ b/src/config/lwptool @@ -11,6 +11,7 @@ ranlib= mode= object= done= +quiet= while [ -z "$done" ] && [ $# -gt 0 ] ; do case "$1" in @@ -39,6 +40,10 @@ while [ -z "$done" ] && [ $# -gt 0 ] ; do ranlib="$1" shift ;; + --quiet) + shift + quiet="1" + ;; -o) shift object="$1" @@ -55,6 +60,18 @@ while [ -z "$done" ] && [ $# -gt 0 ] ; do esac done +_run_cmd() { + if [ x"$quiet" != x1 ] ; then + echo "$@" + fi + if "$@" ; then + : + else + echo "FAILED LWPTOOL COMMAND: $@" >&2 + exit 1 + fi +} + case "$mode" in compile) if [ -z "$object" ] || [ -z "$lwpcc" ] || \ @@ -69,10 +86,8 @@ compile) lwpobj=".lwp/$lwpobj" mkdir .lwp 2>/dev/null - echo $lwpcc -o $lwpobj "$@" - $lwpcc -o $lwpobj "$@" || exit 1 - echo $mtcc -o $object "$@" - $mtcc -o $object "$@" || exit 1 + _run_cmd $lwpcc -o $lwpobj "$@" + _run_cmd $mtcc -o $object "$@" ;; link) if [ -z "$object" ] || [ -z "$linker" ] || \ @@ -95,9 +110,7 @@ link) done rm -f $object 2>/dev/null - echo $linker $object $objects - $linker $object $objects - echo $ranlib $object - $ranlib $object + _run_cmd $linker $object $objects + _run_cmd $ranlib $object ;; esac -- 1.9.4