diff mbox series

Makefile: fix shell error for darwin major/minor version check

Message ID 20230122004210.26791-1-ansuelsmth@gmail.com
State Accepted
Commit 748c1ab464852eaca06a57af067565e73223e7bb
Delegated to: Tom Rini
Headers show
Series Makefile: fix shell error for darwin major/minor version check | expand

Commit Message

Christian Marangi Jan. 22, 2023, 12:42 a.m. UTC
Fix shell error:
 /bin/sh: line 0: [: too many arguments

for the darwin major/minor version check.

It seems for os_x_before for some reason DARWIN_MAJOR_VERSION and
DARWIN_MINOR_VERSION are empty. To fix this set DARWIN_MAJOR_VERSION
and DARWIN_MINOR_VERSION to be evaluated once so the value is retained.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Simon Glass Jan. 23, 2023, 6:49 p.m. UTC | #1
On Sat, 21 Jan 2023 at 17:42, Christian Marangi <ansuelsmth@gmail.com> wrote:
>
> Fix shell error:
>  /bin/sh: line 0: [: too many arguments
>
> for the darwin major/minor version check.
>
> It seems for os_x_before for some reason DARWIN_MAJOR_VERSION and
> DARWIN_MINOR_VERSION are empty. To fix this set DARWIN_MAJOR_VERSION
> and DARWIN_MINOR_VERSION to be evaluated once so the value is retained.
>
> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> ---
>  Makefile | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>

Reviewed-by: Simon Glass <sjg@chromium.org>
Tom Rini Feb. 7, 2023, 4:53 p.m. UTC | #2
On Sun, Jan 22, 2023 at 01:42:10AM +0100, Christian Marangi wrote:

> Fix shell error:
>  /bin/sh: line 0: [: too many arguments
> 
> for the darwin major/minor version check.
> 
> It seems for os_x_before for some reason DARWIN_MAJOR_VERSION and
> DARWIN_MINOR_VERSION are empty. To fix this set DARWIN_MAJOR_VERSION
> and DARWIN_MINOR_VERSION to be evaluated once so the value is retained.
> 
> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index eb354c045c..fceac081c8 100644
--- a/Makefile
+++ b/Makefile
@@ -318,8 +318,8 @@  endif
 #
 ifeq ($(HOSTOS),darwin)
 # get major and minor product version (e.g. '10' and '6' for Snow Leopard)
-DARWIN_MAJOR_VERSION	= $(shell sw_vers -productVersion | cut -f 1 -d '.')
-DARWIN_MINOR_VERSION	= $(shell sw_vers -productVersion | cut -f 2 -d '.')
+DARWIN_MAJOR_VERSION	:= $(shell sw_vers -productVersion | cut -f 1 -d '.')
+DARWIN_MINOR_VERSION	:= $(shell sw_vers -productVersion | cut -f 2 -d '.')
 
 os_x_before	= $(shell if [ $(DARWIN_MAJOR_VERSION) -le $(1) -a \
 	$(DARWIN_MINOR_VERSION) -le $(2) ] ; then echo "$(3)"; else echo "$(4)"; fi ;)