Re: [PATCH] MINOR: build: discard echoing in help target

2021-01-18 Thread William Lallemand
On Sun, Jan 17, 2021 at 06:47:47PM +, Bertrand Jacquin wrote:
> When V=1 is used in conjuction with help, the output becomes pretty
> difficult to read properly.
> 
>   $ make TARGET=linux-glibc V=1 help
>   ..
> DEBUG_USE_ABORT: use abort() for program termination, see 
> include/haproxy/bug.h for details
>   echo; \
>  if [ -n "" ]; then \
>if [ -n "" ]; then \
>   echo "Current TARGET: "; \
>else \
>   echo "Current TARGET:  (custom target)"; \
>fi; \
>  else \
>echo "TARGET not set, you may pass 'TARGET=xxx' to set one among :";\
>echo "  linux-glibc, linux-glibc-legacy, solaris, freebsd, dragonfly, 
> netbsd,"; \
>echo "  osx, openbsd, aix51, aix52, aix72-gcc, cygwin, haiku, 
> generic,"; \
>echo "  custom"; \
>  fi
> 
>   TARGET not set, you may pass 'TARGET=xxx' to set one among :
> linux-glibc, linux-glibc-legacy, solaris, freebsd, dragonfly, netbsd,
> osx, openbsd, aix51, aix52, aix72-gcc, cygwin, haiku, generic,
> custom
>   echo;echo "Enabled features for TARGET '' (disable with 'USE_xxx=') :"
> 
>   Enabled features for TARGET '' (disable with 'USE_xxx=') :
>   set --POLL  ; echo "  $*" | (fmt || 
> cat) 2>/dev/null
> POLL
>   echo;echo "Disabled features for TARGET '' (enable with 'USE_xxx=1') :"
> 
>   Disabled features for TARGET '' (enable with 'USE_xxx=1') :
>   set -- EPOLL KQUEUE NETFILTER PCRE PCRE_JIT PCRE2 PCRE2_JIT  PRIVATE_CACHE 
> THREAD PTHREAD_PSHARED BACKTRACE STATIC_PCRE STATIC_PCRE2 TPROXY LINUX_TPROXY 
> LINUX_SPLICE LIBCRYPT CRYPT_H GETADDRINFO OPENSSL LUA FUTEX ACCEPT4 CLOSEFROM 
> ZLIB SLZ CPU_AFFINITY TFO NS DL RT DEVICEATLAS 51DEGREES WURFL SYSTEMD 
> OBSOLETE_LINKER PRCTL THREAD_DUMP EVPORTS OT QUIC; echo "  $*" | (fmt || cat) 
> 2>/dev/null
> EPOLL KQUEUE NETFILTER PCRE PCRE_JIT PCRE2 PCRE2_JIT PRIVATE_CACHE
> 
> This commit ensure the help target always discard line echoing
> regardless of V variable as done for reg-tests-help target.

Thanks, merged!

-- 
William Lallemand



[PATCH] MINOR: build: discard echoing in help target

2021-01-17 Thread Bertrand Jacquin
When V=1 is used in conjuction with help, the output becomes pretty
difficult to read properly.

  $ make TARGET=linux-glibc V=1 help
  ..
DEBUG_USE_ABORT: use abort() for program termination, see 
include/haproxy/bug.h for details
  echo; \
 if [ -n "" ]; then \
   if [ -n "" ]; then \
  echo "Current TARGET: "; \
   else \
  echo "Current TARGET:  (custom target)"; \
   fi; \
 else \
   echo "TARGET not set, you may pass 'TARGET=xxx' to set one among :";\
   echo "  linux-glibc, linux-glibc-legacy, solaris, freebsd, dragonfly, 
netbsd,"; \
   echo "  osx, openbsd, aix51, aix52, aix72-gcc, cygwin, haiku, generic,"; 
\
   echo "  custom"; \
 fi

  TARGET not set, you may pass 'TARGET=xxx' to set one among :
