summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2018-11-05 22:04:55 -0500
committerMasahiro Yamada <yamada.masahiro@socionext.com>2018-11-13 18:21:22 -0500
commit238bcbc4e07fad2fff99c5b157d0c37ccd4d093c (patch)
treef9e48c9a0515affd0f3a5cb4af2bf246630851b6 /Makefile
parentdbe27a002ef8573168cb64e181458ea23a74e2b6 (diff)
kbuild: consolidate Clang compiler flags
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@socionext.com> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Tested-by: Nick Desaulniers <ndesaulniers@google.com> Acked-by: Greg Hackmann <ghackmann@google.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile13
1 files changed, 6 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index b71b9c70496c..c300ac16c895 100644
--- a/Makefile
+++ b/Makefile
@@ -487,18 +487,17 @@ endif
487 487
488ifneq ($(shell $(CC) --version 2>&1 | head -n 1 | grep clang),) 488ifneq ($(shell $(CC) --version 2>&1 | head -n 1 | grep clang),)
489ifneq ($(CROSS_COMPILE),) 489ifneq ($(CROSS_COMPILE),)
490CLANG_TARGET := --target=$(notdir $(CROSS_COMPILE:%-=%)) 490CLANG_FLAGS := --target=$(notdir $(CROSS_COMPILE:%-=%))
491GCC_TOOLCHAIN_DIR := $(dir $(shell which $(LD))) 491GCC_TOOLCHAIN_DIR := $(dir $(shell which $(LD)))
492CLANG_PREFIX := --prefix=$(GCC_TOOLCHAIN_DIR) 492CLANG_FLAGS += --prefix=$(GCC_TOOLCHAIN_DIR)
493GCC_TOOLCHAIN := $(realpath $(GCC_TOOLCHAIN_DIR)/..) 493GCC_TOOLCHAIN := $(realpath $(GCC_TOOLCHAIN_DIR)/..)
494endif 494endif
495ifneq ($(GCC_TOOLCHAIN),) 495ifneq ($(GCC_TOOLCHAIN),)
496CLANG_GCC_TC := --gcc-toolchain=$(GCC_TOOLCHAIN) 496CLANG_FLAGS += --gcc-toolchain=$(GCC_TOOLCHAIN)
497endif 497endif
498KBUILD_CFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) $(CLANG_PREFIX) 498CLANG_FLAGS += -no-integrated-as
499KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) $(CLANG_PREFIX) 499KBUILD_CFLAGS += $(CLANG_FLAGS)
500KBUILD_CFLAGS += -no-integrated-as 500KBUILD_AFLAGS += $(CLANG_FLAGS)
501KBUILD_AFLAGS += -no-integrated-as
502endif 501endif
503 502
504RETPOLINE_CFLAGS_GCC := -mindirect-branch=thunk-extern -mindirect-branch-register 503RETPOLINE_CFLAGS_GCC := -mindirect-branch=thunk-extern -mindirect-branch-register