diff options
author | Sam Ravnborg <sam@ravnborg.org> | 2017-12-26 19:36:53 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2018-01-05 15:56:03 +0100 |
commit | 9c62bdfac33962d7274aa1ca74e9a279d5961edf (patch) | |
tree | 11cc089f778923be17eb3e2f7d9a65bc79daf9ca /scripts/Kbuild.include | |
parent | 38517c81f2ff1a0bcdee2989515cf3ab32e39223 (diff) | |
download | barebox-9c62bdfac33962d7274aa1ca74e9a279d5961edf.tar.gz barebox-9c62bdfac33962d7274aa1ca74e9a279d5961edf.tar.xz |
build: fix that LZO file is always rebuilt
From e398a00f84db33ea5ae7f6ee12c54511ef7a94fc Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <sam@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@ravnborg.org>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'scripts/Kbuild.include')
-rw-r--r-- | scripts/Kbuild.include | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 310dcdc941..f3771902b7 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))))) # Find any prerequisites that is newer than target or that does not exist. # PHONY targets skipped in both cases. @@ -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) # Execute the command and also postprocess generated .d dependencies file. if_changed_dep = $(if $(strip $(any-prereq) $(arg-check) ), \ |