From 566c990eba0a98aeedd27fe560a56346229fe2eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Harter?= Date: Fri, 25 Jan 2019 16:52:10 +0100 Subject: [PATCH] makefiles/toolchain: fix command -v multiple commands `command -v first second third` only works in `bash` and not in `sh`. So replace with multiple calls to `command`. This fixes using `objcopy` when the toolchain `objcopy` is not available. --- makefiles/toolchain/gnu.inc.mk | 2 +- makefiles/toolchain/llvm.inc.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/makefiles/toolchain/gnu.inc.mk b/makefiles/toolchain/gnu.inc.mk index 6c9fddb83d44..a65d433c7da7 100644 --- a/makefiles/toolchain/gnu.inc.mk +++ b/makefiles/toolchain/gnu.inc.mk @@ -13,7 +13,7 @@ export NM = $(PREFIX)nm export LINK = $(PREFIX)gcc export LINKXX = $(PREFIX)g++ export SIZE = $(PREFIX)size -export OBJCOPY ?= $(shell command -v $(PREFIX)objcopy gobjcopy objcopy | head -n 1) +export OBJCOPY ?= $(shell command -v $(PREFIX)objcopy || command -v gobjcopy || command -v objcopy) ifeq ($(OBJCOPY),) $(warning objcopy not found. Hex file will not be created.) export OBJCOPY = true diff --git a/makefiles/toolchain/llvm.inc.mk b/makefiles/toolchain/llvm.inc.mk index 67b8bda40764..f005ca7092ad 100644 --- a/makefiles/toolchain/llvm.inc.mk +++ b/makefiles/toolchain/llvm.inc.mk @@ -20,7 +20,7 @@ export LINK = $(PREFIX)gcc export LINKXX = $(PREFIX)g++ # objcopy does not have a clear substitute in LLVM, use GNU binutils #export OBJCOPY = $(LLVMPREFIX)objcopy -export OBJCOPY ?= $(shell command -v $(PREFIX)objcopy gobjcopy objcopy | head -n 1) +export OBJCOPY ?= $(shell command -v $(PREFIX)objcopy || command -v gobjcopy || command -v objcopy) ifeq ($(OBJCOPY),) $(warning objcopy not found. Hex file will not be created.) export OBJCOPY = true