18c2ecf20Sopenharmony_ci# Individual arch/{arch}/Makefiles should use -EL/-EB to set intended
28c2ecf20Sopenharmony_ci# endianness and -m32/-m64 to set word size based on Kconfigs instead of
38c2ecf20Sopenharmony_ci# relying on the target triple.
48c2ecf20Sopenharmony_ciCLANG_TARGET_FLAGS_arm		:= arm-linux-gnueabi
58c2ecf20Sopenharmony_ciCLANG_TARGET_FLAGS_arm64	:= aarch64-linux-gnu
68c2ecf20Sopenharmony_ciCLANG_TARGET_FLAGS_hexagon	:= hexagon-linux-musl
78c2ecf20Sopenharmony_ciCLANG_TARGET_FLAGS_m68k		:= m68k-linux-gnu
88c2ecf20Sopenharmony_ciCLANG_TARGET_FLAGS_mips		:= mipsel-linux-gnu
98c2ecf20Sopenharmony_ciCLANG_TARGET_FLAGS_powerpc	:= powerpc64le-linux-gnu
108c2ecf20Sopenharmony_ciCLANG_TARGET_FLAGS_riscv	:= riscv64-linux-gnu
118c2ecf20Sopenharmony_ciCLANG_TARGET_FLAGS_s390		:= s390x-linux-gnu
128c2ecf20Sopenharmony_ciCLANG_TARGET_FLAGS_x86		:= x86_64-linux-gnu
138c2ecf20Sopenharmony_ciCLANG_TARGET_FLAGS		:= $(CLANG_TARGET_FLAGS_$(SRCARCH))
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ciifeq ($(CROSS_COMPILE),)
168c2ecf20Sopenharmony_ciifeq ($(CLANG_TARGET_FLAGS),)
178c2ecf20Sopenharmony_ci$(error Specify CROSS_COMPILE or add '--target=' option to scripts/Makefile.clang)
188c2ecf20Sopenharmony_cielse
198c2ecf20Sopenharmony_ciCLANG_FLAGS	+= --target=$(CLANG_TARGET_FLAGS)
208c2ecf20Sopenharmony_ciendif # CLANG_TARGET_FLAGS
218c2ecf20Sopenharmony_cielse
228c2ecf20Sopenharmony_ciCLANG_FLAGS	+= --target=$(notdir $(CROSS_COMPILE:%-=%))
238c2ecf20Sopenharmony_ciendif # CROSS_COMPILE
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ciifeq ($(LLVM_IAS),1)
268c2ecf20Sopenharmony_ciCLANG_FLAGS	+= -fintegrated-as
278c2ecf20Sopenharmony_cielse
288c2ecf20Sopenharmony_ciCLANG_FLAGS	+= -fno-integrated-as
298c2ecf20Sopenharmony_ciGCC_TOOLCHAIN_DIR := $(dir $(shell which $(CROSS_COMPILE)elfedit))
308c2ecf20Sopenharmony_ciCLANG_FLAGS	+= --prefix=$(GCC_TOOLCHAIN_DIR)$(notdir $(CROSS_COMPILE))
318c2ecf20Sopenharmony_ciendif
328c2ecf20Sopenharmony_ciCLANG_FLAGS	+= -Werror=unknown-warning-option
338c2ecf20Sopenharmony_ciKBUILD_CFLAGS	+= $(CLANG_FLAGS)
348c2ecf20Sopenharmony_ciKBUILD_AFLAGS	+= $(CLANG_FLAGS)
358c2ecf20Sopenharmony_ciexport CLANG_FLAGS
36