diff mbox series

[v2,1/2] Makefile: Fix detection of cross compiler

Message ID 20220308014543.1308349-2-joel@jms.id.au
State Accepted
Headers show
Series Build and deploy docs | expand

Commit Message

Joel Stanley March 8, 2022, 1:45 a.m. UTC
The Fedora containers don't have 'which' installed. This means the
detection of the cross compiler gives false negatives, leaving CROSS
undefined.

Instead use command -v, which outputs the path of the executable if it
exists.

Fixes: 9cd556ca1e5f ("Makefile: Search for distro-provided cross-compiler")
Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 Makefile | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index 625f212eaa99..f3942c442a84 100644
--- a/Makefile
+++ b/Makefile
@@ -16,13 +16,13 @@  ifdef CROSS_COMPILE
 endif
 ifneq ("$(ARCH)", "ppc64")
 ifneq ("$(ARCH)", "ppc64le")
-ifneq ($(shell which powerpc64-linux-gcc 2> /dev/null),)
+ifneq ($(shell command -v powerpc64-linux-gcc 2> /dev/null),)
 	CROSS ?= powerpc64-linux-
-else ifneq ($(shell which powerpc64le-linux-gcc 2> /dev/null),)
+else ifneq ($(shell command -v powerpc64le-linux-gcc 2> /dev/null),)
 	CROSS ?= powerpc64le-linux-
-else ifneq ($(shell which powerpc64-linux-gnu-gcc 2> /dev/null),)
+else ifneq ($(shell command -v powerpc64-linux-gnu-gcc 2> /dev/null),)
 	CROSS ?= powerpc64-linux-gnu-
-else ifneq ($(shell which powerpc64le-linux-gnu-gcc 2> /dev/null),)
+else ifneq ($(shell command -v powerpc64le-linux-gnu-gcc 2> /dev/null),)
 	CROSS ?= powerpc64le-linux-gnu-
 endif
 endif