[PATCH 4/4] build: fix that LZO file is always rebuilt

Sascha Hauer s.hauer at pengutronix.de
Fri Jan 5 06:57:17 PST 2018


On Fri, Jan 05, 2018 at 11:49:46AM +0100, Sascha Hauer wrote:
> Hi Sam,
> 
> On Tue, Dec 26, 2017 at 07:36:53PM +0100, Sam Ravnborg wrote:
> > From e398a00f84db33ea5ae7f6ee12c54511ef7a94fc Mon Sep 17 00:00:00 2001
> > From: Sam Ravnborg <sam at ravnborg.org>
> > Date: Tue, 26 Dec 2017 18:09:35 +0100
> > Subject: [PATCH 4/4] build: fix that LZO file is always rebuilt
> > 
> > Port the make-cmd from linux kernel.
> > with the updated version $$ is porperly escaped, thus
> > the LZO rule works as intended.
> > And we avoid rebuilds when not required
> > 
> > Signed-off-by: Sam Ravnborg <sam at ravnborg.org>
> > ---
> >  scripts/Kbuild.include | 12 +++++++-----
> >  1 file changed, 7 insertions(+), 5 deletions(-)
> > 
> > diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
> > index 310dcdc94..fb3fa88fb 100644
> > --- a/scripts/Kbuild.include
> > +++ b/scripts/Kbuild.include
> > @@ -205,11 +205,13 @@ else
> >  arg-check = $(if $(strip $(cmd_$@)),,1)
> >  endif
> >  
> > -# >'< substitution is for echo to work,
> > -# >$< substitution to preserve $ when reloading .cmd file
> > -# note: when using inline perl scripts [perl -e '...$$t=1;...']
> > -# in $(cmd_xxx) double $$ your perl vars
> > -make-cmd = $(subst \\,\\\\,$(subst \#,\\\#,$(subst $$,$$$$,$(call escsq,$(cmd_$(1))))))
> > +# Replace >$< with >$$< to preserve $ when reloading the .cmd file
> > +# (needed for make)
> > +# Replace >#< with >\#< to avoid starting a comment in the .cmd file
> > +# (needed for make)
> > +# Replace >'< with >'\''< to be able to enclose the whole string in '...'
> > +# (needed for the shell)
> > +make-cmd = $(call escsq,$(subst \#,\\\#,$(subst $$,$$$$,$(cmd_$(1)))))
> >  
> 
> This doesn't work for me. Without this patch I do not see any rebuilds
> of lzo files, but with this patch I do.
> 
> Seems you are using another shell, dash vs. bash? Porting the second
> hunk of the kernel commit 164f0d2efaaef83 fixes it for me.

Ok, applied with the missing hunk from 164f0d2efaaef83:

@@ -220,7 +222,7 @@ any-prereq = $(filter-out $(PHONY),$?) $(filter-out $(PHONY) $(wildcard $^),$^)
 if_changed = $(if $(strip $(any-prereq) $(arg-check)),                       \
        @set -e;                                                             \
        $(echo-cmd) $(cmd_$(1));                                             \
-       echo 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd)
+       printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd)
 

Please let me know if I have overlooked something.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list