Merge "Fix missing xml configuration files for sdk builds"
diff --git a/core/binary.mk b/core/binary.mk
index e729164..c5db242 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -123,6 +123,13 @@
#######################################
include $(BUILD_SYSTEM)/base_rules.mk
#######################################
+my_compiler_dependencies :=
+ifeq ($(strip $(LOCAL_CLANG)),true)
+ LOCAL_CFLAGS += $(CLANG_CONFIG_EXTRA_CFLAGS)
+ LOCAL_LDFLAGS += $(CLANG_CONFIG_EXTRA_LDFLAGS)
+ LOCAL_C_INCLUDES += $(CLANG_CONFIG_EXTRA_C_INCLUDES)
+ my_compiler_dependencies := $(CLANG) $(CLANG_CXX)
+endif
####################################################
## Add FDO flags if FDO is turned on and supported
@@ -142,16 +149,22 @@
###########################################################
## Define PRIVATE_ variables from global vars
###########################################################
+ifeq ($(strip $(LOCAL_CLANG)),true)
+my_target_global_cflags := $(TARGET_GLOBAL_CLANG_FLAGS)
+else
+my_target_global_cflags := $(TARGET_GLOBAL_CFLAGS)
+endif
+
ifdef LOCAL_NDK_VERSION
my_target_project_includes :=
my_target_c_inclues := $(my_ndk_stl_include_path) $(my_ndk_version_root)/usr/include
# TODO: more reliable way to remove platform stuff.
-my_target_global_cflags := $(filter-out -include -I system/%, $(TARGET_GLOBAL_CFLAGS))
+my_target_global_cflags := $(filter-out -include -I system/%, $(my_target_global_cflags))
my_target_global_cppflags := $(filter-out -include -I system/%, $(TARGET_GLOBAL_CPPFLAGS))
else
my_target_project_includes := $(TARGET_PROJECT_INCLUDES)
my_target_c_inclues := $(TARGET_C_INCLUDES)
-my_target_global_cflags := $(TARGET_GLOBAL_CFLAGS)
+my_target_global_cflags := $(my_target_global_cflags)
my_target_global_cppflags := $(TARGET_GLOBAL_CPPFLAGS)
endif
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_PROJECT_INCLUDES := $(my_target_project_includes)
@@ -163,15 +176,23 @@
## Define PRIVATE_ variables used by multiple module types
###########################################################
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_NO_DEFAULT_COMPILER_FLAGS := \
- $(strip $(LOCAL_NO_DEFAULT_COMPILER_FLAGS))
+ $(strip $(LOCAL_NO_DEFAULT_COMPILER_FLAGS))
ifeq ($(strip $(LOCAL_CC)),)
- LOCAL_CC := $($(my_prefix)CC)
+ ifeq ($(strip $(LOCAL_CLANG)),true)
+ LOCAL_CC := $(CLANG)
+ else
+ LOCAL_CC := $($(my_prefix)CC)
+ endif
endif
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CC := $(LOCAL_CC)
ifeq ($(strip $(LOCAL_CXX)),)
- LOCAL_CXX := $($(my_prefix)CXX)
+ ifeq ($(strip $(LOCAL_CLANG)),true)
+ LOCAL_CXX := $(CLANG_CXX)
+ else
+ LOCAL_CXX := $($(my_prefix)CXX)
+ endif
endif
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CXX := $(LOCAL_CXX)
@@ -247,7 +268,7 @@
proto_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(proto_sources))
proto_generated_cc_sources_dir := $(intermediates)/proto
proto_generated_cc_sources := $(addprefix $(proto_generated_cc_sources_dir)/, \
- $(patsubst %.proto,%.pb.cc,$(proto_sources_fullpath)))
+ $(patsubst %.proto,%.pb.cc,$(proto_sources_fullpath)))
proto_generated_objects := $(patsubst %.cc,%.o, $(proto_generated_cc_sources))
$(proto_generated_cc_sources): PRIVATE_PROTO_INCLUDES := $(TOP)
@@ -281,14 +302,14 @@
yacc_sources := $(filter %.y,$(LOCAL_SRC_FILES))
yacc_cpps := $(addprefix \
- $(intermediates)/,$(yacc_sources:.y=$(LOCAL_CPP_EXTENSION)))
+ $(intermediates)/,$(yacc_sources:.y=$(LOCAL_CPP_EXTENSION)))
yacc_headers := $(yacc_cpps:$(LOCAL_CPP_EXTENSION)=.h)
yacc_objects := $(yacc_cpps:$(LOCAL_CPP_EXTENSION)=.o)
ifneq ($(strip $(yacc_cpps)),)
$(yacc_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
- $(TOPDIR)$(LOCAL_PATH)/%.y \
- $(lex_cpps) $(LOCAL_ADDITIONAL_DEPENDENCIES)
+ $(TOPDIR)$(LOCAL_PATH)/%.y \
+ $(lex_cpps) $(LOCAL_ADDITIONAL_DEPENDENCIES)
$(call transform-y-to-cpp,$(PRIVATE_CPP_EXTENSION))
$(yacc_headers): $(intermediates)/%.h: $(intermediates)/%$(LOCAL_CPP_EXTENSION)
@@ -304,20 +325,20 @@
lex_sources := $(filter %.l,$(LOCAL_SRC_FILES))
lex_cpps := $(addprefix \
- $(intermediates)/,$(lex_sources:.l=$(LOCAL_CPP_EXTENSION)))
+ $(intermediates)/,$(lex_sources:.l=$(LOCAL_CPP_EXTENSION)))
lex_objects := $(lex_cpps:$(LOCAL_CPP_EXTENSION)=.o)
ifneq ($(strip $(lex_cpps)),)
$(lex_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
- $(TOPDIR)$(LOCAL_PATH)/%.l
+ $(TOPDIR)$(LOCAL_PATH)/%.l
$(transform-l-to-cpp)
$(lex_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
$(lex_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
$(lex_objects): $(intermediates)/%.o: \
- $(intermediates)/%$(LOCAL_CPP_EXTENSION) \
- $(LOCAL_ADDITIONAL_DEPENDENCIES) \
- $(yacc_headers)
+ $(intermediates)/%$(LOCAL_CPP_EXTENSION) \
+ $(LOCAL_ADDITIONAL_DEPENDENCIES) \
+ $(yacc_headers)
$(transform-$(PRIVATE_HOST)cpp-to-o)
endif
@@ -342,8 +363,9 @@
ifneq ($(strip $(cpp_objects)),)
$(cpp_objects): $(intermediates)/%.o: \
- $(TOPDIR)$(LOCAL_PATH)/%$(LOCAL_CPP_EXTENSION) \
- $(yacc_cpps) $(proto_generated_headers) $(LOCAL_ADDITIONAL_DEPENDENCIES)
+ $(TOPDIR)$(LOCAL_PATH)/%$(LOCAL_CPP_EXTENSION) \
+ $(yacc_cpps) $(proto_generated_headers) $(my_compiler_dependencies) \
+ $(LOCAL_ADDITIONAL_DEPENDENCIES)
$(transform-$(PRIVATE_HOST)cpp-to-o)
-include $(cpp_objects:%.o=%.P)
endif
@@ -360,7 +382,10 @@
# TODO: support compiling certain generated files as arm.
$(gen_cpp_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
$(gen_cpp_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
-$(gen_cpp_objects): $(intermediates)/%.o: $(intermediates)/%$(LOCAL_CPP_EXTENSION) $(yacc_cpps) $(proto_generated_headers) $(LOCAL_ADDITIONAL_DEPENDENCIES)
+$(gen_cpp_objects): $(intermediates)/%.o: \
+ $(intermediates)/%$(LOCAL_CPP_EXTENSION) $(yacc_cpps) \
+ $(proto_generated_headers) $(my_compiler_dependencies) \
+ $(LOCAL_ADDITIONAL_DEPENDENCIES)
$(transform-$(PRIVATE_HOST)cpp-to-o)
-include $(gen_cpp_objects:%.o=%.P)
endif
@@ -373,7 +398,8 @@
gen_S_objects := $(gen_S_sources:%.S=%.o)
ifneq ($(strip $(gen_S_sources)),)
-$(gen_S_objects): $(intermediates)/%.o: $(intermediates)/%.S $(LOCAL_ADDITIONAL_DEPENDENCIES)
+$(gen_S_objects): $(intermediates)/%.o: $(intermediates)/%.S \
+ $(my_compiler_dependencies) $(LOCAL_ADDITIONAL_DEPENDENCIES)
$(transform-$(PRIVATE_HOST)s-to-o)
-include $(gen_S_objects:%.o=%.P)
endif
@@ -382,7 +408,8 @@
gen_s_objects := $(gen_s_sources:%.s=%.o)
ifneq ($(strip $(gen_s_objects)),)
-$(gen_s_objects): $(intermediates)/%.o: $(intermediates)/%.s $(LOCAL_ADDITIONAL_DEPENDENCIES)
+$(gen_s_objects): $(intermediates)/%.o: $(intermediates)/%.s \
+ $(my_compiler_dependencies) $(LOCAL_ADDITIONAL_DEPENDENCIES)
$(transform-$(PRIVATE_HOST)s-to-o-no-deps)
-include $(gen_s_objects:%.o=%.P)
endif
@@ -407,7 +434,8 @@
c_objects := $(c_arm_objects) $(c_normal_objects)
ifneq ($(strip $(c_objects)),)
-$(c_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.c $(yacc_cpps) $(proto_generated_headers) $(LOCAL_ADDITIONAL_DEPENDENCIES)
+$(c_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.c $(yacc_cpps) $(proto_generated_headers) \
+ $(my_compiler_dependencies) $(LOCAL_ADDITIONAL_DEPENDENCIES)
$(transform-$(PRIVATE_HOST)c-to-o)
-include $(c_objects:%.o=%.P)
endif
@@ -424,7 +452,8 @@
# TODO: support compiling certain generated files as arm.
$(gen_c_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
$(gen_c_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
-$(gen_c_objects): $(intermediates)/%.o: $(intermediates)/%.c $(yacc_cpps) $(proto_generated_headers) $(LOCAL_ADDITIONAL_DEPENDENCIES)
+$(gen_c_objects): $(intermediates)/%.o: $(intermediates)/%.c $(yacc_cpps) $(proto_generated_headers) \
+ $(my_compiler_dependencies) $(LOCAL_ADDITIONAL_DEPENDENCIES)
$(transform-$(PRIVATE_HOST)c-to-o)
-include $(gen_c_objects:%.o=%.P)
endif
@@ -437,7 +466,8 @@
objc_objects := $(addprefix $(intermediates)/,$(objc_sources:.m=.o))
ifneq ($(strip $(objc_objects)),)
-$(objc_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.m $(yacc_cpps) $(proto_generated_headers) $(LOCAL_ADDITIONAL_DEPENDENCIES)
+$(objc_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.m $(yacc_cpps) $(proto_generated_headers) \
+ $(my_compiler_dependencies) $(LOCAL_ADDITIONAL_DEPENDENCIES)
$(transform-$(PRIVATE_HOST)m-to-o)
-include $(objc_objects:%.o=%.P)
endif
@@ -450,7 +480,8 @@
asm_objects_S := $(addprefix $(intermediates)/,$(asm_sources_S:.S=.o))
ifneq ($(strip $(asm_objects_S)),)
-$(asm_objects_S): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.S $(LOCAL_ADDITIONAL_DEPENDENCIES)
+$(asm_objects_S): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.S \
+ $(my_compiler_dependencies) $(LOCAL_ADDITIONAL_DEPENDENCIES)
$(transform-$(PRIVATE_HOST)s-to-o)
-include $(asm_objects_S:%.o=%.P)
endif
@@ -459,7 +490,8 @@
asm_objects_s := $(addprefix $(intermediates)/,$(asm_sources_s:.s=.o))
ifneq ($(strip $(asm_objects_s)),)
-$(asm_objects_s): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.s $(LOCAL_ADDITIONAL_DEPENDENCIES)
+$(asm_objects_s): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.s \
+ $(my_compiler_dependencies) $(LOCAL_ADDITIONAL_DEPENDENCIES)
$(transform-$(PRIVATE_HOST)s-to-o-no-deps)
-include $(asm_objects_s:%.o=%.P)
endif
@@ -474,17 +506,17 @@
# some rules depend on asm_objects being first. If your code depends on
# being first, it's reasonable to require it to be assembly
all_objects := \
- $(asm_objects) \
- $(cpp_objects) \
- $(gen_cpp_objects) \
- $(gen_asm_objects) \
- $(c_objects) \
- $(gen_c_objects) \
- $(objc_objects) \
- $(yacc_objects) \
- $(lex_objects) \
- $(proto_generated_objects) \
- $(addprefix $(TOPDIR)$(LOCAL_PATH)/,$(LOCAL_PREBUILT_OBJ_FILES))
+ $(asm_objects) \
+ $(cpp_objects) \
+ $(gen_cpp_objects) \
+ $(gen_asm_objects) \
+ $(c_objects) \
+ $(gen_c_objects) \
+ $(objc_objects) \
+ $(yacc_objects) \
+ $(lex_objects) \
+ $(proto_generated_objects) \
+ $(addprefix $(TOPDIR)$(LOCAL_PATH)/,$(LOCAL_PREBUILT_OBJ_FILES))
LOCAL_C_INCLUDES += $(TOPDIR)$(LOCAL_PATH) $(intermediates) $(base_intermediates)
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index 63f44b3..41259e4 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -118,6 +118,7 @@
LOCAL_MODULE_OWNER:=
LOCAL_CTS_TEST_PACKAGE:=
LOCAL_CTS_TEST_RUNNER:=
+LOCAL_CLANG:=
# Trim MAKEFILE_LIST so that $(call my-dir) doesn't need to
# iterate over thousands of entries every time.
diff --git a/core/config.mk b/core/config.mk
index 56ef97e..6383113 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -372,6 +372,9 @@
TARGET_GLOBAL_CFLAGS += $(TARGET_RELEASE_CFLAGS)
TARGET_GLOBAL_CPPFLAGS += $(TARGET_RELEASE_CPPFLAGS)
+# define llvm tools and global flags
+include $(BUILD_SYSTEM)/llvm_config.mk
+
PREBUILT_IS_PRESENT := $(if $(wildcard prebuilt/Android.mk),true)
# ###############################################################
diff --git a/core/llvm_config.mk b/core/llvm_config.mk
new file mode 100644
index 0000000..ec6720a
--- /dev/null
+++ b/core/llvm_config.mk
@@ -0,0 +1,59 @@
+CLANG := $(HOST_OUT_EXECUTABLES)/clang$(HOST_EXECUTABLE_SUFFIX)
+CLANG_CXX := $(HOST_OUT_EXECUTABLES)/clang++$(HOST_EXECUTABLE_SUFFIX)
+LLVM_LINK := $(HOST_OUT_EXECUTABLES)/llvm-link$(HOST_EXECUTABLE_SUFFIX)
+
+define do-clang-flags-subst
+ TARGET_GLOBAL_CLANG_FLAGS := $(subst $(1),$(2),$(TARGET_GLOBAL_CLANG_FLAGS))
+ HOST_GLOBAL_CLANG_FLAGS := $(subst $(1),$(2),$(HOST_GLOBAL_CLANG_FLAGS))
+endef
+
+define clang-flags-subst
+ $(eval $(call do-clang-flags-subst,$(1),$(2)))
+endef
+
+
+CLANG_CONFIG_EXTRA_CFLAGS := \
+ -D__compiler_offsetof=__builtin_offsetof \
+ -Dnan=__builtin_nan \
+
+CLANG_CONFIG_UNKNOWN_CFLAGS := \
+ -funswitch-loops
+
+ifeq ($(TARGET_ARCH),arm)
+ CLANG_CONFIG_EXTRA_CFLAGS += \
+ -target arm-linux-androideabi \
+ -B$(TARGET_TOOLCHAIN_ROOT)/arm-linux-androideabi/bin \
+ -mllvm -arm-enable-ehabi
+ CLANG_CONFIG_EXTRA_LDFLAGS += \
+ -target arm-linux-androideabi \
+ -B$(TARGET_TOOLCHAIN_ROOT)/arm-linux-androideabi/bin
+ CLANG_CONFIG_UNKNOWN_CFLAGS += \
+ -mthumb-interwork \
+ -fgcse-after-reload \
+ -frerun-cse-after-loop \
+ -frename-registers \
+ -Wa,--noexecstack
+endif
+ifeq ($(TARGET_ARCH),x86)
+ CLANG_CONFIG_EXTRA_CFLAGS += \
+ -target i686-android-linux \
+ -B$(TARGET_TOOLCHAIN_ROOT)/i686-android-linux/bin
+ CLANG_CONFIG_EXTRA_LDFLAGS += \
+ -target i686-android-linux \
+ -B$(TARGET_TOOLCHAIN_ROOT)/i686-android-linux/bin
+ CLANG_CONFIG_UNKNOWN_CFLAGS += \
+ -finline-limit=300 \
+ -fno-inline-functions-called-once \
+ -mfpmath=sse \
+ -mbionic
+endif
+
+CLANG_CONFIG_EXTRA_C_INCLUDES := external/clang/lib/Headers
+
+# remove unknown flags to define CLANG_FLAGS
+TARGET_GLOBAL_CLANG_FLAGS += $(filter-out $(CLANG_CONFIG_UNKNOWN_CFLAGS),$(TARGET_GLOBAL_CFLAGS))
+HOST_GLOBAL_CLANG_FLAGS += $(filter-out $(CLANG_CONFIG_UNKNOWN_CFLAGS),$(HOST_GLOBAL_CFLAGS))
+
+# llvm does not yet support -march=armv5e nor -march=armv5te, fall back to armv5 or armv5t
+$(call clang-flags-subst,-march=armv5te,-march=armv5t)
+$(call clang-flags-subst,-march=armv5e,-march=armv5)
diff --git a/target/product/sdk.mk b/target/product/sdk.mk
index 22e8b1d..f0001cc 100644
--- a/target/product/sdk.mk
+++ b/target/product/sdk.mk
@@ -80,7 +80,8 @@
android \
dexdump \
lint \
- monkeyrunner
+ monkeyrunner \
+ monitor
# Native host Java libraries that are parts of the SDK.
# See development/build/sdk.atree
diff --git a/tools/zipalign/Android.mk b/tools/zipalign/Android.mk
index 8ed60df..9763bd2 100644
--- a/tools/zipalign/Android.mk
+++ b/tools/zipalign/Android.mk
@@ -15,7 +15,6 @@
LOCAL_C_INCLUDES += external/zlib
LOCAL_STATIC_LIBRARIES := \
- libandroidfw \
libutils \
libcutils
diff --git a/tools/zipalign/ZipFile.cpp b/tools/zipalign/ZipFile.cpp
index 8057068..3994c31 100644
--- a/tools/zipalign/ZipFile.cpp
+++ b/tools/zipalign/ZipFile.cpp
@@ -20,8 +20,8 @@
#define LOG_TAG "zip"
-#include <androidfw/ZipUtils.h>
#include <utils/Log.h>
+#include <utils/ZipUtils.h>
#include "ZipFile.h"