diff --git a/Makefile.flags b/Makefile.flags index e378fbad9..bed766b8a 100644 --- a/Makefile.flags +++ b/Makefile.flags @@ -15,7 +15,7 @@ CPPFLAGS += \ -include include/autoconf.h \ -D_GNU_SOURCE -DNDEBUG \ $(if $(CONFIG_LFS),-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64) \ - -D"BB_VER=KBUILD_STR($(BB_VER))" + -DBB_VER=$(squote)$(quote)$(BB_VER)$(quote)$(squote) CFLAGS += $(call cc-option,-Wall,) CFLAGS += $(call cc-option,-Wshadow,) diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 6ec1809a2..5b4db5c2c 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -4,6 +4,7 @@ # Convinient variables comma := , squote := ' +quote := " empty := space := $(empty) $(empty) diff --git a/scripts/Makefile.IMA b/scripts/Makefile.IMA index f155108d7..1e3005864 100644 --- a/scripts/Makefile.IMA +++ b/scripts/Makefile.IMA @@ -49,7 +49,6 @@ OBJCOPY = $(CROSS_COMPILE)objcopy OBJDUMP = $(CROSS_COMPILE)objdump CFLAGS := $(CFLAGS) -CPPFLAGS += -D"KBUILD_STR(s)=\#s" #-Q # We need some generic definitions include $(srctree)/scripts/Kbuild.include diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 3e54ea712..d8d768a28 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -81,10 +81,10 @@ obj-dirs := $(addprefix $(obj)/,$(obj-dirs)) # 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,$(*F)))" +name-fix = $(squote)$(quote)$(subst $(comma),_,$(subst -,_,$1))$(quote)$(squote) +basename_flags = -DKBUILD_BASENAME=$(call name-fix,$(*F)) modname_flags = $(if $(filter 1,$(words $(modname))),\ - -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))") + -DKBUILD_MODNAME=$(call name-fix,$(modname))) _c_flags = $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o) _a_flags = $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o) @@ -110,7 +110,7 @@ endif c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(CPPFLAGS) \ $(__c_flags) $(modkern_cflags) \ - -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags) + $(basename_flags) $(modname_flags) a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(CPPFLAGS) \ $(__a_flags) $(modkern_aflags) diff --git a/scripts/trylink b/scripts/trylink index bb6b2de2f..6b74f092d 100755 --- a/scripts/trylink +++ b/scripts/trylink @@ -50,9 +50,6 @@ check_cc() { echo "int main(int argc,char**argv){return argv?argc:0;}" >"$tempname".c # Can use "-o /dev/null", but older gcc tend to *unlink it* on failure! :( # Was using "-xc /dev/null", but we need a valid C program. - # "eval" may be needed if CFLAGS can contain - # '... -D"BB_VER=KBUILD_STR(1.N.M)" ...' - # and we need shell to process quotes! $CC $CFLAGS $LDFLAGS $1 "$tempname".c -o "$tempname" >/dev/null 2>&1 exitcode=$? rm -f "$tempname" "$tempname".c "$tempname".o