From: Alexander Lobakin <alexandr.lobakin@intel.com>
To: Nicolas Schier <nicolas@fjasle.eu>
Cc: Alexander Lobakin <alexandr.lobakin@intel.com>,
Masahiro Yamada <masahiroy@kernel.org>,
linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>
Subject: Re: [PATCH v3 3/5] kbuild: add read-file macro
Date: Mon, 12 Dec 2022 15:37:11 +0100 [thread overview]
Message-ID: <20221212143711.3536777-1-alexandr.lobakin@intel.com> (raw)
In-Reply-To: <Y5Tz+MBfYMVkqAn3@fjasle.eu>
From: Nicolas Schier <nicolas@fjasle.eu>
Date: Sat, 10 Dec 2022 22:02:48 +0100
> On Sat, Dec 10, 2022 at 11:10:12PM +0900 Masahiro Yamada wrote:
> > On Thu, Dec 8, 2022 at 1:25 AM Alexander Lobakin
> > <alexandr.lobakin@intel.com> wrote:
> > >
> > > From: Alexander Lobakin <alexandr.lobakin@intel.com>
> > > Date: Wed, 7 Dec 2022 16:40:44 +0100
> > >
> > > > From: Masahiro Yamada <masahiroy@kernel.org>
> > > > Date: Sun, 27 Nov 2022 07:56:22 +0900
> > > >
> > > > > Since GNU Make 4.2, $(file ...) supports the read operater '<', which
> > > > > is useful to read a file without forking any process. No warning is
> > > > > shown even if the input file is missing.
> > >
> > > [...]
> > >
> > > > Great stuff. Used it in my upcoming series to simplify things, works
> > > > as expected.
> > > >
> > > > sed-syms = $(subst $(space),\|,$(foreach file,$(sym-files-y),$(call read-file,$(file))))
> > > >
> > > > The only thing that came to my mind while I was implementing the
> > > > oneliner above: maybe add ability to read multiple files? For now,
> > > > I used a foreach, could it be somehow incorporated into read-file
> > > > already?
> > >
> > > Oh, nevermind. This one also works:
> > >
> > > sed-syms = $(subst $(space),\|,$(call read-file,$(sym-files-y)))
> > >
> > > So I believe read-file works for an arbitrary number of files.
> >
> >
> >
> > Really?
> >
> >
> > In my understanding, $(call read-file, foo bar) reads a single file "foo bar".
> > (a space in the file name).
>
> yes, except for make < 4.2, due to:
>
> read-file = $(shell cat $1 2>/dev/null)
$ make --version
GNU Make 4.3
Built for x86_64-redhat-linux-gnu
But breh, I forgot to port test-ge, so Kbuild was always calling
cat :D :clownface:
Correct, current implementation (as of v3) reads only single file.
Not sure whether read-file should handle multiple at a time.
Thanks,
Olek
next prev parent reply other threads:[~2022-12-12 14:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-26 22:56 [PATCH v3 1/5] kbuild: add test-{le,ge,lt,gt} macros Masahiro Yamada
2022-11-26 22:56 ` [PATCH v3 2/5] kbuild: implement {gcc,clang}-min-version only with built-in functions Masahiro Yamada
2022-11-26 22:56 ` [PATCH v3 3/5] kbuild: add read-file macro Masahiro Yamada
2022-12-07 15:40 ` Alexander Lobakin
2022-12-07 16:22 ` Alexander Lobakin
2022-12-10 14:10 ` Masahiro Yamada
2022-12-10 21:02 ` Nicolas Schier
2022-12-12 14:37 ` Alexander Lobakin [this message]
2022-11-26 22:56 ` [PATCH v3 4/5] kconfig: refactor Makefile to reduce process forks Masahiro Yamada
2022-11-26 22:56 ` [PATCH v3 5/5] kbuild: check Make version 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=20221212143711.3536777-1-alexandr.lobakin@intel.com \
--to=alexandr.lobakin@intel.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=nicolas@fjasle.eu \
/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®