[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <63c2936e-6bc7-67e3-eaf3-0123333381f8@landley.net>
Date: Tue, 21 Feb 2023 14:55:10 -0600
From: Rob Landley <rob@...dley.net>
To: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Cc: Masahiro Yamada <masahiroy@...nel.org>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Nicolas Schier <nicolas@...sle.eu>, Tom Rix <trix@...hat.com>,
linux-kbuild@...r.kernel.org, llvm@...ts.linux.dev
Subject: [PATCH 1/5] try generic compiler name "cc" before falling back to
"gcc".
Distros like debian install the generic "cc" name for both gcc and clang,
and the plumbing already does CC_VERSION_TEXT to include Makefile.clang.
Previously: https://lkml.iu.edu/hypermail/linux/kernel/2202.0/01505.html
Signed-off-by: Rob Landley <rob@...dley.net>
---
Makefile | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 3f6628780eb2..0ac57ae3b45f 100644
--- a/Makefile
+++ b/Makefile
@@ -456,7 +456,7 @@ endif
HOSTCC = $(LLVM_PREFIX)clang$(LLVM_SUFFIX)
HOSTCXX = $(LLVM_PREFIX)clang++$(LLVM_SUFFIX)
else
-HOSTCC = gcc
+HOSTCC := $(shell cc --version >/dev/null 2>&1 && echo cc || echo gcc)
HOSTCXX = g++
endif
HOSTRUSTC = rustc
@@ -503,7 +503,8 @@ OBJDUMP = $(LLVM_PREFIX)llvm-objdump$(LLVM_SUFFIX)
READELF = $(LLVM_PREFIX)llvm-readelf$(LLVM_SUFFIX)
STRIP = $(LLVM_PREFIX)llvm-strip$(LLVM_SUFFIX)
else
-CC = $(CROSS_COMPILE)gcc
+CC := $(CROSS_COMPILE)$(shell $(CROSS_COMPILE)cc --version \
+ >/dev/null 2>&1 && echo cc || echo gcc)
LD = $(CROSS_COMPILE)ld
AR = $(CROSS_COMPILE)ar
NM = $(CROSS_COMPILE)nm
Powered by blists - more mailing lists