Re: Port silent mode detection to future gnu make.

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

 



On Sun, Nov 27, 2022 at 12:43 PM Dmitry Goncharov
<dgoncharov@xxxxxxxxxxxx> wrote:
>
>
>
> Port silent mode detection to future gnu make.
>
> Makefile uses the following piece of make code to detect if option -s is
> specified on the command line.
>
> ifneq ($(findstring s,$(filter-out --%,$(MAKEFLAGS))),)
>
>
> This code is executed by make at parse time and assumes that MAKEFLAGS does
> not contain command line variable definitions.
> Currently there is a change to make under discussion here
> https://savannah.gnu.org/bugs/?63347.
> This proposed patch modifies make such that at parse time MAKEFLAGS
> contains command line variable definitions.
> Currently if the user defines a=s on the command line, then at build only
> time MAKEFLAGS contains " -- a=s".
> With the patch proposed in sv63347, MAKEFLAGS will contain this " -- a=s"
> at parse time and build time.
>
>
> Once this change is applied this code will confuse a command line variable
> definition which contains letter 's' with option -s.
>
> E.g.
> $ # old make
> $ make net/wireless/ocb.o a=s
>   CALL    scripts/checksyscalls.sh
>   DESCEND objtool
> $ # this a new make which defines makeflags at parse time
> $ ~/src/gmake/make/l64/make net/wireless/ocb.o a=s
> $
>
> We can see here that letter 's' from 'a=s' was confused with -s.
>
> This patch checks for presence of -s using a method recommended by the make
> manual here
> https://www.gnu.org/software/make/manual/make.html#Testing-Flags.
>
> This suggested method will work with the old and new make.
>
> Signed-off-by: Dmitry Goncharov <dgoncharov@xxxxxxxxxxxx>
>
> Reported-by: Jan Palus <jpalus+gnu@xxxxxxxxxxxx>




I like MAKEFLAGS defined on-the-fly in the parse stage,
so I appreciate your sv63347_fix.diff.


I have no objection to changing the kernel Makefile, but I am
not willing to do it based on the proposal that has not even
queued up in the git tree.

Please come back after your patch is applied
(and please have the patch include the commit hash
causing the behaviour change)


BTW, the GNU Make manual suggests $(word 1) instead of $(firstword).
Is it for the purpose of backward compatibility for older
Make versions?

The kernel build only supports Make>=3.82, and I personally prefer
$(firstword).








>
> ---
>
> diff --git a/Makefile b/Makefile
> index 6f846b1f2618..1ab3d6f098fb 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,$(word 1,-$(MAKEFLAGS))),)
>    quiet=silent_
>    KBUILD_VERBOSE = 0
>  endif
>
>
>
> 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