Re: [PATCH 4.4 14/43] tools build: fix # escaping in .cmd files for future Make

From: Konstantin Khlebnikov
Date: Tue Jul 17 2018 - 09:05:41 EST


This commit depends on commit 9564a8cf422d7b58f6e857e3546d346fa970191e
"Kbuild: fix # escaping in .cmd files for future Make"
which is missing in 4.4.141


this breaks compilation of tools/perf for me

make -C tools/perf V=1 JOBS=24 WERROR=0 NO_GTK2=1 LDFLAGS=-static all
make[1]: Entering directory `/tmp/buildd/linux-yandex-4.4.141/tools/perf'
BUILD: Doing 'make -j24' parallel build

Auto-detecting system features:
... dwarf: [ on ]
... dwarf_getlocations: [ OFF ]
... glibc: [ on ]
... gtk2: [ OFF ]
... libaudit: [ on ]
... libbfd: [ on ]
... libelf: [ on ]
... libnuma: [ on ]
... numa_num_possible_cpus: [ on ]
... libperl: [ OFF ]
... libpython: [ OFF ]
... libslang: [ on ]
... libunwind: [ on ]
... libdw-dwarf-unwind: [ OFF ]
... zlib: [ on ]
... lzma: [ on ]
... get_cpuid: [ on ]
... bpf: [ on ]

config/Makefile:274: No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set LIBDW_DIR
config/Makefile:282: Old libdw.h, finding variables at given 'perf probe' point will not work, install elfutils-devel/libdw-dev >= 0.157
config/Makefile:458: Missing perl devel files. Disabling perl scripting support, please install perl-ExtUtils-Embed/libperl-dev
config/Makefile:501: No 'Python.h' (for Python 2.x support) was found: disables Python support - please install python-devel/python-dev
$(:)
make -C /tmp/buildd/linux-yandex-4.4.141/tools/build fixdep
/bin/sh util/PERF-VERSION-GEN
make -f /tmp/buildd/linux-yandex-4.4.141/tools/build/Makefile.build dir=. obj=fixdep
. util/generate-cmdlist.sh > common-cmds.h+ && mv common-cmds.h+ common-cmds.h
.fixdep.o.cmd:1: *** missing separator. Stop.
make[3]: *** [fixdep-in.o] Error 2
make[2]: *** [fixdep] Error 2


On 16.07.2018 10:36, Greg Kroah-Hartman wrote:
4.4-stable review patch. If anyone has any objections, please let me know.

------------------

From: Paul Menzel <pmenzel@xxxxxxxxxxxxx>

commit 9feeb638cde083c737e295c0547f1b4f28e99583 upstream.

In 2016 GNU Make made a backwards incompatible change to the way '#'
characters were handled in Makefiles when used inside functions or
macros:

http://git.savannah.gnu.org/cgit/make.git/commit/?id=c6966b323811c37acedff05b57

Due to this change, when attempting to run `make prepare' I get a
spurious make syntax error:

/home/earnest/linux/tools/objtool/.fixdep.o.cmd:1: *** missing separator. Stop.

When inspecting `.fixdep.o.cmd' it includes two lines which use
unescaped comment characters at the top:

\# cannot find fixdep (/home/earnest/linux/tools/objtool//fixdep)
\# using basic dep data

This is because `tools/build/Build.include' prints these '\#'
characters:

printf '\# cannot find fixdep (%s)\n' $(fixdep) > $(dot-target).cmd; \
printf '\# using basic dep data\n\n' >> $(dot-target).cmd; \

This completes commit 9564a8cf422d ("Kbuild: fix # escaping in .cmd files
for future Make").

Link: https://bugzilla.kernel.org/show_bug.cgi?id=197847
Cc: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
Cc: Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Paul Menzel <pmenzel@xxxxxxxxxxxxx>
Signed-off-by: Masahiro Yamada <yamada.masahiro@xxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
tools/build/Build.include | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

--- a/tools/build/Build.include
+++ b/tools/build/Build.include
@@ -62,8 +62,8 @@ dep-cmd = $(if $(wildcard $(fixdep)),
$(fixdep) $(depfile) $@ '$(make-cmd)' > $(dot-target).tmp; \
rm -f $(depfile); \
mv -f $(dot-target).tmp $(dot-target).cmd, \
- printf '\# cannot find fixdep (%s)\n' $(fixdep) > $(dot-target).cmd; \
- printf '\# using basic dep data\n\n' >> $(dot-target).cmd; \
+ printf '$(pound) cannot find fixdep (%s)\n' $(fixdep) > $(dot-target).cmd; \
+ printf '$(pound) using basic dep data\n\n' >> $(dot-target).cmd; \
cat $(depfile) >> $(dot-target).cmd; \
printf '%s\n' 'cmd_$@ := $(make-cmd)' >> $(dot-target).cmd)