linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masahiro Yamada <masahiroy@kernel.org>
To: Nicolas Schier <n.schier@avm.de>
Cc: Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Michal Marek <michal.lkml@markovi.net>
Subject: Re: [PATCH 2/2] kbuild: warn if FORCE is missing for if_changed(_dep,_rule) and filechk
Date: Thu, 19 Aug 2021 09:37:39 +0900	[thread overview]
Message-ID: <CAK7LNAT5CpXU_Yn=pyqLA_2spiRh9qXQyRuy6KR=nWxqN_NKgQ@mail.gmail.com> (raw)
In-Reply-To: <YRtyc1poEhr8YHYp@deb-nschier.ads.avm.de>

On Tue, Aug 17, 2021 at 5:25 PM Nicolas Schier <n.schier@avm.de> wrote:
>
> On Friday, 2021-08-13 Masahiro Yamada wrote:
> > if_changed, if_changed_dep, and if_changed_rule must have FORCE as a
> > prerequisite so the command line change is detected.
> >
> > Documentation/kbuild/makefiles.rst clearly explains it:
> >
> >   Note: It is a typical mistake to forget the FORCE prerequisite.
> >
> > However, not all people read the document, or understand what is written
> > in it.
> >
> > People repeated this mistake over again, and I determined a compelling
> > force is needed.
> >
> > Show a warning if FORCE is missing in the prerequisite of if_changed
> > and friends. Same for filechk.
> >
> > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> > ---
> >
> >  scripts/Kbuild.include | 7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
> > index c3c975a92318..dd48e68965f8 100644
> > --- a/scripts/Kbuild.include
> > +++ b/scripts/Kbuild.include
> > @@ -57,6 +57,7 @@ kecho := $($(quiet)kecho)
> >  # - If the content differ the new file is used
> >  # - If they are equal no change, and no timestamp update
> >  define filechk
> > +     $(check-FORCE)
> >       $(Q)set -e;                                             \
> >       mkdir -p $(dir $@);                                     \
> >       trap "rm -f $(dot-target).tmp" EXIT;                    \
> > @@ -130,7 +131,11 @@ make-cmd = $(call escsq,$(subst $(pound),$$(pound),$(subst $$,$$$$,$(cmd_$(1))))
> >  # PHONY targets skipped in both cases.
> >  newer-prereqs = $(filter-out $(PHONY),$?)
> >
> > -if-changed-cond = $(newer-prereqs)$(cmd-check)
> > +# It is a typical mistake to forget the FORCE prerequisite. Check it here so
>
> prerequsite -> prerequisite?

Thanks for catching it.

Applied with the typo fixed.



> Successfully found the missing FORCE in arch/x86/entry/vdso/Makefile:135.
>
> Tested-by: Nicolas Schier <n.schier@avm.de>
>
> > +# no more breakage will slip in.
> > +check-FORCE = $(if $(filter FORCE, $^),,$(warning FORCE prerequsite is missing))
> > +
> > +if-changed-cond = $(newer-prereqs)$(cmd-check)$(check-FORCE)
> >
> >  # Execute command if command has changed or prerequisite(s) are updated.
> >  if_changed = $(if $(if-changed-cond),                                        \
> > --
> > 2.30.2
> >
>


-- 
Best Regards
Masahiro Yamada

      reply	other threads:[~2021-08-19  0:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-13  6:30 [PATCH 1/2] kbuild: macrofy the condition of if_changed and friends Masahiro Yamada
2021-08-13  6:30 ` [PATCH 2/2] kbuild: warn if FORCE is missing for if_changed(_dep,_rule) and filechk Masahiro Yamada
2021-08-17  8:25   ` Nicolas Schier
2021-08-19  0:37     ` Masahiro Yamada [this message]

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='CAK7LNAT5CpXU_Yn=pyqLA_2spiRh9qXQyRuy6KR=nWxqN_NKgQ@mail.gmail.com' \
    --to=masahiroy@kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=n.schier@avm.de \
    /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).