From a04abc8e23e6557bc6facbf6031d86115f267441 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Tue, 30 Jun 2015 12:21:59 -0700 Subject: [PATCH] Add support for LOCAL_SRC_FILES_EXCLUDE LOCAL_SRC_FILES_EXCLUDE will be used to filter files out of LOCAL_SRC_FILES. A common usage will be to use LOCAL_SRC_FILES_EXCLUDE_ to remove a source file that will be replaced with an arch-optimized version. Change-Id: I75cc6114c47fb784bab65cae8f618c4f395f07bb --- core/binary.mk | 4 ++++ core/clear_vars.mk | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/core/binary.mk b/core/binary.mk index f2d72a5e2..080310aa2 100644 --- a/core/binary.mk +++ b/core/binary.mk @@ -34,6 +34,7 @@ endif # Because the same LOCAL_ variables may be used to define modules for both 1st arch and 2nd arch, # we can't modify them in place. my_src_files := $(LOCAL_SRC_FILES) +my_src_files_exclude := $(LOCAL_SRC_FILES_EXCLUDE) my_static_libraries := $(LOCAL_STATIC_LIBRARIES) my_whole_static_libraries := $(LOCAL_WHOLE_STATIC_LIBRARIES) my_shared_libraries := $(LOCAL_SHARED_LIBRARIES) @@ -167,6 +168,7 @@ my_generated_sources += $(LOCAL_GENERATED_SOURCES_$($(my_prefix)OS)) endif my_src_files += $(LOCAL_SRC_FILES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_SRC_FILES_$(my_32_64_bit_suffix)) +my_src_files_exclude += $(LOCAL_SRC_FILES_EXCLUDE_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_SRC_FILES_EXCLUDE_$(my_32_64_bit_suffix)) my_shared_libraries += $(LOCAL_SHARED_LIBRARIES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_SHARED_LIBRARIES_$(my_32_64_bit_suffix)) my_cflags += $(LOCAL_CFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CFLAGS_$(my_32_64_bit_suffix)) my_cppflags += $(LOCAL_CPPFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CPPFLAGS_$(my_32_64_bit_suffix)) @@ -175,6 +177,8 @@ my_asflags += $(LOCAL_ASFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $ my_c_includes += $(LOCAL_C_INCLUDES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_C_INCLUDES_$(my_32_64_bit_suffix)) my_generated_sources += $(LOCAL_GENERATED_SOURCES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_GENERATED_SOURCES_$(my_32_64_bit_suffix)) +my_src_files := $(filter-out $(my_src_files_exclude),$(my_src_files)) + my_clang := $(strip $(LOCAL_CLANG)) ifdef LOCAL_CLANG_$(my_32_64_bit_suffix) my_clang := $(strip $(LOCAL_CLANG_$(my_32_64_bit_suffix))) diff --git a/core/clear_vars.mk b/core/clear_vars.mk index b47996f5d..fed91e8d1 100644 --- a/core/clear_vars.mk +++ b/core/clear_vars.mk @@ -28,6 +28,7 @@ LOCAL_REQUIRED_MODULES:= LOCAL_ACP_UNAVAILABLE:= LOCAL_MODULE_TAGS:= LOCAL_SRC_FILES:= +LOCAL_SRC_FILES_EXCLUDE:= LOCAL_PREBUILT_OBJ_FILES:= LOCAL_STATIC_JAVA_LIBRARIES:= LOCAL_STATIC_JAVA_AAR_LIBRARIES:= @@ -191,6 +192,7 @@ LOCAL_MODULE_HOST_OS:= # arch specific variables LOCAL_SRC_FILES_$(TARGET_ARCH):= +LOCAL_SRC_FILES_EXCLUDE_$(TARGET_ARCH):= LOCAL_CFLAGS_$(TARGET_ARCH):= LOCAL_CLANG_CFLAGS_$(TARGET_ARCH):= LOCAL_CPPFLAGS_$(TARGET_ARCH):= @@ -209,6 +211,7 @@ LOCAL_CLANG_$(TARGET_ARCH):= LOCAL_PREBUILT_JNI_LIBS_$(TARGET_ARCH):= ifdef TARGET_2ND_ARCH LOCAL_SRC_FILES_$(TARGET_2ND_ARCH):= +LOCAL_SRC_FILES_EXCLUDE_$(TARGET_2ND_ARCH):= LOCAL_CFLAGS_$(TARGET_2ND_ARCH):= LOCAL_CLANG_CFLAGS_$(TARGET_2ND_ARCH):= LOCAL_CPPFLAGS_$(TARGET_2ND_ARCH):= @@ -227,6 +230,7 @@ LOCAL_CLANG_$(TARGET_2ND_ARCH):= LOCAL_PREBUILT_JNI_LIBS_$(TARGET_2ND_ARCH):= endif LOCAL_SRC_FILES_$(HOST_ARCH):= +LOCAL_SRC_FILES_EXCLUDE_$(HOST_ARCH):= LOCAL_CFLAGS_$(HOST_ARCH):= LOCAL_CLANG_CFLAGS_$(HOST_ARCH):= LOCAL_CPPFLAGS_$(HOST_ARCH):= @@ -244,6 +248,7 @@ LOCAL_REQUIRED_MODULES_$(HOST_ARCH):= LOCAL_CLANG_$(HOST_ARCH):= ifdef HOST_2ND_ARCH LOCAL_SRC_FILES_$(HOST_2ND_ARCH):= +LOCAL_SRC_FILES_EXCLUDE_$(HOST_2ND_ARCH):= LOCAL_CFLAGS_$(HOST_2ND_ARCH):= LOCAL_CLANG_CFLAGS_$(HOST_2ND_ARCH):= LOCAL_CPPFLAGS_$(HOST_2ND_ARCH):= @@ -297,6 +302,8 @@ endif LOCAL_SRC_FILES_32:= LOCAL_SRC_FILES_64:= +LOCAL_SRC_FILES_EXCLUDE_32:= +LOCAL_SRC_FILES_EXCLUDE_64:= LOCAL_SHARED_LIBRARIES_32:= LOCAL_SHARED_LIBRARIES_64:= LOCAL_STATIC_LIBRARIES_32:=