From patchwork Tue Feb 21 20:55:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Landley X-Patchwork-Id: 60239 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp217243wrd; Tue, 21 Feb 2023 12:54:37 -0800 (PST) X-Google-Smtp-Source: AK7set/mStehqN8ChWHzJtNueNo1/i2pxu6/USyRewC4KXD3fwJ+sndFPgGvIbbKc3EPrcCu/m8q X-Received: by 2002:a17:902:cec1:b0:199:2f0a:697 with SMTP id d1-20020a170902cec100b001992f0a0697mr9466940plg.33.1677012877054; Tue, 21 Feb 2023 12:54:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677012877; cv=none; d=google.com; s=arc-20160816; b=IlKQq0ofDAUIAh57K0M6LuI8Hwrv3UNM9VxX87T+lO3t0UKJbugyY5AgnPvtUX4c3b +aXBqA+3XDXOKwsTjQ2KGJr7pY4pMlzkZLYnQ5MfNA1cn4KDWXf20g3EmkWONmeHS7yV oTIkJ0uL3zoK0RXiCq7xV2EJGqoUhL9pafGY+G3P/ss0gSqb1CwM3AEldXPvu2iMEiCp lznoERZDjnqSRzJYpYPZi99Epdc1S04qi6r5u82WPdgMH13rmvDiskrRdSnL2M/akAaw 7YrdPGJNzp111KoVKHSWsd20Hwt9GzhxNCqWVq22gEuTCKivVh5kgNomTSbWjYhiaASh 1FIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:cc :references:to:from:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=ysPH6WPpk5eU7Ka5J53d3h1W3zWHMXnSdV9y5Xs+C1E=; b=fhOAn955DgLkggYMCuSpP/Ts0W9rXteVHQC80qDYtDODsenbpmHP4uypMi+Em08BQN AqA9Cx4Hm0BYYF/xHjHtPi81CbHzDchig7G37u5AF/oq3DoH9d1ctU2IeLJEcKox7pgt h+Jrz4qPY2D4yXm8fpHE00bgXUKkKZlpBfhZ+rm8O+x2KZRLFtCHHF1mbdpXT85dztm7 X95RANsR/4KSpP7FvJxkGTSJ6+n0ap5MTbSyJGC/RDXHynLPP+EjmLeKzU6W6620lgyZ xFdrAn12g6NM07UPuBTRgnPctD4fKbw7YBkINqMQeiLx+bHKfhU87akBz3a4bt14qzUD xuog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@landley-net.20210112.gappssmtp.com header.s=20210112 header.b=Nn9ZobLL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y15-20020a17090322cf00b001967580f630si15666188plg.133.2023.02.21.12.54.21; Tue, 21 Feb 2023 12:54:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@landley-net.20210112.gappssmtp.com header.s=20210112 header.b=Nn9ZobLL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230039AbjBUUlv (ORCPT + 99 others); Tue, 21 Feb 2023 15:41:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229776AbjBUUlu (ORCPT ); Tue, 21 Feb 2023 15:41:50 -0500 Received: from mail-il1-x135.google.com (mail-il1-x135.google.com [IPv6:2607:f8b0:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 332612D142 for ; Tue, 21 Feb 2023 12:41:49 -0800 (PST) Received: by mail-il1-x135.google.com with SMTP id c4so2428262ilr.13 for ; Tue, 21 Feb 2023 12:41:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=landley-net.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:in-reply-to:cc:references:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=ysPH6WPpk5eU7Ka5J53d3h1W3zWHMXnSdV9y5Xs+C1E=; b=Nn9ZobLLbydXkfGjLJB+NFQlDhB969riVbUYWeDqDKElp4mXynQXXexrDy0ffT6YK4 LoGUUYX6NNlTl09hrodIvLY7GmBIcceWjNAegEsFvcRev8u078caDhxO38Fv/L+i8x2/ JxMK4Ejurbuu4JhDBKiHZwSf4SKsIORadTEsSRqgcjnMpdGc6Q/Jjy7qM6nM/Ysw9EuK qOOffUrokZsXg1SCsJ2XJoEfb3S1VJMvYvU5Nc60od4WmEBrUaleGdLosuUbv8ubAj4o yViwXi1+ssBG1sK8rmQ7/bbhoULipaDOkKvjSi4bVuiwjkgjVMNqJN6SmEmclDiUuHCq AV6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:cc:references:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ysPH6WPpk5eU7Ka5J53d3h1W3zWHMXnSdV9y5Xs+C1E=; b=qBbqqF2BHKV6/ecYtK6/eHR/mZGQ5nhZpwl5UtlgqmMiXbiGypd/82OO4/yGLEUYyJ c6pt6Vxbs9Am2m6Nwan9gUtL0kebuKcuS9S564s754pgGnAxk+eb+XNG4Y6g0vsGUTMg +snQUidjLcZ4scKSRBBt5zfFQagN39ufCaXtwf1cR3abJZUaClyGTO6aTEKOIMY8lEqZ Zss2MZP6pxFEZnAesQrRPLHV4UPwFWei3CtZpB5kO8EysSOJ2msuMrBD8J834OS5ANDt vaPAITgdUb/k1uOq3yv2EJMI1/9miDN6jzXRGtdbHd46nLIF1wBkDMqxf95mlYipOFnP lpXg== X-Gm-Message-State: AO0yUKV1aL5zL0+dNNRLrxru+EkbnjAY6b0zrAi24nYXRHoRTC43z2It JMmK4ST3RmVOXmTIP9FK/kw+x8t8K8ZpgxCK5M8= X-Received: by 2002:a05:6e02:20e7:b0:316:d9fa:f4fe with SMTP id q7-20020a056e0220e700b00316d9faf4femr3001680ilv.24.1677012108470; Tue, 21 Feb 2023 12:41:48 -0800 (PST) Received: from [172.16.32.78] ([198.232.126.202]) by smtp.gmail.com with ESMTPSA id d14-20020a02a48e000000b00375783003fcsm6303jam.136.2023.02.21.12.41.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 21 Feb 2023 12:41:48 -0800 (PST) Message-ID: <63c2936e-6bc7-67e3-eaf3-0123333381f8@landley.net> Date: Tue, 21 Feb 2023 14:55:10 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: [PATCH 1/5] try generic compiler name "cc" before falling back to "gcc". Content-Language: en-US From: Rob Landley To: "linux-kernel@vger.kernel.org" References: Cc: Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier , Tom Rix , linux-kbuild@vger.kernel.org, llvm@lists.linux.dev In-Reply-To: X-Spam-Status: No, score=0.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,URI_DOTEDU autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758475454643226597?= X-GMAIL-MSGID: =?utf-8?q?1758475454643226597?= 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 --- 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