2009-03-04 04:28:42 +01:00
|
|
|
###########################################################
|
|
|
|
## Standard rules for building binary object files from
|
2014-03-22 00:17:04 +01:00
|
|
|
## asm/c/cpp/yacc/lex/etc source files.
|
2009-03-04 04:28:42 +01:00
|
|
|
##
|
|
|
|
## The list of object files is exported in $(all_objects).
|
|
|
|
###########################################################
|
|
|
|
|
2014-03-22 00:17:04 +01:00
|
|
|
#######################################
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
#######################################
|
|
|
|
|
2014-11-15 00:28:49 +01:00
|
|
|
##################################################
|
|
|
|
# Compute the dependency of the shared libraries
|
|
|
|
##################################################
|
|
|
|
# On the target, we compile with -nostdlib, so we must add in the
|
|
|
|
# default system shared libraries, unless they have requested not
|
|
|
|
# to by supplying a LOCAL_SYSTEM_SHARED_LIBRARIES value. One would
|
|
|
|
# supply that, for example, when building libc itself.
|
|
|
|
ifdef LOCAL_IS_HOST_MODULE
|
|
|
|
ifeq ($(LOCAL_SYSTEM_SHARED_LIBRARIES),none)
|
|
|
|
my_system_shared_libraries :=
|
|
|
|
else
|
|
|
|
my_system_shared_libraries := $(LOCAL_SYSTEM_SHARED_LIBRARIES)
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
ifeq ($(LOCAL_SYSTEM_SHARED_LIBRARIES),none)
|
2015-08-06 21:22:40 +02:00
|
|
|
my_system_shared_libraries := libc libm
|
2014-11-15 00:28:49 +01:00
|
|
|
else
|
|
|
|
my_system_shared_libraries := $(LOCAL_SYSTEM_SHARED_LIBRARIES)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
# The following LOCAL_ variables will be modified in this file.
|
|
|
|
# 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_static_libraries := $(LOCAL_STATIC_LIBRARIES)
|
|
|
|
my_whole_static_libraries := $(LOCAL_WHOLE_STATIC_LIBRARIES)
|
|
|
|
my_shared_libraries := $(LOCAL_SHARED_LIBRARIES)
|
|
|
|
my_cflags := $(LOCAL_CFLAGS)
|
2014-11-26 09:53:46 +01:00
|
|
|
my_conlyflags := $(LOCAL_CONLYFLAGS)
|
2014-11-15 00:28:49 +01:00
|
|
|
my_cppflags := $(LOCAL_CPPFLAGS)
|
2015-06-11 01:33:43 +02:00
|
|
|
my_cflags_no_override := $(GLOBAL_CFLAGS_NO_OVERRIDE)
|
|
|
|
my_cppflags_no_override := $(GLOBAL_CPPFLAGS_NO_OVERRIDE)
|
2014-11-15 00:28:49 +01:00
|
|
|
my_ldflags := $(LOCAL_LDFLAGS)
|
|
|
|
my_ldlibs := $(LOCAL_LDLIBS)
|
|
|
|
my_asflags := $(LOCAL_ASFLAGS)
|
|
|
|
my_cc := $(LOCAL_CC)
|
2015-07-21 03:40:18 +02:00
|
|
|
my_cc_wrapper := $(CC_WRAPPER)
|
2014-11-15 00:28:49 +01:00
|
|
|
my_cxx := $(LOCAL_CXX)
|
2015-07-21 03:40:18 +02:00
|
|
|
my_cxx_wrapper := $(CXX_WRAPPER)
|
2014-11-15 00:28:49 +01:00
|
|
|
my_c_includes := $(LOCAL_C_INCLUDES)
|
|
|
|
my_generated_sources := $(LOCAL_GENERATED_SOURCES)
|
|
|
|
my_native_coverage := $(LOCAL_NATIVE_COVERAGE)
|
|
|
|
my_additional_dependencies := $(LOCAL_MODULE_MAKEFILE) $(LOCAL_ADDITIONAL_DEPENDENCIES)
|
2015-04-07 20:59:34 +02:00
|
|
|
my_export_c_include_dirs := $(LOCAL_EXPORT_C_INCLUDE_DIRS)
|
2014-11-15 00:28:49 +01:00
|
|
|
|
2014-11-15 02:15:00 +01:00
|
|
|
ifdef LOCAL_IS_HOST_MODULE
|
|
|
|
my_allow_undefined_symbols := true
|
|
|
|
else
|
|
|
|
my_allow_undefined_symbols := $(strip $(LOCAL_ALLOW_UNDEFINED_SYMBOLS))
|
|
|
|
endif
|
|
|
|
|
2014-04-26 08:47:10 +02:00
|
|
|
my_ndk_sysroot :=
|
|
|
|
my_ndk_sysroot_include :=
|
|
|
|
my_ndk_sysroot_lib :=
|
2012-08-14 19:13:16 +02:00
|
|
|
ifdef LOCAL_SDK_VERSION
|
2012-08-14 20:08:03 +02:00
|
|
|
ifdef LOCAL_NDK_VERSION
|
|
|
|
$(error $(LOCAL_PATH): LOCAL_NDK_VERSION is now retired.)
|
|
|
|
endif
|
2010-07-13 23:55:47 +02:00
|
|
|
ifdef LOCAL_IS_HOST_MODULE
|
2012-10-02 01:36:23 +02:00
|
|
|
$(error $(LOCAL_PATH): LOCAL_SDK_VERSION cannot be used in host module)
|
2010-07-13 23:55:47 +02:00
|
|
|
endif
|
2012-08-14 19:13:16 +02:00
|
|
|
my_ndk_source_root := $(HISTORICAL_NDK_VERSIONS_ROOT)/current/sources
|
2014-04-26 08:47:10 +02:00
|
|
|
my_ndk_sysroot := $(HISTORICAL_NDK_VERSIONS_ROOT)/current/platforms/android-$(LOCAL_SDK_VERSION)/arch-$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)
|
|
|
|
my_ndk_sysroot_include := $(my_ndk_sysroot)/usr/include
|
|
|
|
ifeq (x86_64,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
|
|
|
|
my_ndk_sysroot_lib := $(my_ndk_sysroot)/usr/lib64
|
2014-11-09 00:25:18 +01:00
|
|
|
else ifeq (mips32r6,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH_VARIANT))
|
|
|
|
my_ndk_sysroot_lib := $(my_ndk_sysroot)/usr/libr6
|
2014-04-26 08:47:10 +02:00
|
|
|
else
|
|
|
|
my_ndk_sysroot_lib := $(my_ndk_sysroot)/usr/lib
|
|
|
|
endif
|
2011-03-04 03:53:53 +01:00
|
|
|
|
2015-04-24 03:48:52 +02:00
|
|
|
# The bionic linker now has support for packed relocations and gnu style
|
|
|
|
# hashes (which are much faster!), but shipping to older devices requires
|
|
|
|
# the old style hash and disabling packed relocations.
|
2014-11-15 00:28:49 +01:00
|
|
|
#ifeq ($(shell expr $(LOCAL_SDK_VERSION) >= FIRST_SUPPORTED_VERSION),0)
|
|
|
|
my_ldflags += -Wl,--hash-style=sysv
|
2015-04-24 03:48:52 +02:00
|
|
|
LOCAL_PACK_MODULE_RELOCATIONS := false
|
2014-11-15 00:28:49 +01:00
|
|
|
#endif
|
|
|
|
|
2011-03-04 03:53:53 +01:00
|
|
|
# Set up the NDK stl variant. Starting from NDK-r5 the c++ stl resides in a separate location.
|
|
|
|
# See ndk/docs/CPLUSPLUS-SUPPORT.html
|
|
|
|
my_ndk_stl_include_path :=
|
|
|
|
my_ndk_stl_shared_lib_fullpath :=
|
|
|
|
my_ndk_stl_shared_lib :=
|
|
|
|
my_ndk_stl_static_lib :=
|
2014-03-04 10:11:52 +01:00
|
|
|
my_ndk_stl_cppflags :=
|
2014-11-09 00:25:18 +01:00
|
|
|
my_cpu_variant := $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)CPU_ABI)
|
|
|
|
ifeq (mips32r6,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH_VARIANT))
|
|
|
|
my_cpu_variant := mips32r6
|
|
|
|
endif
|
2014-03-04 10:11:52 +01:00
|
|
|
LOCAL_NDK_STL_VARIANT := $(strip $(LOCAL_NDK_STL_VARIANT))
|
2011-03-04 03:53:53 +01:00
|
|
|
ifeq (,$(LOCAL_NDK_STL_VARIANT))
|
|
|
|
LOCAL_NDK_STL_VARIANT := system
|
|
|
|
endif
|
2014-03-04 10:11:52 +01:00
|
|
|
ifneq (1,$(words $(filter system stlport_static stlport_shared c++_static c++_shared gnustl_static, $(LOCAL_NDK_STL_VARIANT))))
|
2012-08-14 19:13:16 +02:00
|
|
|
$(error $(LOCAL_PATH): Unknown LOCAL_NDK_STL_VARIANT $(LOCAL_NDK_STL_VARIANT))
|
2011-03-04 03:53:53 +01:00
|
|
|
endif
|
|
|
|
ifeq (system,$(LOCAL_NDK_STL_VARIANT))
|
|
|
|
my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/system/include
|
|
|
|
# for "system" variant, the shared library exists in the system library and -lstdc++ is added by default.
|
|
|
|
else # LOCAL_NDK_STL_VARIANT is not system
|
|
|
|
ifneq (,$(filter stlport_%, $(LOCAL_NDK_STL_VARIANT)))
|
|
|
|
my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/stlport/stlport
|
|
|
|
ifeq (stlport_static,$(LOCAL_NDK_STL_VARIANT))
|
2014-11-09 00:25:18 +01:00
|
|
|
my_ndk_stl_static_lib := $(my_ndk_source_root)/cxx-stl/stlport/libs/$(my_cpu_variant)/libstlport_static.a
|
2011-03-04 03:53:53 +01:00
|
|
|
else
|
2014-11-09 00:25:18 +01:00
|
|
|
my_ndk_stl_shared_lib_fullpath := $(my_ndk_source_root)/cxx-stl/stlport/libs/$(my_cpu_variant)/libstlport_shared.so
|
2011-03-04 03:53:53 +01:00
|
|
|
my_ndk_stl_shared_lib := -lstlport_shared
|
|
|
|
endif
|
2014-03-04 10:11:52 +01:00
|
|
|
else # LOCAL_NDK_STL_VARIANT is not stlport_* either
|
|
|
|
ifneq (,$(filter c++_%, $(LOCAL_NDK_STL_VARIANT)))
|
|
|
|
my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/llvm-libc++/libcxx/include \
|
|
|
|
$(my_ndk_source_root)/cxx-stl/llvm-libc++/gabi++/include \
|
|
|
|
$(my_ndk_source_root)/android/support/include
|
|
|
|
ifeq (c++_static,$(LOCAL_NDK_STL_VARIANT))
|
2014-11-09 00:25:18 +01:00
|
|
|
my_ndk_stl_static_lib := $(my_ndk_source_root)/cxx-stl/llvm-libc++/libs/$(my_cpu_variant)/libc++_static.a
|
2014-03-04 10:11:52 +01:00
|
|
|
else
|
2014-11-09 00:25:18 +01:00
|
|
|
my_ndk_stl_shared_lib_fullpath := $(my_ndk_source_root)/cxx-stl/llvm-libc++/libs/$(my_cpu_variant)/libc++_shared.so
|
2014-03-04 10:11:52 +01:00
|
|
|
my_ndk_stl_shared_lib := -lc++_shared
|
|
|
|
endif
|
|
|
|
my_ndk_stl_cppflags := -std=c++11
|
2011-03-04 03:53:53 +01:00
|
|
|
else
|
|
|
|
# LOCAL_NDK_STL_VARIANT is gnustl_static
|
2014-11-09 00:25:18 +01:00
|
|
|
my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/$($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_NDK_GCC_VERSION)/libs/$(my_cpu_variant)/include \
|
2014-04-11 07:46:26 +02:00
|
|
|
$(my_ndk_source_root)/cxx-stl/gnu-libstdc++/$($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_NDK_GCC_VERSION)/include
|
2014-11-09 00:25:18 +01:00
|
|
|
my_ndk_stl_static_lib := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/$($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_NDK_GCC_VERSION)/libs/$(my_cpu_variant)/libgnustl_static.a
|
2011-03-04 03:53:53 +01:00
|
|
|
endif
|
|
|
|
endif
|
2014-03-04 10:11:52 +01:00
|
|
|
endif
|
2011-09-15 22:50:52 +02:00
|
|
|
endif
|
2011-03-04 03:53:53 +01:00
|
|
|
|
2014-08-08 03:29:11 +02:00
|
|
|
# MinGW spits out warnings about -fPIC even for -fpie?!) being ignored because
|
|
|
|
# all code is position independent, and then those warnings get promoted to
|
|
|
|
# errors.
|
2015-08-14 21:59:50 +02:00
|
|
|
ifneq ($($(my_prefix)OS),windows)
|
2014-08-06 21:36:46 +02:00
|
|
|
ifeq ($(LOCAL_MODULE_CLASS),EXECUTABLES)
|
|
|
|
my_cflags += -fpie
|
|
|
|
else
|
|
|
|
my_cflags += -fPIC
|
|
|
|
endif
|
2014-08-08 03:29:11 +02:00
|
|
|
endif
|
2014-08-06 21:36:46 +02:00
|
|
|
|
2015-08-14 02:51:40 +02:00
|
|
|
ifdef LOCAL_IS_HOST_MODULE
|
2015-08-19 02:47:06 +02:00
|
|
|
my_src_files += $(LOCAL_SRC_FILES_$($(my_prefix)OS)) $(LOCAL_SRC_FILES_$($(my_prefix)OS)_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
|
2015-08-14 02:51:40 +02:00
|
|
|
my_static_libraries += $(LOCAL_STATIC_LIBRARIES_$($(my_prefix)OS))
|
|
|
|
my_shared_libraries += $(LOCAL_SHARED_LIBRARIES_$($(my_prefix)OS))
|
|
|
|
my_cflags += $(LOCAL_CFLAGS_$($(my_prefix)OS))
|
|
|
|
my_cppflags += $(LOCAL_CPPFLAGS_$($(my_prefix)OS))
|
|
|
|
my_ldflags += $(LOCAL_LDFLAGS_$($(my_prefix)OS))
|
|
|
|
my_ldlibs += $(LOCAL_LDLIBS_$($(my_prefix)OS))
|
|
|
|
my_asflags += $(LOCAL_ASFLAGS_$($(my_prefix)OS))
|
|
|
|
my_c_includes += $(LOCAL_C_INCLUDES_$($(my_prefix)OS))
|
|
|
|
my_generated_sources += $(LOCAL_GENERATED_SOURCES_$($(my_prefix)OS))
|
|
|
|
endif
|
|
|
|
|
2014-04-17 19:03:35 +02:00
|
|
|
my_src_files += $(LOCAL_SRC_FILES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_SRC_FILES_$(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))
|
|
|
|
my_ldflags += $(LOCAL_LDFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_LDFLAGS_$(my_32_64_bit_suffix))
|
|
|
|
my_asflags += $(LOCAL_ASFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_ASFLAGS_$(my_32_64_bit_suffix))
|
|
|
|
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))
|
2014-02-13 06:15:12 +01:00
|
|
|
|
2014-08-18 20:14:38 +02:00
|
|
|
my_clang := $(strip $(LOCAL_CLANG))
|
2014-05-27 22:03:36 +02:00
|
|
|
ifdef LOCAL_CLANG_$(my_32_64_bit_suffix)
|
2014-08-18 20:14:38 +02:00
|
|
|
my_clang := $(strip $(LOCAL_CLANG_$(my_32_64_bit_suffix)))
|
2014-05-27 22:03:36 +02:00
|
|
|
endif
|
|
|
|
ifdef LOCAL_CLANG_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)
|
2014-08-18 20:14:38 +02:00
|
|
|
my_clang := $(strip $(LOCAL_CLANG_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)))
|
2014-05-27 22:03:36 +02:00
|
|
|
endif
|
|
|
|
|
2014-04-04 23:38:29 +02:00
|
|
|
# clang is enabled by default for host builds
|
|
|
|
# enable it unless we've specifically disabled clang above
|
|
|
|
ifdef LOCAL_IS_HOST_MODULE
|
2015-08-14 21:59:50 +02:00
|
|
|
ifneq ($($(my_prefix)OS),windows)
|
2014-07-24 23:42:53 +02:00
|
|
|
ifeq ($(my_clang),)
|
|
|
|
my_clang := true
|
|
|
|
endif
|
|
|
|
endif
|
2015-09-10 00:45:21 +02:00
|
|
|
# Add option to make clang the default for device build
|
|
|
|
else ifeq ($(USE_CLANG_PLATFORM_BUILD),true)
|
|
|
|
ifeq ($(my_clang),)
|
|
|
|
my_clang := true
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2015-07-30 00:13:57 +02:00
|
|
|
my_cpp_std_version := -std=gnu++14
|
|
|
|
ifdef LOCAL_SDK_VERSION
|
|
|
|
# The NDK handles this itself.
|
|
|
|
my_cpp_std_version :=
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef LOCAL_IS_HOST_MODULE
|
|
|
|
ifneq ($(my_clang),true)
|
|
|
|
# The host GCC doesn't support C++14 (and is deprecated, so likely
|
|
|
|
# never will). Build these modules with C++11.
|
|
|
|
my_cpp_std_version := -std=gnu++11
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
my_cppflags := $(my_cpp_std_version) $(my_cppflags)
|
|
|
|
|
2014-08-13 20:53:07 +02:00
|
|
|
|
2014-02-13 06:15:12 +01:00
|
|
|
# arch-specific static libraries go first so that generic ones can depend on them
|
2014-04-17 19:03:35 +02:00
|
|
|
my_static_libraries := $(LOCAL_STATIC_LIBRARIES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_STATIC_LIBRARIES_$(my_32_64_bit_suffix)) $(my_static_libraries)
|
|
|
|
my_whole_static_libraries := $(LOCAL_WHOLE_STATIC_LIBRARIES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_WHOLE_STATIC_LIBRARIES_$(my_32_64_bit_suffix)) $(my_whole_static_libraries)
|
2014-01-16 01:02:16 +01:00
|
|
|
|
2014-10-07 22:03:29 +02:00
|
|
|
include $(BUILD_SYSTEM)/cxx_stl_setup.mk
|
2014-05-24 01:42:37 +02:00
|
|
|
|
2013-08-13 21:35:10 +02:00
|
|
|
# Add static HAL libraries
|
|
|
|
ifdef LOCAL_HAL_STATIC_LIBRARIES
|
|
|
|
$(foreach lib, $(LOCAL_HAL_STATIC_LIBRARIES), \
|
|
|
|
$(eval b_lib := $(filter $(lib).%,$(BOARD_HAL_STATIC_LIBRARIES)))\
|
2014-01-16 01:02:16 +01:00
|
|
|
$(if $(b_lib), $(eval my_static_libraries += $(b_lib)),\
|
|
|
|
$(eval my_static_libraries += $(lib).default)))
|
2013-08-13 21:35:10 +02:00
|
|
|
b_lib :=
|
|
|
|
endif
|
|
|
|
|
2015-07-11 03:06:51 +02:00
|
|
|
my_linker := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LINKER)
|
|
|
|
|
2014-11-01 00:23:08 +01:00
|
|
|
include $(BUILD_SYSTEM)/config_sanitizers.mk
|
2012-03-30 10:15:12 +02:00
|
|
|
|
2013-01-27 10:45:59 +01:00
|
|
|
# Add in libcompiler_rt for all regular device builds
|
2015-04-09 23:41:06 +02:00
|
|
|
ifeq (,$(LOCAL_SDK_VERSION)$(WITHOUT_LIBCOMPILER_RT))
|
2014-01-16 01:02:16 +01:00
|
|
|
my_static_libraries += $(COMPILER_RT_CONFIG_EXTRA_STATIC_LIBRARIES)
|
2012-06-11 23:53:34 +02:00
|
|
|
endif
|
|
|
|
|
2009-09-22 01:31:50 +02:00
|
|
|
####################################################
|
|
|
|
## Add FDO flags if FDO is turned on and supported
|
2014-09-19 19:18:12 +02:00
|
|
|
## Please note that we will do option filtering during FDO build.
|
|
|
|
## i.e. Os->O2, remove -fno-early-inline and -finline-limit.
|
|
|
|
##################################################################
|
2014-10-28 22:50:59 +01:00
|
|
|
my_fdo_build :=
|
|
|
|
ifneq ($(filter true always, $(LOCAL_FDO_SUPPORT)),)
|
|
|
|
ifeq ($(BUILD_FDO_INSTRUMENT),true)
|
|
|
|
my_cflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_FDO_INSTRUMENT_CFLAGS)
|
|
|
|
my_ldflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_FDO_INSTRUMENT_LDFLAGS)
|
|
|
|
my_fdo_build := true
|
|
|
|
else ifneq ($(filter true,$(BUILD_FDO_OPTIMIZE))$(filter always,$(LOCAL_FDO_SUPPORT)),)
|
|
|
|
my_cflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_FDO_OPTIMIZE_CFLAGS)
|
|
|
|
my_fdo_build := true
|
2013-08-05 11:44:37 +02:00
|
|
|
endif
|
2015-07-21 03:40:18 +02:00
|
|
|
# Disable ccache (or other compiler wrapper).
|
|
|
|
my_cc_wrapper :=
|
|
|
|
my_cxx_wrapper :=
|
2009-09-22 01:31:50 +02:00
|
|
|
endif
|
|
|
|
|
2010-07-13 23:55:47 +02:00
|
|
|
###########################################################
|
2010-10-14 10:15:56 +02:00
|
|
|
## Explicitly declare assembly-only __ASSEMBLY__ macro for
|
|
|
|
## assembly source
|
|
|
|
###########################################################
|
2014-01-16 01:02:16 +01:00
|
|
|
my_asflags += -D__ASSEMBLY__
|
2010-10-14 10:15:56 +02:00
|
|
|
|
2014-03-22 00:17:04 +01:00
|
|
|
|
2010-10-20 00:19:45 +02:00
|
|
|
###########################################################
|
2010-07-13 23:55:47 +02:00
|
|
|
## Define PRIVATE_ variables from global vars
|
|
|
|
###########################################################
|
2014-01-09 23:39:41 +01:00
|
|
|
ifndef LOCAL_IS_HOST_MODULE
|
2012-08-14 19:13:16 +02:00
|
|
|
ifdef LOCAL_SDK_VERSION
|
2010-07-13 23:55:47 +02:00
|
|
|
my_target_project_includes :=
|
2014-04-26 08:47:10 +02:00
|
|
|
my_target_c_includes := $(my_ndk_stl_include_path) $(my_ndk_sysroot_include)
|
2014-03-04 10:11:52 +01:00
|
|
|
my_target_global_cppflags := $(my_ndk_stl_cppflags)
|
2010-07-13 23:55:47 +02:00
|
|
|
else
|
2014-01-16 01:02:16 +01:00
|
|
|
my_target_project_includes := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_PROJECT_INCLUDES)
|
|
|
|
my_target_c_includes := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_C_INCLUDES)
|
2014-03-04 10:11:52 +01:00
|
|
|
my_target_global_cppflags :=
|
2013-08-15 20:01:10 +02:00
|
|
|
endif # LOCAL_SDK_VERSION
|
|
|
|
|
2014-05-27 22:03:36 +02:00
|
|
|
ifeq ($(my_clang),true)
|
2014-02-07 03:08:44 +01:00
|
|
|
my_target_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_TARGET_GLOBAL_CFLAGS)
|
2014-11-26 09:53:46 +01:00
|
|
|
my_target_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_TARGET_GLOBAL_CONLYFLAGS)
|
2014-03-04 10:11:52 +01:00
|
|
|
my_target_global_cppflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_TARGET_GLOBAL_CPPFLAGS)
|
2014-02-07 03:08:44 +01:00
|
|
|
my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_TARGET_GLOBAL_LDFLAGS)
|
2012-08-17 01:45:01 +02:00
|
|
|
else
|
2014-01-16 01:02:16 +01:00
|
|
|
my_target_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_CFLAGS)
|
2014-11-26 09:53:46 +01:00
|
|
|
my_target_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_CONLYFLAGS)
|
2014-03-04 10:11:52 +01:00
|
|
|
my_target_global_cppflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_CPPFLAGS)
|
2014-01-16 01:02:16 +01:00
|
|
|
my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LDFLAGS)
|
2014-05-27 22:03:36 +02:00
|
|
|
endif # my_clang
|
2012-08-17 01:45:01 +02:00
|
|
|
|
2010-07-13 23:55:47 +02:00
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_PROJECT_INCLUDES := $(my_target_project_includes)
|
2012-03-30 10:18:52 +02:00
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_C_INCLUDES := $(my_target_c_includes)
|
2010-07-13 23:55:47 +02:00
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CFLAGS := $(my_target_global_cflags)
|
2014-11-26 09:53:46 +01:00
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CONLYFLAGS := $(my_target_global_conlyflags)
|
2013-12-10 12:07:41 +01:00
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CPPFLAGS := $(my_target_global_cppflags)
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(my_target_global_ldflags)
|
|
|
|
|
2014-01-09 23:39:41 +01:00
|
|
|
else # LOCAL_IS_HOST_MODULE
|
|
|
|
|
2014-05-27 22:03:36 +02:00
|
|
|
ifeq ($(my_clang),true)
|
2015-08-14 21:59:50 +02:00
|
|
|
my_host_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CFLAGS)
|
|
|
|
my_host_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CONLYFLAGS)
|
|
|
|
my_host_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CPPFLAGS)
|
|
|
|
my_host_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_LDFLAGS)
|
|
|
|
my_host_c_includes := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES)
|
2013-12-10 12:07:41 +01:00
|
|
|
else
|
2015-08-14 21:59:50 +02:00
|
|
|
my_host_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_CFLAGS)
|
|
|
|
my_host_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_CONLYFLAGS)
|
|
|
|
my_host_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_CPPFLAGS)
|
|
|
|
my_host_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_LDFLAGS)
|
|
|
|
my_host_c_includes := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES)
|
2014-05-27 22:03:36 +02:00
|
|
|
endif # my_clang
|
2013-12-10 12:07:41 +01:00
|
|
|
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_C_INCLUDES := $(my_host_c_includes)
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_CFLAGS := $(my_host_global_cflags)
|
2014-11-26 09:53:46 +01:00
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_CONLYFLAGS := $(my_host_global_conlyflags)
|
2013-12-10 12:07:41 +01:00
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_CPPFLAGS := $(my_host_global_cppflags)
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_LDFLAGS := $(my_host_global_ldflags)
|
|
|
|
endif # LOCAL_IS_HOST_MODULE
|
2010-07-13 23:55:47 +02:00
|
|
|
|
2015-01-24 01:12:57 +01:00
|
|
|
# To enable coverage for a given module, set LOCAL_NATIVE_COVERAGE=true and
|
|
|
|
# build with NATIVE_COVERAGE=true in your enviornment. Note that the build
|
|
|
|
# system is not sensitive to changes to NATIVE_COVERAGE, so you should do a
|
|
|
|
# clean build of your module after toggling it.
|
|
|
|
ifeq ($(NATIVE_COVERAGE),true)
|
|
|
|
ifeq ($(my_native_coverage),true)
|
2015-01-26 01:20:57 +01:00
|
|
|
# Note that clang coverage doesn't play nicely with acov out of the box.
|
|
|
|
# Clang apparently generates .gcno files that aren't compatible with
|
|
|
|
# gcov-4.8. This can be solved by installing gcc-4.6 and invoking lcov
|
|
|
|
# with `--gcov-tool /usr/bin/gcov-4.6`.
|
|
|
|
#
|
|
|
|
# http://stackoverflow.com/questions/17758126/clang-code-coverage-invalid-output
|
2015-01-25 00:14:35 +01:00
|
|
|
my_cflags += --coverage -O0
|
2015-01-26 01:20:57 +01:00
|
|
|
my_ldflags += --coverage
|
2015-01-24 01:12:57 +01:00
|
|
|
endif
|
|
|
|
else
|
|
|
|
my_native_coverage := false
|
|
|
|
endif
|
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
###########################################################
|
|
|
|
## Define PRIVATE_ variables used by multiple module types
|
|
|
|
###########################################################
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_NO_DEFAULT_COMPILER_FLAGS := \
|
2012-03-22 19:26:22 +01:00
|
|
|
$(strip $(LOCAL_NO_DEFAULT_COMPILER_FLAGS))
|
2009-03-04 04:28:42 +01:00
|
|
|
|
2013-08-27 11:33:06 +02:00
|
|
|
ifeq ($(strip $(WITH_SYNTAX_CHECK)),)
|
|
|
|
LOCAL_NO_SYNTAX_CHECK := true
|
|
|
|
endif
|
|
|
|
|
2013-09-10 11:37:14 +02:00
|
|
|
ifeq ($(strip $(WITH_STATIC_ANALYZER)),)
|
|
|
|
LOCAL_NO_STATIC_ANALYZER := true
|
|
|
|
endif
|
|
|
|
|
2013-08-27 11:33:06 +02:00
|
|
|
ifneq ($(strip $(LOCAL_IS_HOST_MODULE)),)
|
|
|
|
my_syntax_arch := host
|
|
|
|
else
|
2014-01-16 01:02:16 +01:00
|
|
|
my_syntax_arch := $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)
|
2013-08-27 11:33:06 +02:00
|
|
|
endif
|
|
|
|
|
2014-01-16 01:02:16 +01:00
|
|
|
ifeq ($(strip $(my_cc)),)
|
2014-08-18 20:14:38 +02:00
|
|
|
ifeq ($(my_clang),true)
|
2014-01-16 01:02:16 +01:00
|
|
|
my_cc := $(CLANG)
|
2012-03-20 15:00:16 +01:00
|
|
|
else
|
2014-01-16 01:02:16 +01:00
|
|
|
my_cc := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)CC)
|
2012-03-20 15:00:16 +01:00
|
|
|
endif
|
2015-07-21 03:40:18 +02:00
|
|
|
my_cc := $(my_cc_wrapper) $(my_cc)
|
2009-03-04 04:28:42 +01:00
|
|
|
endif
|
2013-09-10 11:37:14 +02:00
|
|
|
ifneq ($(LOCAL_NO_STATIC_ANALYZER),true)
|
2014-01-16 01:02:16 +01:00
|
|
|
my_cc := $(SYNTAX_TOOLS_PREFIX)/ccc-analyzer $(my_syntax_arch) "$(my_cc)"
|
2013-09-10 11:37:14 +02:00
|
|
|
else
|
2013-08-27 11:33:06 +02:00
|
|
|
ifneq ($(LOCAL_NO_SYNTAX_CHECK),true)
|
2014-01-16 01:02:16 +01:00
|
|
|
my_cc := $(SYNTAX_TOOLS_PREFIX)/ccc-syntax $(my_syntax_arch) "$(my_cc)"
|
2013-08-27 11:33:06 +02:00
|
|
|
endif
|
2013-09-10 11:37:14 +02:00
|
|
|
endif
|
2014-01-16 01:02:16 +01:00
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CC := $(my_cc)
|
2009-03-04 04:28:42 +01:00
|
|
|
|
2014-01-16 01:02:16 +01:00
|
|
|
ifeq ($(strip $(my_cxx)),)
|
2014-08-18 20:14:38 +02:00
|
|
|
ifeq ($(my_clang),true)
|
2014-01-16 01:02:16 +01:00
|
|
|
my_cxx := $(CLANG_CXX)
|
2012-03-20 15:00:16 +01:00
|
|
|
else
|
2014-01-16 01:02:16 +01:00
|
|
|
my_cxx := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)CXX)
|
2012-03-20 15:00:16 +01:00
|
|
|
endif
|
2015-07-21 03:40:18 +02:00
|
|
|
my_cxx := $(my_cxx_wrapper) $(my_cxx)
|
2009-03-04 04:28:42 +01:00
|
|
|
endif
|
2013-09-10 11:37:14 +02:00
|
|
|
ifneq ($(LOCAL_NO_STATIC_ANALYZER),true)
|
2014-01-16 01:02:16 +01:00
|
|
|
my_cxx := $(SYNTAX_TOOLS_PREFIX)/cxx-analyzer $(my_syntax_arch) "$(my_cxx)"
|
2013-09-10 11:37:14 +02:00
|
|
|
else
|
2013-08-27 11:33:06 +02:00
|
|
|
ifneq ($(LOCAL_NO_SYNTAX_CHECK),true)
|
2014-01-16 01:02:16 +01:00
|
|
|
my_cxx := $(SYNTAX_TOOLS_PREFIX)/cxx-syntax $(my_syntax_arch) "$(my_cxx)"
|
2013-08-27 11:33:06 +02:00
|
|
|
endif
|
2013-09-10 11:37:14 +02:00
|
|
|
endif
|
2015-07-11 03:06:51 +02:00
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LINKER := $(my_linker)
|
2014-01-16 01:02:16 +01:00
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CXX := $(my_cxx)
|
2014-08-05 23:44:41 +02:00
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CLANG := $(my_clang)
|
2009-03-04 04:28:42 +01:00
|
|
|
|
|
|
|
# TODO: support a mix of standard extensions so that this isn't necessary
|
|
|
|
LOCAL_CPP_EXTENSION := $(strip $(LOCAL_CPP_EXTENSION))
|
|
|
|
ifeq ($(LOCAL_CPP_EXTENSION),)
|
|
|
|
LOCAL_CPP_EXTENSION := .cpp
|
|
|
|
endif
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CPP_EXTENSION := $(LOCAL_CPP_EXTENSION)
|
|
|
|
|
|
|
|
# Certain modules like libdl have to have symbols resolved at runtime and blow
|
|
|
|
# up if --no-undefined is passed to the linker.
|
|
|
|
ifeq ($(strip $(LOCAL_NO_DEFAULT_COMPILER_FLAGS)),)
|
2014-11-15 02:15:00 +01:00
|
|
|
ifeq ($(my_allow_undefined_symbols),)
|
2014-01-16 01:02:16 +01:00
|
|
|
my_ldflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)NO_UNDEFINED_LDFLAGS)
|
2009-03-04 04:28:42 +01:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2011-04-25 23:22:41 +02:00
|
|
|
ifeq (true,$(LOCAL_GROUP_STATIC_LIBRARIES))
|
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_GROUP_STATIC_LIBRARIES := true
|
|
|
|
else
|
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_GROUP_STATIC_LIBRARIES :=
|
|
|
|
endif
|
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
###########################################################
|
|
|
|
## Define arm-vs-thumb-mode flags.
|
|
|
|
###########################################################
|
|
|
|
LOCAL_ARM_MODE := $(strip $(LOCAL_ARM_MODE))
|
2015-04-07 20:59:34 +02:00
|
|
|
ifeq ($($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH),arm)
|
2009-03-04 04:28:42 +01:00
|
|
|
arm_objects_mode := $(if $(LOCAL_ARM_MODE),$(LOCAL_ARM_MODE),arm)
|
|
|
|
normal_objects_mode := $(if $(LOCAL_ARM_MODE),$(LOCAL_ARM_MODE),thumb)
|
|
|
|
|
2009-04-24 03:44:55 +02:00
|
|
|
# Read the values from something like TARGET_arm_CFLAGS or
|
|
|
|
# TARGET_thumb_CFLAGS. HOST_(arm|thumb)_CFLAGS values aren't
|
|
|
|
# actually used (although they are usually empty).
|
2014-01-16 01:02:16 +01:00
|
|
|
arm_objects_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)$(arm_objects_mode)_CFLAGS)
|
|
|
|
normal_objects_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)$(normal_objects_mode)_CFLAGS)
|
2014-08-18 20:14:38 +02:00
|
|
|
ifeq ($(my_clang),true)
|
2014-02-07 03:08:44 +01:00
|
|
|
arm_objects_cflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(arm_objects_cflags))
|
|
|
|
normal_objects_cflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(normal_objects_cflags))
|
2012-04-05 09:44:37 +02:00
|
|
|
endif
|
|
|
|
|
2010-07-09 04:07:52 +02:00
|
|
|
else
|
|
|
|
arm_objects_mode :=
|
|
|
|
normal_objects_mode :=
|
|
|
|
arm_objects_cflags :=
|
|
|
|
normal_objects_cflags :=
|
|
|
|
endif
|
2009-03-04 04:28:42 +01:00
|
|
|
|
|
|
|
###########################################################
|
|
|
|
## Define per-module debugging flags. Users can turn on
|
|
|
|
## debugging for a particular module by setting DEBUG_MODULE_ModuleName
|
|
|
|
## to a non-empty value in their environment or buildspec.mk,
|
|
|
|
## and setting HOST_/TARGET_CUSTOM_DEBUG_CFLAGS to the
|
|
|
|
## debug flags that they want to use.
|
|
|
|
###########################################################
|
|
|
|
ifdef DEBUG_MODULE_$(strip $(LOCAL_MODULE))
|
|
|
|
debug_cflags := $($(my_prefix)CUSTOM_DEBUG_CFLAGS)
|
|
|
|
else
|
|
|
|
debug_cflags :=
|
|
|
|
endif
|
|
|
|
|
2012-10-30 00:06:00 +01:00
|
|
|
####################################################
|
|
|
|
## Compile RenderScript with reflected C++
|
|
|
|
####################################################
|
|
|
|
|
2014-01-24 00:09:04 +01:00
|
|
|
renderscript_sources := $(filter %.rs %.fs,$(my_src_files))
|
2012-10-30 00:06:00 +01:00
|
|
|
|
|
|
|
ifneq (,$(renderscript_sources))
|
|
|
|
|
|
|
|
renderscript_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(renderscript_sources))
|
|
|
|
RenderScript_file_stamp := $(intermediates)/RenderScriptCPP.stamp
|
|
|
|
renderscript_intermediate := $(intermediates)/renderscript
|
|
|
|
|
2015-08-14 02:04:10 +02:00
|
|
|
renderscript_target_api :=
|
|
|
|
|
|
|
|
ifneq (,$(LOCAL_RENDERSCRIPT_TARGET_API))
|
|
|
|
renderscript_target_api := $(LOCAL_RENDERSCRIPT_TARGET_API)
|
|
|
|
else
|
|
|
|
ifneq (,$(LOCAL_SDK_VERSION))
|
|
|
|
# Set target-api for LOCAL_SDK_VERSIONs other than current.
|
|
|
|
ifneq (,$(filter-out current system_current, $(LOCAL_SDK_VERSION)))
|
|
|
|
renderscript_target_api := $(LOCAL_SDK_VERSION)
|
|
|
|
endif
|
|
|
|
endif # LOCAL_SDK_VERSION is set
|
|
|
|
endif # LOCAL_RENDERSCRIPT_TARGET_API is set
|
|
|
|
|
|
|
|
|
2012-10-30 00:06:00 +01:00
|
|
|
ifeq ($(LOCAL_RENDERSCRIPT_CC),)
|
|
|
|
LOCAL_RENDERSCRIPT_CC := $(LLVM_RS_CC)
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Turn on all warnings and warnings as errors for RS compiles.
|
|
|
|
# This can be disabled with LOCAL_RENDERSCRIPT_FLAGS := -Wno-error
|
|
|
|
renderscript_flags := -Wall -Werror
|
|
|
|
renderscript_flags += $(LOCAL_RENDERSCRIPT_FLAGS)
|
2014-09-11 01:11:41 +02:00
|
|
|
# -m32 or -m64
|
|
|
|
renderscript_flags += -m$(my_32_64_bit_suffix)
|
2014-09-11 00:11:01 +02:00
|
|
|
|
2014-01-16 01:02:16 +01:00
|
|
|
renderscript_includes := \
|
2012-10-30 00:06:00 +01:00
|
|
|
$(TOPDIR)external/clang/lib/Headers \
|
|
|
|
$(TOPDIR)frameworks/rs/scriptc \
|
|
|
|
$(LOCAL_RENDERSCRIPT_INCLUDES)
|
|
|
|
|
|
|
|
ifneq ($(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE),)
|
2014-01-16 01:02:16 +01:00
|
|
|
renderscript_includes := $(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE)
|
2012-10-30 00:06:00 +01:00
|
|
|
endif
|
|
|
|
|
2015-04-04 01:15:28 +02:00
|
|
|
bc_dep_files := $(addprefix $(renderscript_intermediate)/, \
|
|
|
|
$(patsubst %.fs,%.d, $(patsubst %.rs,%.d, $(notdir $(renderscript_sources)))))
|
|
|
|
|
2014-01-16 01:02:16 +01:00
|
|
|
$(RenderScript_file_stamp): PRIVATE_RS_INCLUDES := $(renderscript_includes)
|
2012-10-30 00:06:00 +01:00
|
|
|
$(RenderScript_file_stamp): PRIVATE_RS_CC := $(LOCAL_RENDERSCRIPT_CC)
|
|
|
|
$(RenderScript_file_stamp): PRIVATE_RS_FLAGS := $(renderscript_flags)
|
|
|
|
$(RenderScript_file_stamp): PRIVATE_RS_SOURCE_FILES := $(renderscript_sources_fullpath)
|
|
|
|
$(RenderScript_file_stamp): PRIVATE_RS_OUTPUT_DIR := $(renderscript_intermediate)
|
2015-08-14 02:04:10 +02:00
|
|
|
$(RenderScript_file_stamp): PRIVATE_RS_TARGET_API := $(renderscript_target_api)
|
2015-04-04 01:15:28 +02:00
|
|
|
$(RenderScript_file_stamp): PRIVATE_DEP_FILES := $(bc_dep_files)
|
2012-10-30 00:06:00 +01:00
|
|
|
$(RenderScript_file_stamp): $(renderscript_sources_fullpath) $(LOCAL_RENDERSCRIPT_CC)
|
|
|
|
$(transform-renderscripts-to-cpp-and-bc)
|
|
|
|
|
2015-04-04 01:15:28 +02:00
|
|
|
# include the dependency files (.d/.P) generated by llvm-rs-cc.
|
|
|
|
-include $(bc_dep_files:%.d=%.P)
|
2012-10-30 00:06:00 +01:00
|
|
|
|
|
|
|
LOCAL_INTERMEDIATE_TARGETS += $(RenderScript_file_stamp)
|
|
|
|
|
|
|
|
rs_generated_cpps := $(addprefix \
|
|
|
|
$(renderscript_intermediate)/ScriptC_,$(patsubst %.fs,%.cpp, $(patsubst %.rs,%.cpp, \
|
|
|
|
$(notdir $(renderscript_sources)))))
|
|
|
|
|
2014-06-06 21:51:47 +02:00
|
|
|
# This is just a dummy rule to make sure gmake doesn't skip updating the dependents.
|
2012-10-30 00:06:00 +01:00
|
|
|
$(rs_generated_cpps) : $(RenderScript_file_stamp)
|
2014-05-29 01:17:09 +02:00
|
|
|
@echo "Updated RS generated cpp file $@."
|
2012-10-30 00:06:00 +01:00
|
|
|
|
2014-01-16 01:02:16 +01:00
|
|
|
my_c_includes += $(renderscript_intermediate)
|
|
|
|
my_generated_sources += $(rs_generated_cpps)
|
2012-10-30 00:06:00 +01:00
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
###########################################################
|
|
|
|
## Stuff source generated from one-off tools
|
|
|
|
###########################################################
|
2014-01-16 01:02:16 +01:00
|
|
|
$(my_generated_sources): PRIVATE_MODULE := $(my_register_name)
|
2009-03-04 04:28:42 +01:00
|
|
|
|
2014-01-25 08:17:21 +01:00
|
|
|
my_gen_sources_copy := $(patsubst $(generated_sources_dir)/%,$(intermediates)/%,$(filter $(generated_sources_dir)/%,$(my_generated_sources)))
|
|
|
|
|
|
|
|
$(my_gen_sources_copy): $(intermediates)/% : $(generated_sources_dir)/% | $(ACP)
|
|
|
|
@echo "Copy: $@"
|
|
|
|
$(copy-file-to-target)
|
2009-03-04 04:28:42 +01:00
|
|
|
|
2014-01-25 08:17:21 +01:00
|
|
|
my_generated_sources := $(patsubst $(generated_sources_dir)/%,$(intermediates)/%,$(my_generated_sources))
|
|
|
|
|
|
|
|
ALL_GENERATED_SOURCES += $(my_generated_sources)
|
2009-03-04 04:28:42 +01:00
|
|
|
|
2010-11-03 02:43:16 +01:00
|
|
|
###########################################################
|
2015-04-07 20:59:34 +02:00
|
|
|
## Compile the .proto files to .cc (or .c) and then to .o
|
2010-11-03 02:43:16 +01:00
|
|
|
###########################################################
|
2014-01-24 00:09:04 +01:00
|
|
|
proto_sources := $(filter %.proto,$(my_src_files))
|
2010-11-03 02:43:16 +01:00
|
|
|
proto_generated_objects :=
|
|
|
|
proto_generated_headers :=
|
|
|
|
ifneq ($(proto_sources),)
|
2015-04-07 20:59:34 +02:00
|
|
|
proto_generated_sources_dir := $(generated_sources_dir)/proto
|
2014-02-25 20:18:40 +01:00
|
|
|
proto_generated_obj_dir := $(intermediates)/proto
|
2015-04-07 20:59:34 +02:00
|
|
|
|
|
|
|
ifneq (,$(filter nanopb-c nanopb-c-enable_malloc, $(LOCAL_PROTOC_OPTIMIZE_TYPE)))
|
|
|
|
my_proto_source_suffix := .c
|
|
|
|
my_proto_c_includes := external/nanopb-c
|
|
|
|
my_protoc_flags := --nanopb_out=$(proto_generated_sources_dir) \
|
|
|
|
--plugin=external/nanopb-c/generator/protoc-gen-nanopb
|
|
|
|
else
|
|
|
|
my_proto_source_suffix := .cc
|
|
|
|
my_proto_c_includes := external/protobuf/src
|
|
|
|
my_cflags += -DGOOGLE_PROTOBUF_NO_RTTI
|
|
|
|
my_protoc_flags := --cpp_out=$(proto_generated_sources_dir)
|
|
|
|
endif
|
|
|
|
my_proto_c_includes += $(proto_generated_sources_dir)
|
|
|
|
|
|
|
|
proto_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(proto_sources))
|
|
|
|
proto_generated_sources := $(addprefix $(proto_generated_sources_dir)/, \
|
|
|
|
$(patsubst %.proto,%.pb$(my_proto_source_suffix),$(proto_sources_fullpath)))
|
|
|
|
proto_generated_headers := $(patsubst %.pb$(my_proto_source_suffix),%.pb.h, $(proto_generated_sources))
|
2014-02-25 20:18:40 +01:00
|
|
|
proto_generated_objects := $(addprefix $(proto_generated_obj_dir)/, \
|
|
|
|
$(patsubst %.proto,%.pb.o,$(proto_sources_fullpath)))
|
2010-11-03 02:43:16 +01:00
|
|
|
|
2014-02-25 20:18:40 +01:00
|
|
|
# Ensure the transform-proto-to-cc rule is only defined once in multilib build.
|
|
|
|
ifndef $(my_prefix)_$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_proto_defined
|
2015-04-07 20:59:34 +02:00
|
|
|
$(proto_generated_sources): PRIVATE_PROTO_INCLUDES := $(TOP)
|
|
|
|
$(proto_generated_sources): PRIVATE_PROTOC_FLAGS := $(LOCAL_PROTOC_FLAGS) $(my_protoc_flags)
|
|
|
|
$(proto_generated_sources): $(proto_generated_sources_dir)/%.pb$(my_proto_source_suffix): %.proto $(PROTOC)
|
2010-11-03 02:43:16 +01:00
|
|
|
$(transform-proto-to-cc)
|
|
|
|
|
2014-06-06 21:51:47 +02:00
|
|
|
# This is just a dummy rule to make sure gmake doesn't skip updating the dependents.
|
2015-04-07 20:59:34 +02:00
|
|
|
$(proto_generated_headers): $(proto_generated_sources_dir)/%.pb.h: $(proto_generated_sources_dir)/%.pb$(my_proto_source_suffix)
|
2014-05-29 01:17:09 +02:00
|
|
|
@echo "Updated header file $@."
|
2010-11-03 02:43:16 +01:00
|
|
|
|
2014-02-25 20:18:40 +01:00
|
|
|
$(my_prefix)_$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_proto_defined := true
|
|
|
|
endif # transform-proto-to-cc rule included only once
|
|
|
|
|
2012-06-13 20:38:10 +02:00
|
|
|
$(proto_generated_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
|
|
|
|
$(proto_generated_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
|
2015-04-07 20:59:34 +02:00
|
|
|
$(proto_generated_objects): $(proto_generated_obj_dir)/%.o: $(proto_generated_sources_dir)/%$(my_proto_source_suffix) $(proto_generated_headers)
|
|
|
|
ifeq ($(my_proto_source_suffix),.c)
|
|
|
|
$(transform-$(PRIVATE_HOST)c-to-o)
|
|
|
|
else
|
2010-11-03 02:43:16 +01:00
|
|
|
$(transform-$(PRIVATE_HOST)cpp-to-o)
|
2015-04-07 20:59:34 +02:00
|
|
|
endif
|
2010-11-03 02:43:16 +01:00
|
|
|
-include $(proto_generated_objects:%.o=%.P)
|
|
|
|
|
2015-04-07 20:59:34 +02:00
|
|
|
my_c_includes += $(my_proto_c_includes)
|
|
|
|
# Auto-export the generated proto source dir.
|
|
|
|
my_export_c_include_dirs += $(my_proto_c_includes)
|
|
|
|
|
|
|
|
ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nanopb-c-enable_malloc)
|
2015-04-08 18:54:34 +02:00
|
|
|
my_static_libraries += libprotobuf-c-nano-enable_malloc
|
2015-04-07 20:59:34 +02:00
|
|
|
else ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nanopb-c)
|
2015-04-08 18:54:34 +02:00
|
|
|
my_static_libraries += libprotobuf-c-nano
|
2015-04-07 20:59:34 +02:00
|
|
|
else ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),full)
|
2014-11-11 19:42:17 +01:00
|
|
|
ifdef LOCAL_SDK_VERSION
|
2015-09-08 19:47:03 +02:00
|
|
|
my_static_libraries += libprotobuf-cpp-full-ndk
|
2014-11-11 19:42:17 +01:00
|
|
|
else
|
|
|
|
my_shared_libraries += libprotobuf-cpp-full
|
|
|
|
endif
|
2010-11-03 02:43:16 +01:00
|
|
|
else
|
2014-11-11 19:42:17 +01:00
|
|
|
ifdef LOCAL_SDK_VERSION
|
2015-09-08 19:47:03 +02:00
|
|
|
my_static_libraries += libprotobuf-cpp-lite-ndk
|
2014-11-11 19:42:17 +01:00
|
|
|
else
|
|
|
|
my_shared_libraries += libprotobuf-cpp-lite
|
|
|
|
endif
|
2010-11-03 02:43:16 +01:00
|
|
|
endif
|
2014-02-25 20:18:40 +01:00
|
|
|
endif # $(proto_sources) non-empty
|
2010-11-03 02:43:16 +01:00
|
|
|
|
2015-07-30 02:14:24 +02:00
|
|
|
###########################################################
|
2015-08-20 18:08:17 +02:00
|
|
|
## Compile the .dbus-xml files to c++ headers
|
2015-07-30 02:14:24 +02:00
|
|
|
###########################################################
|
2015-08-20 18:08:17 +02:00
|
|
|
dbus_definitions := $(filter %.dbus-xml,$(my_src_files))
|
2015-08-14 23:55:32 +02:00
|
|
|
dbus_generated_headers :=
|
|
|
|
ifneq ($(dbus_definitions),)
|
2015-07-30 02:14:24 +02:00
|
|
|
|
2015-08-14 23:55:32 +02:00
|
|
|
dbus_definition_paths := $(addprefix $(LOCAL_PATH)/,$(dbus_definitions))
|
2015-07-30 02:14:24 +02:00
|
|
|
dbus_service_config := $(filter %dbus-service-config.json,$(my_src_files))
|
2015-08-14 23:55:32 +02:00
|
|
|
dbus_service_config_path := $(addprefix $(LOCAL_PATH)/,$(dbus_service_config))
|
2015-07-30 02:14:24 +02:00
|
|
|
|
2015-08-14 23:55:32 +02:00
|
|
|
dbus_gen_dir := $(generated_sources_dir)/dbus_bindings
|
2015-07-30 02:14:24 +02:00
|
|
|
|
2015-08-14 23:55:32 +02:00
|
|
|
ifdef LOCAL_DBUS_PROXY_PREFIX
|
|
|
|
dbus_header_dir := $(dbus_gen_dir)/include/$(LOCAL_DBUS_PROXY_PREFIX)
|
|
|
|
dbus_headers := dbus-proxies.h
|
|
|
|
else
|
|
|
|
dbus_header_dir := $(dbus_gen_dir)
|
2015-08-20 18:08:17 +02:00
|
|
|
dbus_headers := $(patsubst %.dbus-xml,%.h,$(dbus_definitions))
|
2015-08-14 23:55:32 +02:00
|
|
|
endif
|
|
|
|
dbus_generated_headers := $(addprefix $(dbus_header_dir)/,$(dbus_headers))
|
2015-07-30 02:14:24 +02:00
|
|
|
|
|
|
|
# Ensure that we only define build rules once in multilib builds.
|
|
|
|
ifndef $(my_prefix)_$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_dbus_bindings_defined
|
|
|
|
$(my_prefix)_$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_dbus_bindings_defined := true
|
2015-08-14 23:55:32 +02:00
|
|
|
|
|
|
|
$(dbus_generated_headers): PRIVATE_MODULE := $(LOCAL_MODULE)
|
|
|
|
$(dbus_generated_headers): PRIVATE_DBUS_SERVICE_CONFIG := $(dbus_service_config_path)
|
|
|
|
$(dbus_generated_headers) : $(dbus_service_config_path) $(DBUS_GENERATOR)
|
|
|
|
ifdef LOCAL_DBUS_PROXY_PREFIX
|
|
|
|
$(dbus_generated_headers) : $(dbus_definition_paths)
|
|
|
|
$(generate-dbus-proxies)
|
|
|
|
|
|
|
|
# Auto-export the generated dbus proxy directory.
|
|
|
|
my_export_c_include_dirs += $(dbus_gen_dir)/include
|
|
|
|
my_c_includes += $(dbus_gen_dir)/include
|
|
|
|
else
|
2015-08-20 18:08:17 +02:00
|
|
|
$(dbus_generated_headers) : $(dbus_header_dir)/%.h : $(LOCAL_PATH)/%.dbus-xml
|
2015-08-14 23:55:32 +02:00
|
|
|
$(generate-dbus-adaptors)
|
|
|
|
|
|
|
|
my_export_c_include_dirs += $(dbus_header_dir)
|
|
|
|
my_c_includes += $(dbus_header_dir)
|
|
|
|
endif # $(LOCAL_DBUS_PROXY_PREFIX)
|
2015-07-30 02:14:24 +02:00
|
|
|
endif # $(my_prefix)_$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_dbus_bindings_defined
|
|
|
|
|
2015-08-14 23:55:32 +02:00
|
|
|
my_generated_sources += $(dbus_generated_headers)
|
|
|
|
|
|
|
|
endif # $(dbus_definitions) non-empty
|
2015-07-30 02:14:24 +02:00
|
|
|
|
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
###########################################################
|
2014-03-03 16:57:06 +01:00
|
|
|
## YACC: Compile .y and .yy files to .cpp and the to .o.
|
2009-03-04 04:28:42 +01:00
|
|
|
###########################################################
|
|
|
|
|
2014-03-03 16:57:06 +01:00
|
|
|
y_yacc_sources := $(filter %.y,$(my_src_files))
|
|
|
|
y_yacc_cpps := $(addprefix \
|
|
|
|
$(intermediates)/,$(y_yacc_sources:.y=$(LOCAL_CPP_EXTENSION)))
|
|
|
|
|
|
|
|
yy_yacc_sources := $(filter %.yy,$(my_src_files))
|
|
|
|
yy_yacc_cpps := $(addprefix \
|
|
|
|
$(intermediates)/,$(yy_yacc_sources:.yy=$(LOCAL_CPP_EXTENSION)))
|
|
|
|
|
|
|
|
yacc_cpps := $(y_yacc_cpps) $(yy_yacc_cpps)
|
2009-03-04 04:28:42 +01:00
|
|
|
yacc_headers := $(yacc_cpps:$(LOCAL_CPP_EXTENSION)=.h)
|
|
|
|
yacc_objects := $(yacc_cpps:$(LOCAL_CPP_EXTENSION)=.o)
|
|
|
|
|
2014-03-03 16:57:06 +01:00
|
|
|
ifneq ($(strip $(y_yacc_cpps)),)
|
|
|
|
$(y_yacc_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
|
2012-03-22 19:26:22 +01:00
|
|
|
$(TOPDIR)$(LOCAL_PATH)/%.y \
|
2014-11-09 07:20:03 +01:00
|
|
|
$(lex_cpps) $(my_additional_dependencies)
|
2009-03-04 04:28:42 +01:00
|
|
|
$(call transform-y-to-cpp,$(PRIVATE_CPP_EXTENSION))
|
|
|
|
$(yacc_headers): $(intermediates)/%.h: $(intermediates)/%$(LOCAL_CPP_EXTENSION)
|
2014-03-03 16:57:06 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(strip $(yy_yacc_cpps)),)
|
|
|
|
$(yy_yacc_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
|
|
|
|
$(TOPDIR)$(LOCAL_PATH)/%.yy \
|
2014-11-09 07:20:03 +01:00
|
|
|
$(lex_cpps) $(my_additional_dependencies)
|
2014-03-03 16:57:06 +01:00
|
|
|
$(call transform-y-to-cpp,$(PRIVATE_CPP_EXTENSION))
|
|
|
|
$(yacc_headers): $(intermediates)/%.h: $(intermediates)/%$(LOCAL_CPP_EXTENSION)
|
|
|
|
endif
|
2009-03-04 04:28:42 +01:00
|
|
|
|
2014-03-03 16:57:06 +01:00
|
|
|
ifneq ($(strip $(yacc_cpps)),)
|
2009-03-04 04:28:42 +01:00
|
|
|
$(yacc_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
|
|
|
|
$(yacc_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
|
|
|
|
$(yacc_objects): $(intermediates)/%.o: $(intermediates)/%$(LOCAL_CPP_EXTENSION)
|
|
|
|
$(transform-$(PRIVATE_HOST)cpp-to-o)
|
|
|
|
endif
|
|
|
|
|
|
|
|
###########################################################
|
2014-03-03 16:57:06 +01:00
|
|
|
## LEX: Compile .l and .ll files to .cpp and then to .o.
|
2009-03-04 04:28:42 +01:00
|
|
|
###########################################################
|
|
|
|
|
2014-03-03 16:57:06 +01:00
|
|
|
l_lex_sources := $(filter %.l,$(my_src_files))
|
|
|
|
l_lex_cpps := $(addprefix \
|
|
|
|
$(intermediates)/,$(l_lex_sources:.l=$(LOCAL_CPP_EXTENSION)))
|
|
|
|
|
|
|
|
ll_lex_sources := $(filter %.ll,$(my_src_files))
|
|
|
|
ll_lex_cpps := $(addprefix \
|
|
|
|
$(intermediates)/,$(ll_lex_sources:.ll=$(LOCAL_CPP_EXTENSION)))
|
|
|
|
|
|
|
|
lex_cpps := $(l_lex_cpps) $(ll_lex_cpps)
|
2009-03-04 04:28:42 +01:00
|
|
|
lex_objects := $(lex_cpps:$(LOCAL_CPP_EXTENSION)=.o)
|
|
|
|
|
2014-03-03 16:57:06 +01:00
|
|
|
ifneq ($(strip $(l_lex_cpps)),)
|
|
|
|
$(l_lex_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
|
2012-03-22 19:26:22 +01:00
|
|
|
$(TOPDIR)$(LOCAL_PATH)/%.l
|
2009-03-04 04:28:42 +01:00
|
|
|
$(transform-l-to-cpp)
|
2014-03-03 16:57:06 +01:00
|
|
|
endif
|
2009-03-04 04:28:42 +01:00
|
|
|
|
2014-03-03 16:57:06 +01:00
|
|
|
ifneq ($(strip $(ll_lex_cpps)),)
|
|
|
|
$(ll_lex_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
|
|
|
|
$(TOPDIR)$(LOCAL_PATH)/%.ll
|
|
|
|
$(transform-l-to-cpp)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(strip $(lex_cpps)),)
|
2009-03-04 04:28:42 +01:00
|
|
|
$(lex_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
|
|
|
|
$(lex_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
|
|
|
|
$(lex_objects): $(intermediates)/%.o: \
|
2012-03-22 19:26:22 +01:00
|
|
|
$(intermediates)/%$(LOCAL_CPP_EXTENSION) \
|
2014-11-09 07:20:03 +01:00
|
|
|
$(my_additional_dependencies) \
|
2012-03-22 19:26:22 +01:00
|
|
|
$(yacc_headers)
|
2009-03-04 04:28:42 +01:00
|
|
|
$(transform-$(PRIVATE_HOST)cpp-to-o)
|
|
|
|
endif
|
|
|
|
|
|
|
|
###########################################################
|
|
|
|
## C++: Compile .cpp files to .o.
|
|
|
|
###########################################################
|
|
|
|
|
2011-07-12 07:11:46 +02:00
|
|
|
# we also do this on host modules, even though
|
2009-03-04 04:28:42 +01:00
|
|
|
# it's not really arm, because there are files that are shared.
|
2015-03-11 02:03:11 +01:00
|
|
|
cpp_arm_sources := $(patsubst %$(LOCAL_CPP_EXTENSION).arm,%$(LOCAL_CPP_EXTENSION),$(filter %$(LOCAL_CPP_EXTENSION).arm,$(my_src_files)))
|
|
|
|
dotdot_arm_sources := $(filter ../%,$(cpp_arm_sources))
|
|
|
|
cpp_arm_sources := $(filter-out ../%,$(cpp_arm_sources))
|
|
|
|
cpp_arm_objects := $(addprefix $(intermediates)/,$(cpp_arm_sources:$(LOCAL_CPP_EXTENSION)=.o))
|
|
|
|
|
|
|
|
# For source files starting with ../, we remove all the ../ in the object file path,
|
|
|
|
# to avoid object file escaping the intermediate directory.
|
|
|
|
dotdot_arm_objects :=
|
|
|
|
$(foreach s,$(dotdot_arm_sources),\
|
|
|
|
$(eval $(call compile-dotdot-cpp-file,$(s),\
|
|
|
|
$(yacc_cpps) $(proto_generated_headers) $(my_additional_dependencies),\
|
|
|
|
dotdot_arm_objects)))
|
|
|
|
|
|
|
|
dotdot_sources := $(filter ../%$(LOCAL_CPP_EXTENSION),$(my_src_files))
|
|
|
|
dotdot_objects :=
|
|
|
|
$(foreach s,$(dotdot_sources),\
|
|
|
|
$(eval $(call compile-dotdot-cpp-file,$(s),\
|
|
|
|
$(yacc_cpps) $(proto_generated_headers) $(my_additional_dependencies),\
|
|
|
|
dotdot_objects)))
|
|
|
|
|
|
|
|
cpp_normal_sources := $(filter-out ../%,$(filter %$(LOCAL_CPP_EXTENSION),$(my_src_files)))
|
2009-03-04 04:28:42 +01:00
|
|
|
cpp_normal_objects := $(addprefix $(intermediates)/,$(cpp_normal_sources:$(LOCAL_CPP_EXTENSION)=.o))
|
|
|
|
|
2015-03-11 02:03:11 +01:00
|
|
|
$(dotdot_arm_objects) $(cpp_arm_objects): PRIVATE_ARM_MODE := $(arm_objects_mode)
|
|
|
|
$(dotdot_arm_objects) $(cpp_arm_objects): PRIVATE_ARM_CFLAGS := $(arm_objects_cflags)
|
|
|
|
$(dotdot_objects) $(cpp_normal_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
|
|
|
|
$(dotdot_objects) $(cpp_normal_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
|
2009-03-04 04:28:42 +01:00
|
|
|
|
|
|
|
cpp_objects := $(cpp_arm_objects) $(cpp_normal_objects)
|
|
|
|
|
|
|
|
ifneq ($(strip $(cpp_objects)),)
|
|
|
|
$(cpp_objects): $(intermediates)/%.o: \
|
2012-03-22 19:26:22 +01:00
|
|
|
$(TOPDIR)$(LOCAL_PATH)/%$(LOCAL_CPP_EXTENSION) \
|
2013-02-20 22:34:05 +01:00
|
|
|
$(yacc_cpps) $(proto_generated_headers) \
|
2014-11-09 07:20:03 +01:00
|
|
|
$(my_additional_dependencies)
|
2009-03-04 04:28:42 +01:00
|
|
|
$(transform-$(PRIVATE_HOST)cpp-to-o)
|
|
|
|
-include $(cpp_objects:%.o=%.P)
|
|
|
|
endif
|
|
|
|
|
2015-03-11 02:03:11 +01:00
|
|
|
cpp_objects += $(dotdot_arm_objects) $(dotdot_objects)
|
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
###########################################################
|
|
|
|
## C++: Compile generated .cpp files to .o.
|
|
|
|
###########################################################
|
|
|
|
|
2014-01-17 01:21:03 +01:00
|
|
|
gen_cpp_sources := $(filter %$(LOCAL_CPP_EXTENSION),$(my_generated_sources))
|
2009-03-04 04:28:42 +01:00
|
|
|
gen_cpp_objects := $(gen_cpp_sources:%$(LOCAL_CPP_EXTENSION)=%.o)
|
|
|
|
|
|
|
|
ifneq ($(strip $(gen_cpp_objects)),)
|
|
|
|
# Compile all generated files as thumb.
|
|
|
|
# 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)
|
2012-03-20 15:00:16 +01:00
|
|
|
$(gen_cpp_objects): $(intermediates)/%.o: \
|
|
|
|
$(intermediates)/%$(LOCAL_CPP_EXTENSION) $(yacc_cpps) \
|
2013-02-20 22:34:05 +01:00
|
|
|
$(proto_generated_headers) \
|
2014-11-09 07:20:03 +01:00
|
|
|
$(my_additional_dependencies)
|
2009-03-04 04:28:42 +01:00
|
|
|
$(transform-$(PRIVATE_HOST)cpp-to-o)
|
|
|
|
-include $(gen_cpp_objects:%.o=%.P)
|
|
|
|
endif
|
|
|
|
|
|
|
|
###########################################################
|
|
|
|
## S: Compile generated .S and .s files to .o.
|
|
|
|
###########################################################
|
|
|
|
|
2014-01-17 01:21:03 +01:00
|
|
|
gen_S_sources := $(filter %.S,$(my_generated_sources))
|
2009-03-04 04:28:42 +01:00
|
|
|
gen_S_objects := $(gen_S_sources:%.S=%.o)
|
|
|
|
|
|
|
|
ifneq ($(strip $(gen_S_sources)),)
|
2012-03-20 15:00:16 +01:00
|
|
|
$(gen_S_objects): $(intermediates)/%.o: $(intermediates)/%.S \
|
2014-11-09 07:20:03 +01:00
|
|
|
$(my_additional_dependencies)
|
2009-03-04 04:28:42 +01:00
|
|
|
$(transform-$(PRIVATE_HOST)s-to-o)
|
|
|
|
-include $(gen_S_objects:%.o=%.P)
|
|
|
|
endif
|
|
|
|
|
2014-01-17 01:21:03 +01:00
|
|
|
gen_s_sources := $(filter %.s,$(my_generated_sources))
|
2009-03-04 04:28:42 +01:00
|
|
|
gen_s_objects := $(gen_s_sources:%.s=%.o)
|
|
|
|
|
|
|
|
ifneq ($(strip $(gen_s_objects)),)
|
2012-03-20 15:00:16 +01:00
|
|
|
$(gen_s_objects): $(intermediates)/%.o: $(intermediates)/%.s \
|
2014-11-09 07:20:03 +01:00
|
|
|
$(my_additional_dependencies)
|
2009-03-04 04:28:42 +01:00
|
|
|
$(transform-$(PRIVATE_HOST)s-to-o-no-deps)
|
|
|
|
-include $(gen_s_objects:%.o=%.P)
|
|
|
|
endif
|
|
|
|
|
|
|
|
gen_asm_objects := $(gen_S_objects) $(gen_s_objects)
|
|
|
|
|
2013-02-21 15:01:35 +01:00
|
|
|
###########################################################
|
|
|
|
## o: Include generated .o files in output.
|
|
|
|
###########################################################
|
|
|
|
|
2014-01-17 01:21:03 +01:00
|
|
|
gen_o_objects := $(filter %.o,$(my_generated_sources))
|
2013-02-21 15:01:35 +01:00
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
###########################################################
|
|
|
|
## C: Compile .c files to .o.
|
|
|
|
###########################################################
|
|
|
|
|
2015-03-11 02:03:11 +01:00
|
|
|
c_arm_sources := $(patsubst %.c.arm,%.c,$(filter %.c.arm,$(my_src_files)))
|
|
|
|
dotdot_arm_sources := $(filter ../%,$(c_arm_sources))
|
|
|
|
c_arm_sources := $(filter-out ../%,$(c_arm_sources))
|
|
|
|
c_arm_objects := $(addprefix $(intermediates)/,$(c_arm_sources:.c=.o))
|
|
|
|
|
|
|
|
# For source files starting with ../, we remove all the ../ in the object file path,
|
|
|
|
# to avoid object file escaping the intermediate directory.
|
|
|
|
dotdot_arm_objects :=
|
|
|
|
$(foreach s,$(dotdot_arm_sources),\
|
|
|
|
$(eval $(call compile-dotdot-c-file,$(s),\
|
|
|
|
$(yacc_cpps) $(proto_generated_headers) $(my_additional_dependencies),\
|
|
|
|
dotdot_arm_objects)))
|
|
|
|
|
|
|
|
dotdot_sources := $(filter ../%.c, $(my_src_files))
|
|
|
|
dotdot_objects :=
|
|
|
|
$(foreach s, $(dotdot_sources),\
|
|
|
|
$(eval $(call compile-dotdot-c-file,$(s),\
|
|
|
|
$(yacc_cpps) $(proto_generated_headers) $(my_additional_dependencies),\
|
|
|
|
dotdot_objects)))
|
2009-03-04 04:28:42 +01:00
|
|
|
|
2015-03-11 02:03:11 +01:00
|
|
|
c_normal_sources := $(filter-out ../%,$(filter %.c,$(my_src_files)))
|
2009-03-04 04:28:42 +01:00
|
|
|
c_normal_objects := $(addprefix $(intermediates)/,$(c_normal_sources:.c=.o))
|
|
|
|
|
2015-03-11 02:03:11 +01:00
|
|
|
$(dotdot_arm_objects) $(c_arm_objects): PRIVATE_ARM_MODE := $(arm_objects_mode)
|
|
|
|
$(dotdot_arm_objects) $(c_arm_objects): PRIVATE_ARM_CFLAGS := $(arm_objects_cflags)
|
|
|
|
$(dotdot_objects) $(c_normal_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
|
|
|
|
$(dotdot_objects) $(c_normal_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
|
2009-03-04 04:28:42 +01:00
|
|
|
|
|
|
|
c_objects := $(c_arm_objects) $(c_normal_objects)
|
|
|
|
|
|
|
|
ifneq ($(strip $(c_objects)),)
|
2012-03-20 15:00:16 +01:00
|
|
|
$(c_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.c $(yacc_cpps) $(proto_generated_headers) \
|
2014-11-09 07:20:03 +01:00
|
|
|
$(my_additional_dependencies)
|
2009-03-04 04:28:42 +01:00
|
|
|
$(transform-$(PRIVATE_HOST)c-to-o)
|
|
|
|
-include $(c_objects:%.o=%.P)
|
|
|
|
endif
|
|
|
|
|
2015-03-11 02:03:11 +01:00
|
|
|
c_objects += $(dotdot_arm_objects) $(dotdot_objects)
|
|
|
|
|
2009-05-04 23:32:44 +02:00
|
|
|
###########################################################
|
|
|
|
## C: Compile generated .c files to .o.
|
|
|
|
###########################################################
|
|
|
|
|
2014-01-17 01:21:03 +01:00
|
|
|
gen_c_sources := $(filter %.c,$(my_generated_sources))
|
2009-05-04 23:32:44 +02:00
|
|
|
gen_c_objects := $(gen_c_sources:%.c=%.o)
|
|
|
|
|
|
|
|
ifneq ($(strip $(gen_c_objects)),)
|
|
|
|
# Compile all generated files as thumb.
|
|
|
|
# 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)
|
2012-03-20 15:00:16 +01:00
|
|
|
$(gen_c_objects): $(intermediates)/%.o: $(intermediates)/%.c $(yacc_cpps) $(proto_generated_headers) \
|
2014-11-09 07:20:03 +01:00
|
|
|
$(my_additional_dependencies)
|
2009-05-04 23:32:44 +02:00
|
|
|
$(transform-$(PRIVATE_HOST)c-to-o)
|
|
|
|
-include $(gen_c_objects:%.o=%.P)
|
|
|
|
endif
|
|
|
|
|
2009-05-14 16:00:09 +02:00
|
|
|
###########################################################
|
|
|
|
## ObjC: Compile .m files to .o
|
|
|
|
###########################################################
|
|
|
|
|
2014-01-24 00:09:04 +01:00
|
|
|
objc_sources := $(filter %.m,$(my_src_files))
|
2009-05-14 16:00:09 +02:00
|
|
|
objc_objects := $(addprefix $(intermediates)/,$(objc_sources:.m=.o))
|
|
|
|
|
|
|
|
ifneq ($(strip $(objc_objects)),)
|
2012-03-20 15:00:16 +01:00
|
|
|
$(objc_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.m $(yacc_cpps) $(proto_generated_headers) \
|
2014-11-09 07:20:03 +01:00
|
|
|
$(my_additional_dependencies)
|
2009-05-14 16:00:09 +02:00
|
|
|
$(transform-$(PRIVATE_HOST)m-to-o)
|
|
|
|
-include $(objc_objects:%.o=%.P)
|
|
|
|
endif
|
|
|
|
|
2015-09-18 00:40:49 +02:00
|
|
|
###########################################################
|
|
|
|
## ObjC++: Compile .mm files to .o
|
|
|
|
###########################################################
|
|
|
|
|
|
|
|
objcpp_sources := $(filter %.mm,$(my_src_files))
|
|
|
|
objcpp_objects := $(addprefix $(intermediates)/,$(objcpp_sources:.mm=.o))
|
|
|
|
|
|
|
|
ifneq ($(strip $(objcpp_objects)),)
|
|
|
|
$(objcpp_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.mm $(yacc_cpps) $(proto_generated_headers) \
|
|
|
|
$(my_additional_dependencies)
|
|
|
|
$(transform-$(PRIVATE_HOST)mm-to-o)
|
|
|
|
-include $(objcpp_objects:%.o=%.P)
|
|
|
|
endif
|
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
###########################################################
|
|
|
|
## AS: Compile .S files to .o.
|
|
|
|
###########################################################
|
|
|
|
|
2014-01-24 00:09:04 +01:00
|
|
|
asm_sources_S := $(filter %.S,$(my_src_files))
|
2015-03-11 02:03:11 +01:00
|
|
|
dotdot_sources := $(filter ../%,$(asm_sources_S))
|
|
|
|
asm_sources_S := $(filter-out ../%,$(asm_sources_S))
|
2009-03-04 04:28:42 +01:00
|
|
|
asm_objects_S := $(addprefix $(intermediates)/,$(asm_sources_S:.S=.o))
|
|
|
|
|
2015-03-11 02:03:11 +01:00
|
|
|
dotdot_objects_S :=
|
|
|
|
$(foreach s,$(dotdot_sources),\
|
|
|
|
$(eval $(call compile-dotdot-s-file,$(s),\
|
|
|
|
$(my_additional_dependencies),\
|
|
|
|
dotdot_objects_S)))
|
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
ifneq ($(strip $(asm_objects_S)),)
|
2012-03-20 15:00:16 +01:00
|
|
|
$(asm_objects_S): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.S \
|
2014-11-09 07:20:03 +01:00
|
|
|
$(my_additional_dependencies)
|
2009-03-04 04:28:42 +01:00
|
|
|
$(transform-$(PRIVATE_HOST)s-to-o)
|
|
|
|
-include $(asm_objects_S:%.o=%.P)
|
|
|
|
endif
|
|
|
|
|
2014-01-24 00:09:04 +01:00
|
|
|
asm_sources_s := $(filter %.s,$(my_src_files))
|
2015-03-11 02:03:11 +01:00
|
|
|
dotdot_sources := $(filter ../%,$(asm_sources_s))
|
|
|
|
asm_sources_s := $(filter-out ../%,$(asm_sources_s))
|
2009-03-04 04:28:42 +01:00
|
|
|
asm_objects_s := $(addprefix $(intermediates)/,$(asm_sources_s:.s=.o))
|
|
|
|
|
2015-03-11 02:03:11 +01:00
|
|
|
dotdot_objects_s :=
|
|
|
|
$(foreach s,$(dotdot_sources),\
|
|
|
|
$(eval $(call compile-dotdot-s-file-no-deps,$(s),\
|
|
|
|
$(my_additional_dependencies),\
|
|
|
|
dotdot_objects_s)))
|
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
ifneq ($(strip $(asm_objects_s)),)
|
2012-03-20 15:00:16 +01:00
|
|
|
$(asm_objects_s): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.s \
|
2014-11-09 07:20:03 +01:00
|
|
|
$(my_additional_dependencies)
|
2009-03-04 04:28:42 +01:00
|
|
|
$(transform-$(PRIVATE_HOST)s-to-o-no-deps)
|
|
|
|
endif
|
|
|
|
|
2015-03-11 02:03:11 +01:00
|
|
|
asm_objects := $(dotdot_objects_S) $(dotdot_objects_s) $(asm_objects_S) $(asm_objects_s)
|
2009-03-04 04:28:42 +01:00
|
|
|
|
|
|
|
|
2015-03-10 02:57:40 +01:00
|
|
|
# .asm for x86/x86_64 needs to be compiled with yasm.
|
2014-06-06 04:05:47 +02:00
|
|
|
asm_sources_asm := $(filter %.asm,$(my_src_files))
|
|
|
|
ifneq ($(strip $(asm_sources_asm)),)
|
|
|
|
asm_objects_asm := $(addprefix $(intermediates)/,$(asm_sources_asm:.asm=.o))
|
|
|
|
$(asm_objects_asm): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.asm \
|
2014-11-09 07:20:03 +01:00
|
|
|
$(my_additional_dependencies)
|
2014-06-06 04:05:47 +02:00
|
|
|
$(transform-asm-to-o)
|
|
|
|
|
|
|
|
asm_objects += $(asm_objects_asm)
|
|
|
|
endif
|
|
|
|
|
2015-01-09 03:25:30 +01:00
|
|
|
|
|
|
|
##########################################################
|
|
|
|
## Set up installed module dependency
|
|
|
|
## We cannot compute the full path of the LOCAL_SHARED_LIBRARIES for
|
|
|
|
## they may cusomize their install path with LOCAL_MODULE_PATH
|
|
|
|
##########################################################
|
|
|
|
# Get the list of INSTALLED libraries as module names.
|
|
|
|
ifdef LOCAL_SDK_VERSION
|
|
|
|
installed_shared_library_module_names := \
|
|
|
|
$(my_shared_libraries)
|
|
|
|
else
|
|
|
|
installed_shared_library_module_names := \
|
|
|
|
$(my_shared_libraries) $(my_system_shared_libraries)
|
|
|
|
endif
|
|
|
|
|
|
|
|
# The real dependency will be added after all Android.mks are loaded and the install paths
|
|
|
|
# of the shared libraries are determined.
|
|
|
|
ifdef LOCAL_INSTALLED_MODULE
|
|
|
|
ifdef installed_shared_library_module_names
|
|
|
|
$(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)DEPENDENCIES_ON_SHARED_LIBRARIES += \
|
|
|
|
$(my_register_name):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(sort $(installed_shared_library_module_names)))
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
2011-11-08 18:31:21 +01:00
|
|
|
####################################################
|
|
|
|
## Import includes
|
|
|
|
####################################################
|
|
|
|
import_includes := $(intermediates)/import_includes
|
|
|
|
import_includes_deps := $(strip \
|
|
|
|
$(foreach l, $(installed_shared_library_module_names), \
|
2015-08-14 21:59:50 +02:00
|
|
|
$(call intermediates-dir-for,SHARED_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/export_includes) \
|
2014-02-04 23:53:25 +01:00
|
|
|
$(foreach l, $(my_static_libraries) $(my_whole_static_libraries), \
|
2015-08-14 21:59:50 +02:00
|
|
|
$(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/export_includes))
|
2015-01-23 00:44:04 +01:00
|
|
|
$(import_includes): PRIVATE_IMPORT_EXPORT_INCLUDES := $(import_includes_deps)
|
|
|
|
$(import_includes) : $(LOCAL_MODULE_MAKEFILE) $(import_includes_deps)
|
2011-11-08 18:31:21 +01:00
|
|
|
@echo Import includes file: $@
|
|
|
|
$(hide) mkdir -p $(dir $@) && rm -f $@
|
|
|
|
ifdef import_includes_deps
|
2015-01-23 00:44:04 +01:00
|
|
|
$(hide) for f in $(PRIVATE_IMPORT_EXPORT_INCLUDES); do \
|
2011-11-08 18:31:21 +01:00
|
|
|
cat $$f >> $@; \
|
|
|
|
done
|
|
|
|
else
|
|
|
|
$(hide) touch $@
|
|
|
|
endif
|
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
###########################################################
|
|
|
|
## Common object handling.
|
|
|
|
###########################################################
|
|
|
|
|
|
|
|
# some rules depend on asm_objects being first. If your code depends on
|
|
|
|
# being first, it's reasonable to require it to be assembly
|
2013-08-29 16:36:34 +02:00
|
|
|
normal_objects := \
|
2012-03-22 19:26:22 +01:00
|
|
|
$(asm_objects) \
|
|
|
|
$(cpp_objects) \
|
|
|
|
$(gen_cpp_objects) \
|
|
|
|
$(gen_asm_objects) \
|
|
|
|
$(c_objects) \
|
|
|
|
$(gen_c_objects) \
|
|
|
|
$(objc_objects) \
|
2015-09-18 00:40:49 +02:00
|
|
|
$(objcpp_objects) \
|
2012-03-22 19:26:22 +01:00
|
|
|
$(yacc_objects) \
|
|
|
|
$(lex_objects) \
|
|
|
|
$(proto_generated_objects) \
|
2013-08-29 16:36:34 +02:00
|
|
|
$(addprefix $(TOPDIR)$(LOCAL_PATH)/,$(LOCAL_PREBUILT_OBJ_FILES))
|
|
|
|
|
|
|
|
all_objects := $(normal_objects) $(gen_o_objects)
|
2009-03-04 04:28:42 +01:00
|
|
|
|
2014-02-13 22:41:52 +01:00
|
|
|
my_c_includes += $(TOPDIR)$(LOCAL_PATH) $(intermediates) $(generated_sources_dir)
|
2009-03-04 04:28:42 +01:00
|
|
|
|
2012-08-14 19:13:16 +02:00
|
|
|
ifndef LOCAL_SDK_VERSION
|
2014-01-16 01:02:16 +01:00
|
|
|
my_c_includes += $(JNI_H_INCLUDE)
|
2010-07-23 00:51:56 +02:00
|
|
|
endif
|
|
|
|
|
2013-08-29 16:36:34 +02:00
|
|
|
# all_objects includes gen_o_objects which were part of LOCAL_GENERATED_SOURCES;
|
|
|
|
# use normal_objects here to avoid creating circular dependencies. This assumes
|
|
|
|
# that custom build rules which generate .o files don't consume other generated
|
|
|
|
# sources as input (or if they do they take care of that dependency themselves).
|
2014-01-17 01:21:03 +01:00
|
|
|
$(normal_objects) : | $(my_generated_sources)
|
2013-08-29 16:36:34 +02:00
|
|
|
$(all_objects) : | $(import_includes)
|
2009-03-04 04:28:42 +01:00
|
|
|
ALL_C_CPP_ETC_OBJECTS += $(all_objects)
|
|
|
|
|
|
|
|
|
|
|
|
###########################################################
|
|
|
|
# Standard library handling.
|
|
|
|
###########################################################
|
|
|
|
|
|
|
|
###########################################################
|
|
|
|
# The list of libraries that this module will link against are in
|
|
|
|
# these variables. Each is a list of bare module names like "libc libm".
|
|
|
|
#
|
|
|
|
# LOCAL_SHARED_LIBRARIES
|
|
|
|
# LOCAL_STATIC_LIBRARIES
|
|
|
|
# LOCAL_WHOLE_STATIC_LIBRARIES
|
|
|
|
#
|
|
|
|
# We need to convert the bare names into the dependencies that
|
|
|
|
# we'll use for LOCAL_BUILT_MODULE and LOCAL_INSTALLED_MODULE.
|
|
|
|
# LOCAL_BUILT_MODULE should depend on the BUILT versions of the
|
|
|
|
# libraries, so that simply building this module doesn't force
|
|
|
|
# an install of a library. Similarly, LOCAL_INSTALLED_MODULE
|
|
|
|
# should depend on the INSTALLED versions of the libraries so
|
|
|
|
# that they get installed when this module does.
|
|
|
|
###########################################################
|
|
|
|
# NOTE:
|
|
|
|
# WHOLE_STATIC_LIBRARIES are libraries that are pulled into the
|
|
|
|
# module without leaving anything out, which is useful for turning
|
|
|
|
# a collection of .a files into a .so file. Linking against a
|
|
|
|
# normal STATIC_LIBRARY will only pull in code/symbols that are
|
|
|
|
# referenced by the module. (see gcc/ld's --whole-archive option)
|
|
|
|
###########################################################
|
|
|
|
|
|
|
|
# Get the list of BUILT libraries, which are under
|
|
|
|
# various intermediates directories.
|
|
|
|
so_suffix := $($(my_prefix)SHLIB_SUFFIX)
|
|
|
|
a_suffix := $($(my_prefix)STATIC_LIB_SUFFIX)
|
|
|
|
|
2012-08-14 19:13:16 +02:00
|
|
|
ifdef LOCAL_SDK_VERSION
|
2009-03-04 04:28:42 +01:00
|
|
|
built_shared_libraries := \
|
2014-01-16 01:02:16 +01:00
|
|
|
$(addprefix $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
|
2009-03-04 04:28:42 +01:00
|
|
|
$(addsuffix $(so_suffix), \
|
2014-01-16 01:02:16 +01:00
|
|
|
$(my_shared_libraries)))
|
2009-03-04 04:28:42 +01:00
|
|
|
|
2014-03-22 00:17:04 +01:00
|
|
|
# Add the NDK libraries to the built module dependency
|
2011-03-04 03:53:53 +01:00
|
|
|
my_system_shared_libraries_fullpath := \
|
|
|
|
$(my_ndk_stl_shared_lib_fullpath) \
|
2014-04-26 08:47:10 +02:00
|
|
|
$(addprefix $(my_ndk_sysroot_lib)/, \
|
2014-03-22 00:17:04 +01:00
|
|
|
$(addsuffix $(so_suffix), $(my_system_shared_libraries)))
|
2010-07-13 23:55:47 +02:00
|
|
|
|
|
|
|
built_shared_libraries += $(my_system_shared_libraries_fullpath)
|
|
|
|
else
|
|
|
|
built_shared_libraries := \
|
2014-01-16 01:02:16 +01:00
|
|
|
$(addprefix $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
|
2010-07-13 23:55:47 +02:00
|
|
|
$(addsuffix $(so_suffix), \
|
2014-03-22 00:17:04 +01:00
|
|
|
$(installed_shared_library_module_names)))
|
2010-07-13 23:55:47 +02:00
|
|
|
endif
|
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
built_static_libraries := \
|
2014-01-16 01:02:16 +01:00
|
|
|
$(foreach lib,$(my_static_libraries), \
|
2009-03-04 04:28:42 +01:00
|
|
|
$(call intermediates-dir-for, \
|
2015-08-14 21:59:50 +02:00
|
|
|
STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/$(lib)$(a_suffix))
|
2009-03-04 04:28:42 +01:00
|
|
|
|
2012-08-14 19:13:16 +02:00
|
|
|
ifdef LOCAL_SDK_VERSION
|
2011-03-04 03:53:53 +01:00
|
|
|
built_static_libraries += $(my_ndk_stl_static_lib)
|
|
|
|
endif
|
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
built_whole_libraries := \
|
2014-02-04 23:53:25 +01:00
|
|
|
$(foreach lib,$(my_whole_static_libraries), \
|
2009-03-04 04:28:42 +01:00
|
|
|
$(call intermediates-dir-for, \
|
2015-08-14 21:59:50 +02:00
|
|
|
STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/$(lib)$(a_suffix))
|
2009-03-04 04:28:42 +01:00
|
|
|
|
|
|
|
# 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
|
2012-03-01 12:34:41 +01:00
|
|
|
# libraries that we use. (see notice_files.mk)
|
2009-03-04 04:28:42 +01:00
|
|
|
|
|
|
|
installed_static_library_notice_file_targets := \
|
2014-02-04 23:53:25 +01:00
|
|
|
$(foreach lib,$(my_static_libraries) $(my_whole_static_libraries), \
|
2009-03-04 04:28:42 +01:00
|
|
|
NOTICE-$(if $(LOCAL_IS_HOST_MODULE),HOST,TARGET)-STATIC_LIBRARIES-$(lib))
|
|
|
|
|
2011-05-11 06:50:58 +02:00
|
|
|
# Default is -fno-rtti.
|
2011-06-07 19:55:48 +02:00
|
|
|
ifeq ($(strip $(LOCAL_RTTI_FLAG)),)
|
|
|
|
LOCAL_RTTI_FLAG := -fno-rtti
|
|
|
|
endif
|
2011-05-11 06:50:58 +02:00
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
###########################################################
|
|
|
|
# Rule-specific variable definitions
|
|
|
|
###########################################################
|
2013-12-10 12:07:41 +01:00
|
|
|
|
2014-05-27 22:03:36 +02:00
|
|
|
ifeq ($(my_clang),true)
|
2014-09-05 02:15:47 +02:00
|
|
|
my_cflags += $(LOCAL_CLANG_CFLAGS)
|
2014-11-26 09:53:46 +01:00
|
|
|
my_conlyflags += $(LOCAL_CLANG_CONLYFLAGS)
|
2014-11-28 23:00:12 +01:00
|
|
|
my_cppflags += $(LOCAL_CLANG_CPPFLAGS)
|
2015-06-11 01:33:43 +02:00
|
|
|
my_cflags_no_override += $(GLOBAL_CLANG_CFLAGS_NO_OVERRIDE)
|
|
|
|
my_cppflags_no_override += $(GLOBAL_CLANG_CPPFLAGS_NO_OVERRIDE)
|
2014-09-05 02:15:47 +02:00
|
|
|
my_asflags += $(LOCAL_CLANG_ASFLAGS)
|
|
|
|
my_ldflags += $(LOCAL_CLANG_LDFLAGS)
|
2014-09-27 02:13:48 +02:00
|
|
|
my_cflags += $(LOCAL_CLANG_CFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CLANG_CFLAGS_$(my_32_64_bit_suffix))
|
2014-11-26 09:53:46 +01:00
|
|
|
my_conlyflags += $(LOCAL_CLANG_CONLYFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CLANG_CONLYFLAGS_$(my_32_64_bit_suffix))
|
2014-09-27 02:13:48 +02:00
|
|
|
my_cppflags += $(LOCAL_CLANG_CPPFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CLANG_CPPFLAGS_$(my_32_64_bit_suffix))
|
|
|
|
my_ldflags += $(LOCAL_CLANG_LDFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CLANG_LDFLAGS_$(my_32_64_bit_suffix))
|
|
|
|
my_asflags += $(LOCAL_CLANG_ASFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CLANG_ASFLAGS_$(my_32_64_bit_suffix))
|
2014-02-07 03:08:44 +01:00
|
|
|
my_cflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(my_cflags))
|
|
|
|
my_cppflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(my_cppflags))
|
|
|
|
my_asflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(my_asflags))
|
|
|
|
my_ldflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(my_ldflags))
|
2013-12-10 12:07:41 +01:00
|
|
|
endif
|
|
|
|
|
2014-10-28 22:50:59 +01:00
|
|
|
ifeq ($(my_fdo_build), true)
|
|
|
|
my_cflags := $(patsubst -Os,-O2,$(my_cflags))
|
|
|
|
fdo_incompatible_flags := -fno-early-inlining -finline-limit=%
|
|
|
|
my_cflags := $(filter-out $(fdo_incompatible_flags),$(my_cflags))
|
2014-09-19 19:18:12 +02:00
|
|
|
endif
|
|
|
|
|
2015-08-12 23:54:16 +02:00
|
|
|
# No one should ever use this flag. On GCC it's mere presence will disable all
|
|
|
|
# warnings, even those that are specified after it (contrary to typical warning
|
|
|
|
# flag behavior). This circumvents CFLAGS_NO_OVERRIDE from forcibly enabling the
|
|
|
|
# warnings that are *always* bugs.
|
|
|
|
my_illegal_flags := -w
|
|
|
|
my_cflags := $(filter-out $(my_illegal_flags),$(my_cflags))
|
|
|
|
my_cppflags := $(filter-out $(my_illegal_flags),$(my_cppflags))
|
|
|
|
my_conlyflags := $(filter-out $(my_illegal_flags),$(my_conlyflags))
|
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_YACCFLAGS := $(LOCAL_YACCFLAGS)
|
2014-01-16 01:02:16 +01:00
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASFLAGS := $(my_asflags)
|
2014-11-26 09:53:46 +01:00
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CONLYFLAGS := $(my_conlyflags)
|
2014-01-16 01:02:16 +01:00
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CFLAGS := $(my_cflags)
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CPPFLAGS := $(my_cppflags)
|
2015-06-11 01:33:43 +02:00
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CFLAGS_NO_OVERRIDE := $(my_cflags_no_override)
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CPPFLAGS_NO_OVERRIDE := $(my_cppflags_no_override)
|
2011-05-11 06:50:58 +02:00
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RTTI_FLAG := $(LOCAL_RTTI_FLAG)
|
2009-03-04 04:28:42 +01:00
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEBUG_CFLAGS := $(debug_cflags)
|
2014-01-16 01:02:16 +01:00
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_C_INCLUDES := $(my_c_includes)
|
2011-11-08 18:31:21 +01:00
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_IMPORT_INCLUDES := $(import_includes)
|
2014-01-16 01:02:16 +01:00
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDFLAGS := $(my_ldflags)
|
2014-09-12 23:46:57 +02:00
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDLIBS := $(my_ldlibs)
|
2009-03-04 04:28:42 +01:00
|
|
|
|
|
|
|
# this is really the way to get the files onto the command line instead
|
|
|
|
# of using $^, because then LOCAL_ADDITIONAL_DEPENDENCIES doesn't work
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_SHARED_LIBRARIES := $(built_shared_libraries)
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_STATIC_LIBRARIES := $(built_static_libraries)
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_WHOLE_STATIC_LIBRARIES := $(built_whole_libraries)
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_OBJECTS := $(all_objects)
|
|
|
|
|
|
|
|
###########################################################
|
|
|
|
# Define library dependencies.
|
|
|
|
###########################################################
|
|
|
|
# all_libraries is used for the dependencies on LOCAL_BUILT_MODULE.
|
|
|
|
all_libraries := \
|
|
|
|
$(built_shared_libraries) \
|
|
|
|
$(built_static_libraries) \
|
|
|
|
$(built_whole_libraries)
|
|
|
|
|
|
|
|
# Also depend on the notice files for any static libraries that
|
|
|
|
# are linked into this module. This will force them to be installed
|
|
|
|
# when this module is.
|
|
|
|
$(LOCAL_INSTALLED_MODULE): | $(installed_static_library_notice_file_targets)
|
2011-11-08 18:31:21 +01:00
|
|
|
|
|
|
|
###########################################################
|
|
|
|
# Export includes
|
|
|
|
###########################################################
|
|
|
|
export_includes := $(intermediates)/export_includes
|
2015-04-07 20:59:34 +02:00
|
|
|
$(export_includes): PRIVATE_EXPORT_C_INCLUDE_DIRS := $(my_export_c_include_dirs)
|
2014-05-06 22:03:32 +02:00
|
|
|
# Make sure .pb.h are already generated before any dependent source files get compiled.
|
2015-08-14 23:55:32 +02:00
|
|
|
$(export_includes) : $(LOCAL_MODULE_MAKEFILE) $(proto_generated_headers) $(dbus_generated_headers)
|
2011-11-08 18:31:21 +01:00
|
|
|
@echo Export includes file: $< -- $@
|
|
|
|
$(hide) mkdir -p $(dir $@) && rm -f $@
|
2015-04-07 20:59:34 +02:00
|
|
|
ifdef my_export_c_include_dirs
|
2011-11-08 18:31:21 +01:00
|
|
|
$(hide) for d in $(PRIVATE_EXPORT_C_INCLUDE_DIRS); do \
|
|
|
|
echo "-I $$d" >> $@; \
|
|
|
|
done
|
|
|
|
else
|
|
|
|
$(hide) touch $@
|
|
|
|
endif
|
2012-04-19 02:35:55 +02:00
|
|
|
|
|
|
|
# Make sure export_includes gets generated when you are running mm/mmm
|
|
|
|
$(LOCAL_BUILT_MODULE) : | $(export_includes)
|