busybox/scripts
Jean-Philippe Brucker ed8af51b60 build system: remove KBUILD_STR()
When using GNU Make >=4.3, the KBUILD_STR() definition interferes badly
with dependency checks during build, and forces a complete rebuild every
time Make runs.

In if_changed_rule, Kconfig checks if the command used to build a file
has changed since last execution. The previous command is stored in the
generated .<file>.o.cmd file. For example applets/.applets.o.cmd defines
a "cmd_applets/applets.o" variable:

	cmd_applets/applets.o := gcc ... -D"KBUILD_STR(s)=#s" ...

Here the '#' should be escaped with a backslash, otherwise GNU Make
interprets it as starting a comment, and ignore the rest of the
variable. As a result of this truncation, the previous command doesn't
equal the new command and Make rebuilds each target.

The problem started to appear when GNU Make 4.3 (released January 2020),
introduced a backward-incompatible fix to macros containing a '#'. While
the above use of '#', a simple Make variable, still needs to be escaped,
a '#' within a function invocation doesn't need to be escaped anymore.
As Martin Dorey explained on the GNU Make discussion [1], the above
declaration is generated from make-cmd, defined as:

	make-cmd = $(subst \#,\\\#,$(subst $$,$$$$,$(call escsq,$(cmd_$(1))))

Since GNU Make 4.3, the first argument of subst should not have a
backslash. make-cmd now looks for literally \# and doesn't find it, and
as a result doesn't add the backslash when generating .o.cmd files.

[1] http://savannah.gnu.org/bugs/?20513

We could fix it by changing make-cmd to "$(subst #,\#,...)", but to
avoid compatibility headaches, simply get rid of the KBUILD_STR
definition, as done in Linux by b42841b7bb62 ("kbuild: Get rid of
KBUILD_STR"). Quote the string arguments directly rather than asking the
preprocessor to quote them.

Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-04-29 14:52:19 +02:00
..
basic build system: fix compiler warnings 2019-01-06 20:12:16 +01:00
kconfig build system: fix compiler warnings 2019-01-06 20:12:16 +01:00
bb_release Update release script to generate detached signatures and checksum files 2018-06-09 21:19:35 +02:00
bloat-o-meter bloat-o-meter: add usage info 2013-10-16 19:18:05 +02:00
checkhelp.awk
checkstack.pl checkstack.pl: tweak bfin re 2019-01-18 09:56:19 +01:00
cleanup_printf2puts typo fix 2010-11-06 22:17:30 +01:00
echo.c scripts/echo.c: resolve implicit declaration of function 'dup2' 2019-03-05 16:57:04 +01:00
embedded_scripts hush: allow hush to run embedded scripts 2018-11-27 16:13:07 +01:00
find_bad_common_bufsiz
find_stray_common_vars
find_stray_empty_lines
fix_ws.sh
gcc-version.sh
gen_build_files.sh hush: allow hush to run embedded scripts 2018-11-27 16:13:07 +01:00
generate_BUFSIZ.sh build system: make CONFIG_FEATURE_USE_BSS_TAIL less funky 2016-06-29 15:00:52 +02:00
Kbuild.include build system: remove KBUILD_STR() 2020-04-29 14:52:19 +02:00
Kbuild.src
Makefile.build build system: specify '-nostldlib' when linking to .o files 2014-04-02 12:12:46 +02:00
Makefile.clean
Makefile.host
Makefile.IMA build system: remove KBUILD_STR() 2020-04-29 14:52:19 +02:00
Makefile.lib build system: remove KBUILD_STR() 2020-04-29 14:52:19 +02:00
memusage
mkconfigs build system: use od -b instead of od -t x1 2013-11-26 14:56:29 +01:00
mkdiff_obj scripts/mkdiff_obj: show "size OBJFILE" too 2010-10-29 19:06:20 +02:00
mkdiff_obj_bloat
mkmakefile
objsizes
randomtest scripts/randomtest: disable CONFIG_NSLOOKUP for uclibc 2018-06-26 17:22:35 +02:00
randomtest.loop randomconfig fixes 2017-12-31 17:30:02 +01:00
sample_pmap
showasm
test_make_clean
test_make_O
test_setenv_leak.c crond: do not assume setenv() does not leak 2017-07-22 02:25:47 +02:00
trylink build system: remove KBUILD_STR() 2020-04-29 14:52:19 +02:00