From: Masahiro Yamada <yamada.masahiro@socionext.com>
To: linux-kbuild@vger.kernel.org
Cc: "Joe Perches" <joe@perches.com>, "Tom Rini" <trini@konsulko.com>,
"Geert Uytterhoeven" <geert+renesas@glider.be>,
"Masahiro Yamada" <yamada.masahiro@socionext.com>,
"Matthias Kaehlcke" <mka@chromium.org>,
"Cao jin" <caoj.fnst@cn.fujitsu.com>,
"Arnd Bergmann" <arnd@arndb.de>,
"James Hogan" <jhogan@kernel.org>,
linux-kernel@vger.kernel.org, "Jan-Simon Möller" <dl9pf@gmx.de>,
"Michal Marek" <michal.lkml@markovi.net>,
"Douglas Anderson" <dianders@chromium.org>,
"Josh Poimboeuf" <jpoimboe@redhat.com>,
"Ingo Molnar" <mingo@kernel.org>,
"Mark Charlebois" <charlebm@gmail.com>
Subject: [PATCH 1/2] kbuild: add stringify helper to quote a string passed to C files
Date: Thu, 12 Oct 2017 18:56:03 +0900 [thread overview]
Message-ID: <1507802164-31614-2-git-send-email-yamada.masahiro@socionext.com> (raw)
In-Reply-To: <1507802164-31614-1-git-send-email-yamada.masahiro@socionext.com>
I want to reuse $(squote)$(quote)...$(quote)$(squote) in the next
commit. Move it to a helper.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.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
next prev parent reply other threads:[~2017-10-12 9:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-12 9:56 [PATCH 0/2] kbuild: use relative path from $(srctree) instead of __FILE__ Masahiro Yamada
2017-10-12 9:56 ` Masahiro Yamada [this message]
2017-10-12 9:56 ` [PATCH 2/2] kbuild: redefine __FILE__ as relative path from $(srctree) if possible Masahiro Yamada
2017-10-14 20:15 ` kbuild test robot
2017-10-14 3:17 ` [PATCH 0/2] kbuild: use relative path from $(srctree) instead of __FILE__ Masahiro Yamada
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1507802164-31614-2-git-send-email-yamada.masahiro@socionext.com \
--to=yamada.masahiro@socionext.com \
--cc=arnd@arndb.de \
--cc=caoj.fnst@cn.fujitsu.com \
--cc=charlebm@gmail.com \
--cc=dianders@chromium.org \
--cc=dl9pf@gmx.de \
--cc=geert+renesas@glider.be \
--cc=jhogan@kernel.org \
--cc=joe@perches.com \
--cc=jpoimboe@redhat.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.lkml@markovi.net \
--cc=mingo@kernel.org \
--cc=mka@chromium.org \
--cc=trini@konsulko.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®