diff mbox series

[kvmtool,3/6] Makefile: support -s switch

Message ID 20190125180801.209910-4-andre.przywara@arm.com (mailing list archive)
State New, archived
Headers show
Series Various convenience fixes | expand

Commit Message

Andre Przywara Jan. 25, 2019, 6:07 p.m. UTC
"make -s" suppresses normal output, just shows warnings and errors.
But since we explicitly override the make output with our fancy concise
version, we miss out on this feature.

Do as the kernel does and explicitly suppress every normal output when -s
is given. This helps to spot warnings that scroll out of the terminal
window too quickly.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
 Makefile | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

Comments

Will Deacon Jan. 30, 2019, 6:20 p.m. UTC | #1
On Fri, Jan 25, 2019 at 06:07:58PM +0000, Andre Przywara wrote:
> "make -s" suppresses normal output, just shows warnings and errors.
> But since we explicitly override the make output with our fancy concise
> version, we miss out on this feature.
> 
> Do as the kernel does and explicitly suppress every normal output when -s
> is given. This helps to spot warnings that scroll out of the terminal
> window too quickly.
> 
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> ---
>  Makefile | 16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/Makefile b/Makefile
> index c4faff66..a68cfcd5 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -2,8 +2,22 @@
>  # Define WERROR=0 to disable -Werror.
>  #
>  
> +ifneq ($(filter 4.%,$(MAKE_VERSION)),)  # make-4
> +ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),)
> +  silent=1
> +endif
> +else                                    # make-3.8x
> +ifneq ($(filter s% -s%,$(MAKEFLAGS)),)
> +  silent=1
> +endif
> +endif

Why do we need to do this differently for different versions of Make?
afaict, the kernel manages this using findstring and filter-out.

Will
Andre Przywara Jan. 31, 2019, 1:48 p.m. UTC | #2
On Wed, 30 Jan 2019 18:20:28 +0000
Will Deacon <will.deacon@arm.com> wrote:

Hi Will,

thanks for having a look!

> On Fri, Jan 25, 2019 at 06:07:58PM +0000, Andre Przywara wrote:
> > "make -s" suppresses normal output, just shows warnings and errors.
> > But since we explicitly override the make output with our fancy
> > concise version, we miss out on this feature.
> > 
> > Do as the kernel does and explicitly suppress every normal output
> > when -s is given. This helps to spot warnings that scroll out of
> > the terminal window too quickly.
> > 
> > Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> > ---
> >  Makefile | 16 +++++++++++++++-
> >  1 file changed, 15 insertions(+), 1 deletion(-)
> > 
> > diff --git a/Makefile b/Makefile
> > index c4faff66..a68cfcd5 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -2,8 +2,22 @@
> >  # Define WERROR=0 to disable -Werror.
> >  #
> >  
> > +ifneq ($(filter 4.%,$(MAKE_VERSION)),)  # make-4
> > +ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),)
> > +  silent=1
> > +endif
> > +else                                    # make-3.8x
> > +ifneq ($(filter s% -s%,$(MAKEFLAGS)),)
> > +  silent=1
> > +endif
> > +endif  
> 
> Why do we need to do this differently for different versions of Make?
> afaict, the kernel manages this using findstring and filter-out.

Indeed, thanks for the heads up, this was a Linux change in 2017, after
I originally made this patch.
I changed it now to the new version and checked that it also works on
make 3.8.

Cheers,
Andre.
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index c4faff66..a68cfcd5 100644
--- a/Makefile
+++ b/Makefile
@@ -2,8 +2,22 @@ 
 # Define WERROR=0 to disable -Werror.
 #
 
+ifneq ($(filter 4.%,$(MAKE_VERSION)),)  # make-4
+ifneq ($(filter %s ,$(firstword x$(MAKEFLAGS))),)
+  silent=1
+endif
+else                                    # make-3.8x
+ifneq ($(filter s% -s%,$(MAKEFLAGS)),)
+  silent=1
+endif
+endif
+
 ifeq ($(strip $(V)),)
-	E = @echo
+	ifeq ($(silent),)
+		E = @echo
+	else
+		E = @\#
+	endif
 	Q = @
 else
 	E = @\#