[PATCH v2 2/5] Makefile: Correct a missing FORCE on the binman rule

Pali Rohár pali at kernel.org
Fri Oct 21 22:22:39 CEST 2022


On Friday 21 October 2022 14:17:11 Simon Glass wrote:
> Hi Pali,
> 
> On Thu, 20 Oct 2022 at 13:54, Pali Rohár <pali at kernel.org> wrote:
> >
> > On Wednesday 19 October 2022 19:55:43 Simon Glass wrote:
> > > Hi Pali,
> > >
> > > On Sun, 16 Oct 2022 at 04:16, Pali Rohár <pali at kernel.org> wrote:
> > > >
> > > > On Tuesday 11 October 2022 23:35:22 Masahiro Yamada wrote:
> > > > > On Tue, Oct 11, 2022 at 11:16 PM Simon Glass <sjg at chromium.org> wrote:
> > > > > >
> > > > > > This is required for if_changed to work correctly. Add it.
> > > > > >
> > > > > > Signed-off-by: Simon Glass <sjg at chromium.org>
> > > > > > Reviewed-by: Pali Rohár <pali at kernel.org>
> > > > > > ---
> > > > > >
> > > > > > (no changes since v1)
> > > > > >
> > > > > >  Makefile | 2 +-
> > > > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > > >
> > > > > > diff --git a/Makefile b/Makefile
> > > > > > index 3866cc62f9a..d28e8b4e316 100644
> > > > > > --- a/Makefile
> > > > > > +++ b/Makefile
> > > > > > @@ -1111,7 +1111,7 @@ endef
> > > > > >  PHONY += inputs
> > > > > >  inputs: $(INPUTS-y)
> > > > > >
> > > > > > -all: .binman_stamp inputs
> > > > > > +all: .binman_stamp inputs FORCE
> > > > > >  ifeq ($(CONFIG_BINMAN),y)
> > > > > >         $(call if_changed,binman)
> > > > >
> > > > >
> > > > >
> > > > > 'all' is usually used as a phony target.
> > > > >
> > > > >
> > > > > I think this went wrong.
> > > > >
> > > > > if_changed should never be used for a phony target.
> > > > > In other words, if_changed should produce a build artifact.
> > > > >
> > > > >
> > > > >
> > > > > FORCE is never used for a phony target because
> > > > > it is added to 'PHONY'.
> > > > >
> > > > > PHONY += all
> > > > >
> > > > >
> > > >
> > > > I agree, this is really written in the wrong way.
> > > >
> > > > Target "all:" should be really phony target and should only depends on
> > > > other target, it should not have any body / commands.
> > >
> > > OK, will need to figure out where to put the binman thing then.
> > >
> > > >
> > > > And binman call should be moved to different non-phony target with the
> > > > correct output file name.
> > >
> > > Binman can generate all sorts of files. I will see if I can use
> > > .binman-stamp since that is always generated.
> > >
> > > Regards,
> > > Simon
> >
> > Would not something like this work?
> >
> > BINMAN_INPUTS := .... # fill this
> > BINMAN_OUTPUTS := .... # fill this
> >
> > INPUTS-$(CONFIG_BINMAN) += .binman_stamp
> >
> > .binman_stamp: $(BINMAN_INPUTS) FORCE
> >         $(call if_changed,binman)
> >
> > $(BINMAN_OUTPUTS): .binman_stamp
> >
> > all: inputs
> 
> Sadly we don't know the outputs without asking binman.

So what about extending binman via some cmdline arg to just prints outputs?

> I'll send out another rev of this patch by the end of the week.
> 
> Regards,
> Simon


More information about the U-Boot mailing list