linux-glibc, linux-glibc-legacy, solaris, freebsd, dragonfly, netbsd,
osx, openbsd, aix51, aix52, aix72-gcc, cygwin, haiku, generic,
custom
  echo;echo "Enabled features for TARGET '' (disable with 'USE_xxx=') :"

  Enabled features for TARGET '' (disable with 'USE_xxx=') :
  set --POLL  ; echo "  $*" | (fmt || 
cat) 2>/dev/null
POLL
  echo;echo "Disabled features for TARGET '' (enable with 'USE_xxx=1') :"

  Disabled features for TARGET '' (enable with 'USE_xxx=1') :
  set -- EPOLL KQUEUE NETFILTER PCRE PCRE_JIT PCRE2 PCRE2_JIT  PRIVATE_CACHE 
THREAD PTHREAD_PSHARED BACKTRACE STATIC_PCRE STATIC_PCRE2 TPROXY LINUX_TPROXY 
LINUX_SPLICE LIBCRYPT CRYPT_H GETADDRINFO OPENSSL LUA FUTEX ACCEPT4 CLOSEFROM 
ZLIB SLZ CPU_AFFINITY TFO NS DL RT DEVICEATLAS 51DEGREES WURFL SYSTEMD 
OBSOLETE_LINKER PRCTL THREAD_DUMP EVPORTS OT QUIC; echo "  $*" | (fmt || cat) 
2>/dev/null
EPOLL KQUEUE NETFILTER PCRE PCRE_JIT PCRE2 PCRE2_JIT PRIVATE_CACHE

This commit ensure the help target always discard line echoing
regardless of V variable as done for reg-tests-help target.
---
 Makefile | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index 27d56451cdd7..b0ab6bce5281 100644
--- a/Makefile
+++ b/Makefile
@@ -882,8 +882,8 @@ INCLUDES = $(wildcard include/*/*.h)
 DEP = $(INCLUDES) .build_opts
 
 help:
-   $(Q)sed -ne "/^[^#]*$$/q;s/^# \{0,1\}\(.*\)/\1/;p" Makefile
-   $(Q)echo; \
+   @sed -ne "/^[^#]*$$/q;s/^# \{0,1\}\(.*\)/\1/;p" Makefile
+   @echo; \
   if [ -n "$(TARGET)" ]; then \
 if [ -n "$(set_target_defaults)" ]; then \
echo "Current TARGET: $(TARGET)"; \
@@ -896,10 +896,10 @@ help:
 echo "  osx, openbsd, aix51, aix52, aix72-gcc, cygwin, haiku, 
generic,"; \
 echo "  custom"; \
   fi
-   $(Q)echo;echo "Enabled features for TARGET '$(TARGET)' (disable with 
'USE_xxx=') :"
-   $(Q)set -- $(foreach opt,$(patsubst USE_%,%,$(use_opts)),$(if 
$(USE_$(opt)),$(opt),)); echo "  $$*" | (fmt || cat) 2>/dev/null
-   $(Q)echo;echo "Disabled features for TARGET '$(TARGET)' (enable with 
'USE_xxx=1') :"
-   $(Q)set -- $(foreach opt,$(patsubst USE_%,%,$(use_opts)),$(if 
$(USE_$(opt)),,$(opt))); echo "  $$*" | (fmt || cat) 2>/dev/null
+   @echo;echo "Enabled features for TARGET '$(TARGET)' (disable with 
'USE_xxx=') :"
+   @set -- $(foreach opt,$(patsubst USE_%,%,$(use_opts)),$(if 
$(USE_$(opt)),$(opt),)); echo "  $$*" | (fmt || cat) 2>/dev/null
+   @echo;echo "Disabled features for TARGET '$(TARGET)' (enable with 
'USE_xxx=1') :"
+   @set -- $(foreach opt,$(patsubst USE_%,%,$(use_opts)),$(if 
$(USE_$(opt)),,$(opt))); echo "  $$*" | (fmt || cat) 2>/dev/null
 
 # Used only to force a rebuild if some build options change, but we don't do
 # it for certain targets which take no build options