[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAK7LNASUq-bJKsAWtX1bnRHsf+AhGCm_fVToy2Gpyc5BbW0K5g@mail.gmail.com>
Date: Wed, 14 Nov 2018 08:25:17 +0900
From: Masahiro Yamada <yamada.masahiro@...ionext.com>
To: Linux Kbuild mailing list <linux-kbuild@...r.kernel.org>
Cc: Nick Desaulniers <ndesaulniers@...gle.com>,
Stefan Agner <stefan@...er.ch>,
Matthias Kaehlcke <mka@...omium.org>,
Joel Stanley <joel@....id.au>,
linuxppc-dev <linuxppc-dev@...ts.ozlabs.org>,
Michael Ellerman <mpe@...erman.id.au>,
Michal Marek <michal.lkml@...kovi.net>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 2/2] kbuild: consolidate Clang compiler flags
On Tue, Nov 6, 2018 at 12:06 PM Masahiro Yamada
<yamada.masahiro@...ionext.com> wrote:
>
> 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 <yamada.masahiro@...ionext.com>
> ---
Applied to linux-kbuild.
> 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
>
--
Best Regards
Masahiro Yamada
Powered by blists - more mailing lists