mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rob Landley <rob@landley.net>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Masahiro Yamada <masahiroy@kernel.org>,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Nicolas Schier <nicolas@fjasle.eu>, Tom Rix <trix@redhat.com>,
	linux-kbuild@vger.kernel.org, llvm@lists.linux.dev
Subject: [PATCH 1/5] try generic compiler name "cc" before falling back to "gcc".
Date: Tue, 21 Feb 2023 14:55:10 -0600	[thread overview]
Message-ID: <63c2936e-6bc7-67e3-eaf3-0123333381f8@landley.net> (raw)
In-Reply-To: <b455394f-9faa-1f1a-f171-0b9d5e9ada35@landley.net>

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@landley.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

  reply	other threads:[~2023-02-21 20:41 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-21 20:53 [PATCH 0/5] Patches used to build mkroot Rob Landley
2023-02-21 20:55 ` Rob Landley [this message]
2023-02-23  5:31   ` [PATCH 1/5] try generic compiler name "cc" before falling back to "gcc" Masahiro Yamada
2023-02-23 13:50     ` Rob Landley
2023-02-24  0:27       ` Masahiro Yamada
2023-02-21 20:56 ` [PATCH 2/5] X86-64 should not uniquely require a third ELF package to build Rob Landley
2023-02-21 23:12   ` Thomas Gleixner
2023-02-22 18:14     ` Rob Landley
2023-02-22 18:41       ` Thomas Gleixner
2023-02-21 20:57 ` [PATCH 3/5] Wire up CONFIG_DEVTMPFS_MOUNT to initramfs Rob Landley
2023-02-21 21:00 ` [PATCH 4/5] Replace timeconst.bc with mktimeconst.c Rob Landley
2023-02-21 23:53   ` Thomas Gleixner
2023-02-22 22:52     ` Rob Landley
2023-02-21 21:04 ` [PATCH 5/5] fix rootfstype=tmpfs Rob Landley
2023-11-01 13:10   ` Stefan Berger
2023-11-08 22:05     ` Stefan Berger
2023-11-09 16:42       ` Rob Landley
2023-11-09 16:46         ` Rob Landley
2023-11-09 16:55           ` Rob Landley
2023-02-23 20:35 ` [PATCH 0/5] Patches used to build mkroot Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=63c2936e-6bc7-67e3-eaf3-0123333381f8@landley.net \
    --to=rob@landley.net \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=masahiroy@kernel.org \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=nicolas@fjasle.eu \
    --cc=trix@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®