[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAK7LNATAYb_s7_DVXPcNU7LBgTA5_-dC8P1NLUyvSTLcv+8vWg@mail.gmail.com>
Date: Fri, 11 Feb 2022 14:14:53 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: Nicolas Schier <nicolas@...sle.eu>
Cc: Linux Kbuild mailing list <linux-kbuild@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] kbuild: replace $(if A,A,B) with $(or A,B)
On Fri, Feb 11, 2022 at 6:08 AM Nicolas Schier <nicolas@...sle.eu> wrote:
>
> På to. 10. feb. 2022 kl. 18.33 +0000 skrev Masahiro Yamada:
> > Date: Thu, 10 Feb 2022 18:33:42 +0900
> > From: Masahiro Yamada <masahiroy@...nel.org>
> > To: linux-kbuild@...r.kernel.org
> > Cc: linux-kernel@...r.kernel.org, Masahiro Yamada <masahiroy@...nel.org>
> > Subject: [PATCH] kbuild: replace $(if A,A,B) with $(or A,B)
> > Message-Id: <20220210093342.2118196-1-masahiroy@...nel.org>
> > X-Mailer: git-send-email 2.32.0
> > X-Mailing-List: linux-kbuild@...r.kernel.org
> >
> > $(or ...) is available since GNU Make 3.81, and useful to shorten the
> > code in some places.
> >
> > Covert as follows:
> >
> > $(if A,A,B) --> $(or A,B)
> >
> > Signed-off-by: Masahiro Yamada <masahiroy@...nel.org>
> > ---
> >
> > Makefile | 8 ++++----
> > scripts/Makefile.build | 3 +--
> > scripts/Makefile.clean | 2 +-
> > scripts/Makefile.lib | 4 ++--
> > tools/bpf/bpftool/Makefile | 4 ++--
> > tools/build/Makefile | 2 +-
> > tools/counter/Makefile | 2 +-
> > tools/gpio/Makefile | 2 +-
> > tools/hv/Makefile | 2 +-
> > tools/iio/Makefile | 2 +-
> > tools/lib/api/Makefile | 2 +-
> > tools/lib/bpf/Makefile | 2 +-
> > tools/lib/perf/Makefile | 2 +-
> > tools/lib/subcmd/Makefile | 2 +-
> > tools/objtool/Makefile | 2 +-
> > tools/pci/Makefile | 2 +-
> > tools/perf/Makefile.perf | 4 ++--
> > tools/power/x86/intel-speed-select/Makefile | 2 +-
> > tools/scripts/utilities.mak | 2 +-
> > tools/spi/Makefile | 6 +++---
> > tools/tracing/rtla/Makefile | 2 +-
> > tools/usb/Makefile | 2 +-
> > 22 files changed, 30 insertions(+), 31 deletions(-)
> >
> [...]
> > diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
> > index f947b61b2107..df1f6ff7bc49 100644
> > --- a/tools/lib/bpf/Makefile
> > +++ b/tools/lib/bpf/Makefile
> > @@ -60,7 +60,7 @@ ifndef VERBOSE
> > VERBOSE = 0
> > endif
> >
> > -INCLUDES = -I$(if $(OUTPUT),$(OUTPUT),.) \
> > +INCLUDES = -I$(or $(OUTPUT),.) \
> > -I$(srctree)/tools/include -I$(srctree)/tools/include/uapi
>
> I think I'd have shortened the whitespaces before the stray backslash.
>
> >
> > export prefix libdir src obj
> > diff --git a/tools/lib/perf/Makefile b/tools/lib/perf/Makefile
> > index 08fe6e3c4089..2d985d6a3a96 100644
> > --- a/tools/lib/perf/Makefile
> > +++ b/tools/lib/perf/Makefile
> > @@ -153,7 +153,7 @@ $(TESTS_STATIC): $(TESTS_IN) $(LIBPERF_A) $(LIBAPI)
> > $(QUIET_LINK)$(CC) -o $@ $^
> >
> > $(TESTS_SHARED): $(TESTS_IN) $(LIBAPI)
> > - $(QUIET_LINK)$(CC) -o $@ -L$(if $(OUTPUT),$(OUTPUT),.) $^ -lperf
> > + $(QUIET_LINK)$(CC) -o $@ -L$(if $(OUTPUT),.) $^ -lperf
>
> $(if ...) -> $(or ...)
Oops, thanks. I fixed it and sent v2.
> With this one fixed:
> Reviewed-by: Nicolas Schier <nicolas@...sle.eu>
>
> Thanks for that patch. I have never seen $(or) in use before but it
> definitively makes sense!
>
> Kind regards,
> Nicolas
>
>
> --
> epost|xmpp: nicolas@...sle.eu irc://oftc.net/nsc
> ↳ gpg: 18ed 52db e34f 860e e9fb c82b 7d97 0932 55a0 ce7f
> -- frykten for herren er opphav til kunnskap --
--
Best Regards
Masahiro Yamada
Powered by blists - more mailing lists