Refactor llvm_config.mk and support the 2nd arch
1. Following the setup of gcc in build/core/combo/,
we added the [HOST|TARGET]_<arch>.mk clang config files,
and load only the configs needed by the current product.
2. Added support for the 2nd arch.
Change-Id: I2a383418a9688a050b39492f8e489d40eeeb5f2d
diff --git a/core/clang/HOST_x86.mk b/core/clang/HOST_x86.mk
new file mode 100644
index 0000000..f38f04e
--- /dev/null
+++ b/core/clang/HOST_x86.mk
@@ -0,0 +1,55 @@
+
+include $(BUILD_SYSTEM)/clang/x86.mk
+
+ifeq ($(HOST_OS),linux)
+CLANG_CONFIG_x86_HOST_TRIPLE := i686-linux-gnu
+endif
+ifeq ($(HOST_OS),darwin)
+CLANG_CONFIG_x86_HOST_TRIPLE := i686-apple-darwin
+endif
+ifeq ($(HOST_OS),windows)
+CLANG_CONFIG_x86_HOST_TRIPLE := i686-pc-mingw32
+endif
+
+CLANG_CONFIG_x86_HOST_EXTRA_ASFLAGS := \
+ $(CLANG_CONFIG_EXTRA_ASFLAGS) \
+ $(CLANG_CONFIG_HOST_EXTRA_ASFLAGS) \
+ $(CLANG_CONFIG_x86_EXTRA_ASFLAGS) \
+ -target $(CLANG_CONFIG_x86_HOST_TRIPLE) \
+
+CLANG_CONFIG_x86_HOST_EXTRA_CFLAGS := \
+ $(CLANG_CONFIG_EXTRA_CFLAGS) \
+ $(CLANG_CONFIG_HOST_EXTRA_CFLAGS) \
+ $(CLANG_CONFIG_x86_EXTRA_CFLAGS) \
+ $(CLANG_CONFIG_x86_HOST_EXTRA_ASFLAGS)
+
+CLANG_CONFIG_x86_HOST_EXTRA_CPPFLAGS := \
+ $(CLANG_CONFIG_EXTRA_CPPFLAGS) \
+ $(CLANG_CONFIG_HOST_EXTRA_CPPFLAGS) \
+ $(CLANG_CONFIG_x86_EXTRA_CPPFLAGS) \
+
+CLANG_CONFIG_x86_HOST_EXTRA_LDFLAGS := \
+ $(CLANG_CONFIG_EXTRA_LDFLAGS) \
+ $(CLANG_CONFIG_HOST_EXTRA_LDFLAGS) \
+ $(CLANG_CONFIG_x86_EXTRA_LDFLAGS) \
+ -target $(CLANG_CONFIG_x86_HOST_TRIPLE) \
+
+
+define convert-to-host-clang-flags
+ $(strip \
+ $(call subst-clang-incompatible-x86-flags,\
+ $(filter-out $(CLANG_CONFIG_x86_UNKNOWN_CFLAGS),\
+ $(1))))
+endef
+
+CLANG_HOST_GLOBAL_CFLAGS := \
+ $(call convert-to-host-clang-flags,$(HOST_GLOBAL_CFLAGS)) \
+ $(CLANG_CONFIG_x86_HOST_EXTRA_CFLAGS)
+
+CLANG_HOST_GLOBAL_CPPFLAGS := \
+ $(call convert-to-host-clang-flags,$(HOST_GLOBAL_CPPFLAGS)) \
+ $(CLANG_CONFIG_x86_HOST_EXTRA_CPPFLAGS)
+
+CLANG_HOST_GLOBAL_LDFLAGS := \
+ $(call convert-to-host-clang-flags,$(HOST_GLOBAL_LDFLAGS)) \
+ $(CLANG_CONFIG_x86_HOST_EXTRA_LDFLAGS)