Re: [v2] kbuild: Port silent mode detection to future gnu make.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 2, 2022 at 7:34 AM Dmitry Goncharov <dgoncharov@xxxxxxxxxxxx> wrote:
>
> On Wed, Nov 30, 2022 at 6:41 PM Masahiro Yamada <masahiroy@xxxxxxxxxx> wrote:
> > I think the following code will work
> > for 3.82, 4.x, and future releases.
> >
> > diff --git a/Makefile b/Makefile
> > index 78525ebea876..58dfd7475448 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -94,7 +94,7 @@ endif
> >  # If the user is running make -s (silent mode), suppress echoing of
> >  # commands
> >
> > -ifneq ($(findstring s,$(filter-out --%,$(MAKEFLAGS))),)
> > +ifneq ($(findstring s,$(filter-out --%,$(filter -%,-$(MAKEFLAGS)))),)
> >    quiet=silent_
> >    KBUILD_VERBOSE = 0
> >  endif
>
>
> make-4.4 (and later) stores -I<path> in makeflags.
> $ cat makefile2
> $(info $(MAKEFLAGS))
> all:
> $ make-4.4 -rR   -Isrc --warn-undefined-variables   a=s -j2 -fmakefile2
> rR -Isrc -j2 --warn-undefined-variables
> make-4.4: warning: undefined variable 'GNUMAKEFLAGS'
> make-4.4: Nothing to be done for 'all'.
> $
>
> $(findstring s,$(filter-out --%,$(filter -%,-$(MAKEFLAGS)))),)
> confuses 's' in -Isrc with -s.
>
> What about the following?
>
>
> diff --git a/Makefile b/Makefile
> index 6f846b1f2618..3a97494a9989 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -94,9 +94,15 @@ endif
>  # If the user is running make -s (silent mode), suppress echoing of
>  # commands
>
> -ifneq ($(findstring s,$(filter-out --%,$(MAKEFLAGS))),)
> -  quiet=silent_
> -  KBUILD_VERBOSE = 0
> +ifeq ($(filter 3.%,$(MAKE_VERSION)),)
> +silence:=$(findstring s,$(firstword -$(MAKEFLAGS)))
> +else
> +silence:=$(findstring s,$(filter-out --%,$(filter -%,-$(MAKEFLAGS))))
> +endif



Yes.

You do not need to change the logic in 'else' part,
but this will work as well.






> +
> +ifeq ($(silence),s)
> +quiet=silent_
> +KBUILD_VERBOSE = 0
>  endif
>
>  export quiet Q KBUILD_VERBOSE
>
> Tested 3.82, 4.3, 4.4, latest master.
> regards, Dmitry



-- 
Best Regards
Masahiro Yamada



[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux