summaryrefslogtreecommitdiffstats
path: root/core/binary.mk
diff options
context:
space:
mode:
Diffstat (limited to 'core/binary.mk')
-rw-r--r--core/binary.mk127
1 files changed, 85 insertions, 42 deletions
diff --git a/core/binary.mk b/core/binary.mk
index e488200..852ac46 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -124,6 +124,21 @@ LOCAL_REQUIRED_MODULES += $(installed_shared_library_module_names)
include $(BUILD_SYSTEM)/base_rules.mk
#######################################
+ifeq ($(strip $(LOCAL_ADDRESS_SANITIZER)),true)
+ LOCAL_CLANG := true
+ LOCAL_CFLAGS += $(ADDRESS_SANITIZER_CONFIG_EXTRA_CFLAGS)
+ LOCAL_LDFLAGS += $(ADDRESS_SANITIZER_CONFIG_EXTRA_LDFLAGS)
+ LOCAL_SHARED_LIBRARIES += $(ADDRESS_SANITIZER_CONFIG_EXTRA_SHARED_LIBRARIES)
+ LOCAL_STATIC_LIBRARIES += $(ADDRESS_SANITIZER_CONFIG_EXTRA_STATIC_LIBRARIES)
+endif
+
+my_compiler_dependencies :=
+ifeq ($(strip $(LOCAL_CLANG)),true)
+ LOCAL_CFLAGS += $(CLANG_CONFIG_EXTRA_CFLAGS)
+ LOCAL_LDFLAGS += $(CLANG_CONFIG_EXTRA_LDFLAGS)
+ my_compiler_dependencies := $(CLANG) $(CLANG_CXX)
+endif
+
####################################################
## Add FDO flags if FDO is turned on and supported
####################################################
@@ -142,20 +157,29 @@ LOCAL_ASFLAGS += -D__ASSEMBLY__
###########################################################
## 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
+my_target_c_includes := $(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_c_includes := $(TARGET_C_INCLUDES)
+my_target_global_cflags := $(my_target_global_cflags)
my_target_global_cppflags := $(TARGET_GLOBAL_CPPFLAGS)
+ifeq ($(strip $(LOCAL_CLANG)),true)
+ my_target_c_includes += $(CLANG_CONFIG_EXTRA_TARGET_C_INCLUDES)
+endif
endif
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_PROJECT_INCLUDES := $(my_target_project_includes)
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_C_INCLUDES := $(my_target_c_inclues)
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_C_INCLUDES := $(my_target_c_includes)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CFLAGS := $(my_target_global_cflags)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CPPFLAGS := $(my_target_global_cppflags)
@@ -163,15 +187,23 @@ $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CPPFLAGS := $(my_target_glo
## 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 +279,7 @@ ifneq ($(proto_sources),)
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)
@@ -261,7 +293,7 @@ $(proto_generated_headers): $(proto_generated_cc_sources_dir)/%.pb.h: $(proto_ge
$(proto_generated_cc_sources): PRIVATE_ARM_MODE := $(normal_objects_mode)
$(proto_generated_cc_sources): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
-$(proto_generated_objects): $(proto_generated_cc_sources_dir)/%.o: $(proto_generated_cc_sources_dir)/%.cc
+$(proto_generated_objects): $(proto_generated_cc_sources_dir)/%.o: $(proto_generated_cc_sources_dir)/%.cc $(proto_generated_headers)
$(transform-$(PRIVATE_HOST)cpp-to-o)
-include $(proto_generated_objects:%.o=%.P)
@@ -281,14 +313,14 @@ endif
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 +336,20 @@ endif
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 +374,9 @@ cpp_objects := $(cpp_arm_objects) $(cpp_normal_objects)
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 +393,10 @@ ifneq ($(strip $(gen_cpp_objects)),)
# 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 +409,8 @@ gen_S_sources := $(filter %.S,$(LOCAL_GENERATED_SOURCES))
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 +419,8 @@ gen_s_sources := $(filter %.s,$(LOCAL_GENERATED_SOURCES))
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 +445,8 @@ $(c_normal_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
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 +463,8 @@ ifneq ($(strip $(gen_c_objects)),)
# 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 +477,8 @@ objc_sources := $(filter %.m,$(LOCAL_SRC_FILES))
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 +491,8 @@ asm_sources_S := $(filter %.S,$(LOCAL_SRC_FILES))
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 +501,8 @@ asm_sources_s := $(filter %.s,$(LOCAL_SRC_FILES))
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,19 +517,19 @@ asm_objects := $(asm_objects_S) $(asm_objects_s)
# 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))
-
-LOCAL_C_INCLUDES += $(TOPDIR)$(LOCAL_PATH) $(intermediates) $(base_intermediates)
+ $(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)
ifndef LOCAL_NDK_VERSION
LOCAL_C_INCLUDES += $(JNI_H_INCLUDE)
@@ -571,7 +614,7 @@ built_whole_libraries := \
# We don't care about installed static libraries, since the
# libraries have already been linked into the module at that point.
# We do, however, care about the NOTICE files for any static
-# libraries that we use. (see notice_files.make)
+# libraries that we use. (see notice_files.mk)
installed_static_library_notice_file_targets := \
$(foreach lib,$(LOCAL_STATIC_LIBRARIES) $(LOCAL_WHOLE_STATIC_LIBRARIES), \