[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1507802164-31614-2-git-send-email-yamada.masahiro@socionext.com>
Date: Thu, 12 Oct 2017 18:56:03 +0900
From: Masahiro Yamada <yamada.masahiro@...ionext.com>
To: linux-kbuild@...r.kernel.org
Cc: Joe Perches <joe@...ches.com>, Tom Rini <trini@...sulko.com>,
Geert Uytterhoeven <geert+renesas@...der.be>,
Masahiro Yamada <yamada.masahiro@...ionext.com>,
Matthias Kaehlcke <mka@...omium.org>,
Cao jin <caoj.fnst@...fujitsu.com>,
Arnd Bergmann <arnd@...db.de>, James Hogan <jhogan@...nel.org>,
linux-kernel@...r.kernel.org,
Jan-Simon Möller <dl9pf@....de>,
Michal Marek <michal.lkml@...kovi.net>,
Douglas Anderson <dianders@...omium.org>,
Josh Poimboeuf <jpoimboe@...hat.com>,
Ingo Molnar <mingo@...nel.org>,
Mark Charlebois <charlebm@...il.com>
Subject: [PATCH 1/2] kbuild: add stringify helper to quote a string passed to C files
I want to reuse $(squote)$(quote)...$(quote)$(squote) in the next
commit. Move it to a helper.
Signed-off-by: Masahiro Yamada <yamada.masahiro@...ionext.com>
---
scripts/Kbuild.include | 4 ++++
scripts/Makefile.lib | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index db81df3..0b97354 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -33,6 +33,10 @@ baseprereq = $(basename $(notdir $<))
escsq = $(subst $(squote),'\$(squote)',$1)
###
+# Quote a string to pass it to C files. foo => '"foo"'
+stringify = $(squote)$(quote)$1$(quote)$(squote)
+
+###
# Easy method for doing a status message
kecho := :
quiet_kecho := echo
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 580e605..9bbb019 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -89,7 +89,7 @@ obj-dirs := $(addprefix $(obj)/,$(obj-dirs))
# Note: Files that end up in two or more modules are compiled without the
# KBUILD_MODNAME definition. The reason is that any made-up name would
# differ in different configs.
-name-fix = $(squote)$(quote)$(subst $(comma),_,$(subst -,_,$1))$(quote)$(squote)
+name-fix = $(call stringify,$(subst $(comma),_,$(subst -,_,$1)))
basename_flags = -DKBUILD_BASENAME=$(call name-fix,$(basetarget))
modname_flags = $(if $(filter 1,$(words $(modname))),\
-DKBUILD_MODNAME=$(call name-fix,$(modname)))
--
2.7.4
Powered by blists - more mailing lists