linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masahiro Yamada <masahiroy@kernel.org>
To: Dmitry Goncharov <dgoncharov@users.sf.net>
Cc: linux-kbuild@vger.kernel.org
Subject: Re: Port silent mode detection to future gnu make.
Date: Sun, 27 Nov 2022 14:46:35 +0900	[thread overview]
Message-ID: <CAK7LNAQP4S0ACMkB3KtaJTaeRkpT_KjRa4CrYxNJboTdthN=Zw@mail.gmail.com> (raw)
In-Reply-To: <CAG+Z0CviRhBQqWfAPFDht+mWUJf4azPSZgOV0jrur_YSP23__A@mail.gmail.com>

On Sun, Nov 27, 2022 at 12:43 PM Dmitry Goncharov
<dgoncharov@users.sf.net> 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@users.sf.net>
>
> Reported-by: Jan Palus <jpalus+gnu@fastmail.com>




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

       reply	other threads:[~2022-11-27  5:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAG+Z0CviRhBQqWfAPFDht+mWUJf4azPSZgOV0jrur_YSP23__A@mail.gmail.com>
2022-11-27  5:46 ` Masahiro Yamada [this message]
2022-11-27 15:36   ` Port silent mode detection to future gnu make Dmitry Goncharov
2022-11-29  3:00   ` Dmitry Goncharov
2022-11-29  6:18     ` Masahiro Yamada
2022-11-29 17:27       ` Dmitry Goncharov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAK7LNAQP4S0ACMkB3KtaJTaeRkpT_KjRa4CrYxNJboTdthN=Zw@mail.gmail.com' \
    --to=masahiroy@kernel.org \
    --cc=dgoncharov@users.sf.net \
    --cc=linux-kbuild@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).