Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1342567imu; Mon, 5 Nov 2018 19:07:19 -0800 (PST) X-Google-Smtp-Source: AJdET5fz6E7SmFrj1pdjq0SdQQB82HGdAlczSlcUf9Gpj4/jKH83RyOQt7pApoHKL+uNIdvOh7Yo X-Received: by 2002:a62:5285:: with SMTP id g127-v6mr16492357pfb.128.1541473639235; Mon, 05 Nov 2018 19:07:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541473639; cv=none; d=google.com; s=arc-20160816; b=Rd/Hf1k3aiwWDKVYzDHAOPQf0J1nwJvFXUbqifmQ1jQpbAMGZ/5zLmAJlTlh/1yc3r oWDtkb+ptw/4X0foJ7jSQLmrQkE2gZDmvHtmWdvOy7QqZfMHB6QHTlH2ScuUCv1ZuTxf ihmQTxRDyqLEy68vE4LstLgxME7bgeaqz4HQo/HZD5GB+HdgBUuUwM/T1v/1JSskG1Jg haZE8ylRSCh5of/pbi1qz1hpfMqnRg5EQPAtlOV1i+udlgzgzW8nHxymf7GDMFi+TP2z QM2q+fcs3bKB1nDMvQ+MFW9UgZVjH6Tb405T6dlY95WBNM1EcuzsOaMLuK1AF993p+jG Rw+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=1+BFxkaRJrjARU/GhxBmY3HEDiOtKleHWhuKBQ9VCEE=; b=Ne8GfQnVnWicJAOf1Ect3NJ0UNC7sywLQDpIIukJfqLFtpfm6N2mHTKCN/5HXozt15 mf2wvtwlpFd69aFvMSxIXWjDoxriStCXq7FRUQRbjCt/bKQliJ3NgUzmJLCrBzuP0gGo qHE3qEEzyT8XijnFh9n1B6kvt2Rdr5dMH0PzRb9nPKrZ76lnI+aAbb1j533hqkR1bQq4 cwUxpSaNJmW0nNSLISkPA7VUbaVIxiEgk2WLtnPVE3x8CG1QjCIrKutNXhJOK0iKVOei n105AMTnU1f3xer+tvWx59k4hsaRn2j+3PCmh0HAe1TNowM32SOBqPc8TF6o75Mn2wnf 0+Mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=bazDBYFf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 11-v6si47779223plc.224.2018.11.05.19.07.03; Mon, 05 Nov 2018 19:07:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=bazDBYFf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729691AbeKFM3l (ORCPT + 99 others); Tue, 6 Nov 2018 07:29:41 -0500 Received: from conuserg-09.nifty.com ([210.131.2.76]:54210 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726680AbeKFM3k (ORCPT ); Tue, 6 Nov 2018 07:29:40 -0500 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id wA635Mp2025438; Tue, 6 Nov 2018 12:05:23 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com wA635Mp2025438 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1541473524; bh=1+BFxkaRJrjARU/GhxBmY3HEDiOtKleHWhuKBQ9VCEE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bazDBYFf/fLxanBbDMmWZm0TVTNGgnIONdWRlQA2PS2kGPaamgVRgGYmeEfyqRYEb 6R1nNrYuVHJ6bVdGEBxyIp32WdqB5RyaT19n7QkMYpUCh0A2THp5iMvf6kjIA24sPm hUN7TSvYaoC0mFCIdXGGPgwoHIft96zYMa4KXQNgeDox2rXdwE8jDu/t8pzoS38P7p Mv1I9AGb17xpnMwI9jeZur+USMq9L1fxVOOWniR5SkE7WwY7oFHOzyTPGvg0dwRYfE yaZWT+SyH7nuaFSBLi0sqxSlJT4f75ZKAAlM9R+wwSDVjLAMmuPwCLmeBS/sNrx4bp wcWnVDLoaB2EQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Nick Desaulniers , Stefan Agner , Matthias Kaehlcke , Joel Stanley , linuxppc-dev@lists.ozlabs.org, Michael Ellerman , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH v2 2/2] kbuild: consolidate Clang compiler flags Date: Tue, 6 Nov 2018 12:04:55 +0900 Message-Id: <1541473495-25262-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1541473495-25262-1-git-send-email-yamada.masahiro@socionext.com> References: <1541473495-25262-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Collect basic Clang options such as --target, --prefix, --gcc-toolchain, -no-integrated-as into a single variable CLANG_FLAGS so that it can be easily reused in other parts of Makefile. Signed-off-by: Masahiro Yamada --- Changes in v2: - Use := flavor instead of = because $(CLANG_FLAGS) is expanded soon anyway Makefile | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index da11700..e173a73 100644 --- a/Makefile +++ b/Makefile @@ -487,18 +487,17 @@ endif ifneq ($(shell $(CC) --version 2>&1 | head -n 1 | grep clang),) ifneq ($(CROSS_COMPILE),) -CLANG_TARGET := --target=$(notdir $(CROSS_COMPILE:%-=%)) +CLANG_FLAGS := --target=$(notdir $(CROSS_COMPILE:%-=%)) GCC_TOOLCHAIN_DIR := $(dir $(shell which $(LD))) -CLANG_PREFIX := --prefix=$(GCC_TOOLCHAIN_DIR) +CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR) GCC_TOOLCHAIN := $(realpath $(GCC_TOOLCHAIN_DIR)/..) endif ifneq ($(GCC_TOOLCHAIN),) -CLANG_GCC_TC := --gcc-toolchain=$(GCC_TOOLCHAIN) +CLANG_FLAGS += --gcc-toolchain=$(GCC_TOOLCHAIN) endif -KBUILD_CFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) $(CLANG_PREFIX) -KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) $(CLANG_PREFIX) -KBUILD_CFLAGS += -no-integrated-as -KBUILD_AFLAGS += -no-integrated-as +CLANG_FLAGS += -no-integrated-as +KBUILD_CFLAGS += $(CLANG_FLAGS) +KBUILD_AFLAGS += $(CLANG_FLAGS) endif RETPOLINE_CFLAGS_GCC := -mindirect-branch=thunk-extern -mindirect-branch-register -- 2.7.4