lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 10 Feb 2022 22:00:56 +0100
From:   Nicolas Schier <nicolas@...sle.eu>
To:     Masahiro Yamada <masahiroy@...nel.org>
Cc:     linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kbuild: replace $(if A,A,B) with $(or A,B)

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 ...)

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 --

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