Re: [PATCH] kbuild: replace $(if A,A,B) with $(or A,B)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
> To: linux-kbuild@xxxxxxxxxxxxxxx
> Cc: linux-kernel@xxxxxxxxxxxxxxx, Masahiro Yamada <masahiroy@xxxxxxxxxx>
> Subject: [PATCH] kbuild: replace $(if A,A,B) with $(or A,B)
> Message-Id: <20220210093342.2118196-1-masahiroy@xxxxxxxxxx>
> X-Mailer: git-send-email 2.32.0
> X-Mailing-List: linux-kbuild@xxxxxxxxxxxxxxx
> 
> $(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@xxxxxxxxxx>
> ---
> 
>  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 ...)

With this one fixed:
Reviewed-by: Nicolas Schier <nicolas@xxxxxxxxx>

Thanks for that patch.  I have never seen $(or) in use before but it 
definitively makes sense!

Kind regards,
Nicolas


-- 
epost|xmpp: nicolas@xxxxxxxxx          irc://oftc.net/nsc
↳ gpg: 18ed 52db e34f 860e e9fb  c82b 7d97 0932 55a0 ce7f
     -- frykten for herren er opphav til kunnskap --



[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux