Fix Kbuild's rebuilding issue
Kbuild was rebuilding the entire kernel on each make. This might be due
to a recent change in GNU make. When running with make V=2, the change
was due to a command line difference. The difference (via hacking
Kbuild.include) was KBUILD_STR, where the \#s was getting commented out
from one of the versions of the cmd_ arguments.
Anyway, the simplest thing was to remove KBUILD_STR, which Linux already
did. This commit basically "side-ports" Linux commit b42841b7bb62
("kbuild: Get rid of KBUILD_STR"), plus adding 'quote'.
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index ed2773e..d3284d7 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -3,6 +3,7 @@
# Convenient variables
comma := ,
+quote := "
squote := '
empty :=
space := $(empty) $(empty)
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 2ce73ec..0664529 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -96,10 +96,10 @@
# Note: It's possible that one object gets potentially linked into more
# than one module. In that case KBUILD_MODNAME will be set to foo_bar,
# where foo and bar are the name of the modules.
-name-fix = $(subst $(comma),_,$(subst -,_,$1))
-basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))"
+name-fix = $(squote)$(quote)$(subst $(comma),_,$(subst -,_,$1))$(quote)$(squote)
+basename_flags = -DKBUILD_BASENAME=$(call name-fix,$(basetarget))
modname_flags = $(if $(filter 1,$(words $(modname))),\
- -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))")
+ -DKBUILD_MODNAME=$(call name-fix,$(modname)))
#hash values
ifdef CONFIG_DYNAMIC_DEBUG
@@ -152,7 +152,7 @@
c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(AKAROSINCLUDE) \
$(__c_flags) $(modkern_cflags) \
- -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags) \
+ $(basename_flags) $(modname_flags) \
$(debug_flags)
a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(AKAROSINCLUDE) \