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
|
2018-04-12 19:55:54 +02:00
|
|
|
include $(BUILD_SYSTEM)/use_lld_setup.mk
|
2014-03-22 00:17:04 +01:00
|
|
|
#######################################
|
|
|
|
|
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)
|
2017-06-26 22:13:44 +02:00
|
|
|
my_system_shared_libraries := libc libm libdl
|
2014-11-15 00:28:49 +01:00
|
|
|
else
|
|
|
|
my_system_shared_libraries := $(LOCAL_SYSTEM_SHARED_LIBRARIES)
|
2017-06-26 22:13:44 +02:00
|
|
|
my_system_shared_libraries := $(patsubst libc,libc libdl,$(my_system_shared_libraries))
|
2014-11-15 00:28:49 +01:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2016-08-26 22:27:13 +02:00
|
|
|
my_soong_problems :=
|
|
|
|
|
2014-11-15 00:28:49 +01:00
|
|
|
# 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)
|
2015-06-30 21:21:59 +02:00
|
|
|
my_src_files_exclude := $(LOCAL_SRC_FILES_EXCLUDE)
|
2014-11-15 00:28:49 +01:00
|
|
|
my_static_libraries := $(LOCAL_STATIC_LIBRARIES)
|
|
|
|
my_whole_static_libraries := $(LOCAL_WHOLE_STATIC_LIBRARIES)
|
2017-06-26 22:13:44 +02:00
|
|
|
my_shared_libraries := $(filter-out $(my_system_shared_libraries),$(LOCAL_SHARED_LIBRARIES))
|
2017-02-16 00:48:11 +01:00
|
|
|
my_header_libraries := $(LOCAL_HEADER_LIBRARIES)
|
2014-11-15 00:28:49 +01:00
|
|
|
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)
|
2018-10-08 04:41:21 +02:00
|
|
|
my_cflags_no_override := $(GLOBAL_CLANG_CFLAGS_NO_OVERRIDE)
|
|
|
|
my_cppflags_no_override := $(GLOBAL_CLANG_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)
|
2019-08-06 21:54:48 +02:00
|
|
|
my_cxx_link := $(LOCAL_CXX)
|
2017-08-18 05:22:57 +02:00
|
|
|
my_cxx_ldlibs :=
|
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)
|
2016-01-06 23:28:36 +01:00
|
|
|
my_additional_dependencies := $(LOCAL_ADDITIONAL_DEPENDENCIES)
|
2015-04-07 20:59:34 +02:00
|
|
|
my_export_c_include_dirs := $(LOCAL_EXPORT_C_INCLUDE_DIRS)
|
2016-09-29 21:08:29 +02:00
|
|
|
my_export_c_include_deps := $(LOCAL_EXPORT_C_INCLUDE_DEPS)
|
2017-01-24 01:57:38 +01:00
|
|
|
my_arflags :=
|
2014-11-15 00:28:49 +01:00
|
|
|
|
2020-08-06 02:06:34 +02:00
|
|
|
# Disable clang-tidy if it is not found.
|
|
|
|
ifeq ($(PATH_TO_CLANG_TIDY),)
|
|
|
|
my_tidy_enabled := false
|
|
|
|
else
|
|
|
|
# If LOCAL_TIDY is not defined, use global WITH_TIDY
|
|
|
|
my_tidy_enabled := $(LOCAL_TIDY)
|
|
|
|
ifeq ($(my_tidy_enabled),)
|
|
|
|
my_tidy_enabled := $(WITH_TIDY)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
# my_tidy_checks is empty if clang-tidy is disabled.
|
|
|
|
my_tidy_checks :=
|
|
|
|
my_tidy_flags :=
|
|
|
|
ifneq (,$(filter 1 true,$(my_tidy_enabled)))
|
|
|
|
# Set up global default checks
|
|
|
|
my_tidy_checks := $(WITH_TIDY_CHECKS)
|
|
|
|
ifeq ($(my_tidy_checks),)
|
|
|
|
my_tidy_checks := $(call default_global_tidy_checks,$(LOCAL_PATH))
|
|
|
|
endif
|
|
|
|
# Append local clang-tidy checks.
|
|
|
|
ifneq ($(LOCAL_TIDY_CHECKS),)
|
|
|
|
my_tidy_checks := $(my_tidy_checks),$(LOCAL_TIDY_CHECKS)
|
|
|
|
endif
|
|
|
|
my_tidy_flags := $(strip $(WITH_TIDY_FLAGS) $(LOCAL_TIDY_FLAGS))
|
|
|
|
# If tidy flags are not specified, default to check all header files.
|
|
|
|
ifeq ($(my_tidy_flags),)
|
|
|
|
my_tidy_flags := $(call default_tidy_header_filter,$(LOCAL_PATH))
|
|
|
|
endif
|
|
|
|
# If clang-tidy is not enabled globally, add the -quiet flag.
|
|
|
|
ifeq (,$(filter 1 true,$(WITH_TIDY)))
|
|
|
|
my_tidy_flags += -quiet -extra-arg-before=-fno-caret-diagnostics
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(my_tidy_checks),)
|
|
|
|
# We might be using the static analyzer through clang-tidy.
|
|
|
|
# https://bugs.llvm.org/show_bug.cgi?id=32914
|
|
|
|
my_tidy_flags += -extra-arg-before=-D__clang_analyzer__
|
|
|
|
|
|
|
|
# A recent change in clang-tidy (r328258) enabled destructor inlining,
|
|
|
|
# which appears to cause a number of false positives. Until that's
|
|
|
|
# resolved, this turns off the effects of r328258.
|
|
|
|
# https://bugs.llvm.org/show_bug.cgi?id=37459
|
|
|
|
my_tidy_flags += -extra-arg-before=-Xclang
|
|
|
|
my_tidy_flags += -extra-arg-before=-analyzer-config
|
|
|
|
my_tidy_flags += -extra-arg-before=-Xclang
|
|
|
|
my_tidy_flags += -extra-arg-before=c++-temp-dtor-inlining=false
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
my_tidy_checks := $(subst $(space),,$(my_tidy_checks))
|
|
|
|
|
2019-11-12 01:04:34 +01:00
|
|
|
# Configure the pool to use for clang rules.
|
|
|
|
# If LOCAL_CC or LOCAL_CXX is set don't use goma or RBE.
|
2020-08-06 02:06:34 +02:00
|
|
|
# If clang-tidy is being used, don't use the RBE pool (as clang-tidy runs in
|
|
|
|
# the same action, and is not remoted)
|
2019-11-12 01:04:34 +01:00
|
|
|
my_pool :=
|
2020-08-06 02:06:34 +02:00
|
|
|
ifeq (,$(strip $(my_cc))$(strip $(my_cxx))$(strip $(my_tidy_checks)))
|
2019-11-12 01:04:34 +01:00
|
|
|
my_pool := $(GOMA_OR_RBE_POOL)
|
|
|
|
endif
|
|
|
|
|
2020-07-07 16:19:44 +02:00
|
|
|
ifneq (,$(strip $(foreach dir,$(NATIVE_COVERAGE_PATHS),$(filter $(dir)%,$(LOCAL_PATH)))))
|
|
|
|
ifeq (,$(strip $(foreach dir,$(NATIVE_COVERAGE_EXCLUDE_PATHS),$(filter $(dir)%,$(LOCAL_PATH)))))
|
2016-09-12 22:56:50 +02:00
|
|
|
my_native_coverage := true
|
|
|
|
else
|
|
|
|
my_native_coverage := false
|
|
|
|
endif
|
2017-02-27 18:09:16 +01:00
|
|
|
else
|
|
|
|
my_native_coverage := false
|
|
|
|
endif
|
2019-01-10 22:10:17 +01:00
|
|
|
ifneq ($(NATIVE_COVERAGE),true)
|
|
|
|
my_native_coverage := false
|
|
|
|
endif
|
2016-09-12 22:56:50 +02:00
|
|
|
|
2020-06-11 20:25:05 +02:00
|
|
|
# Exclude directories from checking allowed manual binder interface lists.
|
2019-11-26 19:20:43 +01:00
|
|
|
# TODO(b/145621474): Move this check into IInterface.h when clang-tidy no longer uses absolute paths.
|
|
|
|
ifneq (,$(filter $(addsuffix %,$(ALLOWED_MANUAL_INTERFACE_PATHS)),$(LOCAL_PATH)))
|
|
|
|
my_cflags += -DDO_NOT_CHECK_MANUAL_BINDER_INTERFACES
|
|
|
|
endif
|
|
|
|
|
2016-10-20 21:38:21 +02:00
|
|
|
my_allow_undefined_symbols := $(strip $(LOCAL_ALLOW_UNDEFINED_SYMBOLS))
|
|
|
|
ifdef SANITIZE_HOST
|
2014-11-15 02:15:00 +01:00
|
|
|
ifdef LOCAL_IS_HOST_MODULE
|
|
|
|
my_allow_undefined_symbols := true
|
2016-10-20 21:38:21 +02:00
|
|
|
endif
|
2014-11-15 02:15:00 +01:00
|
|
|
endif
|
|
|
|
|
2014-04-26 08:47:10 +02:00
|
|
|
my_ndk_sysroot :=
|
|
|
|
my_ndk_sysroot_include :=
|
|
|
|
my_ndk_sysroot_lib :=
|
2019-07-26 02:43:04 +02:00
|
|
|
my_api_level := 10000
|
|
|
|
|
2020-08-03 17:51:33 +02:00
|
|
|
my_arch := $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)
|
|
|
|
|
2017-03-19 21:22:45 +01:00
|
|
|
ifneq ($(LOCAL_SDK_VERSION),)
|
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
|
2016-04-06 19:20:02 +02:00
|
|
|
|
2016-07-21 19:04:12 +02:00
|
|
|
# Make sure we've built the NDK.
|
2017-12-14 22:52:04 +01:00
|
|
|
my_additional_dependencies += $(SOONG_OUT_DIR)/ndk_base.timestamp
|
2016-07-21 19:04:12 +02:00
|
|
|
|
2020-03-07 01:46:59 +01:00
|
|
|
ifneq (,$(filter arm64 x86_64,$(my_arch)))
|
2016-07-21 19:04:12 +02:00
|
|
|
my_min_sdk_version := 21
|
|
|
|
else
|
2017-08-18 01:24:46 +02:00
|
|
|
my_min_sdk_version := $(MIN_SUPPORTED_SDK_VERSION)
|
2016-07-21 19:04:12 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
# Historically we've just set up a bunch of symlinks in prebuilts/ndk to map
|
|
|
|
# missing API levels to existing ones where necessary, but we're not doing
|
|
|
|
# that for the generated libraries. Clip the API level to the minimum where
|
|
|
|
# appropriate.
|
2017-03-19 21:22:45 +01:00
|
|
|
my_ndk_api := $(LOCAL_SDK_VERSION)
|
|
|
|
ifneq ($(my_ndk_api),current)
|
|
|
|
my_ndk_api := $(call math_max,$(my_ndk_api),$(my_min_sdk_version))
|
2016-11-09 00:10:09 +01:00
|
|
|
endif
|
|
|
|
|
2020-07-17 02:12:07 +02:00
|
|
|
my_ndk_crt_version := $(my_ndk_api)
|
|
|
|
|
2016-11-09 00:10:09 +01:00
|
|
|
my_ndk_hist_api := $(my_ndk_api)
|
|
|
|
ifeq ($(my_ndk_api),current)
|
|
|
|
# The last API level supported by the old prebuilt NDKs.
|
|
|
|
my_ndk_hist_api := 24
|
2019-07-26 02:43:04 +02:00
|
|
|
else
|
|
|
|
my_api_level := $(my_ndk_api)
|
2016-11-09 00:10:09 +01:00
|
|
|
endif
|
|
|
|
|
2016-07-21 19:04:12 +02:00
|
|
|
my_ndk_source_root := \
|
|
|
|
$(HISTORICAL_NDK_VERSIONS_ROOT)/$(LOCAL_NDK_VERSION)/sources
|
|
|
|
my_ndk_sysroot := \
|
2016-11-09 00:10:09 +01:00
|
|
|
$(HISTORICAL_NDK_VERSIONS_ROOT)/$(LOCAL_NDK_VERSION)/platforms/android-$(my_ndk_hist_api)/arch-$(my_arch)
|
2016-07-21 19:04:12 +02:00
|
|
|
my_built_ndk := $(SOONG_OUT_DIR)/ndk
|
|
|
|
my_ndk_triple := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_NDK_TRIPLE)
|
|
|
|
my_ndk_sysroot_include := \
|
|
|
|
$(my_built_ndk)/sysroot/usr/include \
|
|
|
|
$(my_built_ndk)/sysroot/usr/include/$(my_ndk_triple) \
|
|
|
|
$(my_ndk_sysroot)/usr/include \
|
2015-12-11 21:49:18 +01:00
|
|
|
|
2020-03-07 01:46:59 +01:00
|
|
|
# x86_64 is a multilib toolchain, so their libraries are
|
2015-12-11 21:49:18 +01:00
|
|
|
# installed in /usr/lib64. Aarch64, on the other hand, is not a multilib
|
|
|
|
# compiler, so its libraries are in /usr/lib.
|
2020-03-07 01:46:59 +01:00
|
|
|
ifneq (,$(filter x86_64,$(my_arch)))
|
2016-07-21 19:04:12 +02:00
|
|
|
my_ndk_libdir_name := lib64
|
2014-04-26 08:47:10 +02:00
|
|
|
else
|
2016-07-21 19:04:12 +02:00
|
|
|
my_ndk_libdir_name := lib
|
2014-04-26 08:47:10 +02:00
|
|
|
endif
|
2011-03-04 03:53:53 +01:00
|
|
|
|
2016-07-21 19:04:12 +02:00
|
|
|
my_ndk_platform_dir := \
|
|
|
|
$(my_built_ndk)/platforms/android-$(my_ndk_api)/arch-$(my_arch)
|
|
|
|
my_built_ndk_libs := $(my_ndk_platform_dir)/usr/$(my_ndk_libdir_name)
|
|
|
|
my_ndk_sysroot_lib := $(my_ndk_sysroot)/usr/$(my_ndk_libdir_name)
|
|
|
|
|
2017-03-19 21:22:45 +01: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. Fortunately, we can build with both and it'll work
|
|
|
|
# anywhere.
|
2020-03-07 01:46:59 +01:00
|
|
|
my_ldflags += -Wl,--hash-style=both
|
2014-11-15 00:28:49 +01:00
|
|
|
|
2017-03-19 21:22:45 +01:00
|
|
|
# We don't want to expose the relocation packer to the NDK just yet.
|
|
|
|
LOCAL_PACK_MODULE_RELOCATIONS := false
|
|
|
|
|
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_static_lib :=
|
2014-11-09 00:25:18 +01:00
|
|
|
my_cpu_variant := $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)CPU_ABI)
|
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))
|
2017-12-15 21:01:03 +01:00
|
|
|
LOCAL_NDK_STL_VARIANT := system
|
2011-03-04 03:53:53 +01:00
|
|
|
endif
|
2018-01-04 22:34:21 +01:00
|
|
|
ifneq (1,$(words $(filter none system c++_static c++_shared, $(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
|
2018-01-04 22:34:21 +01:00
|
|
|
|
2011-03-04 03:53:53 +01:00
|
|
|
ifeq (system,$(LOCAL_NDK_STL_VARIANT))
|
|
|
|
my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/system/include
|
2015-12-09 23:46:13 +01:00
|
|
|
my_system_shared_libraries += libstdc++
|
2018-01-04 22:34:21 +01:00
|
|
|
else ifneq (,$(filter c++_%, $(LOCAL_NDK_STL_VARIANT)))
|
2017-12-16 00:25:06 +01:00
|
|
|
my_ndk_stl_include_path := \
|
|
|
|
$(my_ndk_source_root)/cxx-stl/llvm-libc++/include
|
|
|
|
my_ndk_stl_include_path += \
|
|
|
|
$(my_ndk_source_root)/cxx-stl/llvm-libc++abi/include
|
2016-08-09 02:14:59 +02:00
|
|
|
|
|
|
|
my_libcxx_libdir := \
|
|
|
|
$(my_ndk_source_root)/cxx-stl/llvm-libc++/libs/$(my_cpu_variant)
|
|
|
|
|
2017-12-16 00:25:06 +01:00
|
|
|
ifeq (c++_static,$(LOCAL_NDK_STL_VARIANT))
|
|
|
|
my_ndk_stl_static_lib := \
|
|
|
|
$(my_libcxx_libdir)/libc++_static.a \
|
|
|
|
$(my_libcxx_libdir)/libc++abi.a
|
2014-03-04 10:11:52 +01:00
|
|
|
else
|
2017-12-16 00:25:06 +01:00
|
|
|
my_ndk_stl_shared_lib_fullpath := $(my_libcxx_libdir)/libc++_shared.so
|
|
|
|
endif
|
2016-08-09 02:14:59 +02:00
|
|
|
|
2018-11-15 20:33:21 +01:00
|
|
|
ifneq ($(my_ndk_api),current)
|
|
|
|
ifeq ($(call math_lt,$(my_ndk_api),21),true)
|
|
|
|
my_ndk_stl_include_path += $(my_ndk_source_root)/android/support/include
|
|
|
|
my_ndk_stl_static_lib += $(my_libcxx_libdir)/libandroid_support.a
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2017-12-16 00:25:06 +01:00
|
|
|
ifneq (,$(filter armeabi armeabi-v7a,$(my_cpu_variant)))
|
|
|
|
my_ndk_stl_static_lib += $(my_libcxx_libdir)/libunwind.a
|
2014-03-04 10:11:52 +01:00
|
|
|
endif
|
2016-08-09 02:14:59 +02:00
|
|
|
|
2016-09-15 01:08:04 +02:00
|
|
|
my_ldlibs += -ldl
|
2015-12-09 23:46:13 +01:00
|
|
|
else # LOCAL_NDK_STL_VARIANT must be none
|
|
|
|
# Do nothing.
|
|
|
|
endif
|
2018-12-20 22:47:44 +01:00
|
|
|
|
|
|
|
# Clang's coverage/profile runtime needs symbols like 'stderr' that were not
|
|
|
|
# exported from libc prior to API level 23
|
|
|
|
ifneq ($(my_ndk_api),current)
|
|
|
|
ifeq ($(call math_lt, $(my_ndk_api),23),true)
|
|
|
|
my_native_coverage := false
|
|
|
|
endif
|
|
|
|
endif
|
2017-03-19 21:22:45 +01:00
|
|
|
endif
|
|
|
|
|
2019-07-03 08:49:19 +02:00
|
|
|
ifeq ($(NATIVE_COVERAGE),true)
|
|
|
|
ifndef LOCAL_IS_HOST_MODULE
|
|
|
|
my_ldflags += -Wl,--wrap,getenv
|
|
|
|
|
|
|
|
ifneq ($(LOCAL_MODULE_CLASS),STATIC_LIBRARIES)
|
|
|
|
ifeq ($(LOCAL_SDK_VERSION),)
|
|
|
|
my_whole_static_libraries += libprofile-extras
|
|
|
|
else
|
|
|
|
my_whole_static_libraries += libprofile-extras_ndk
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2017-03-19 21:22:45 +01:00
|
|
|
ifneq ($(LOCAL_USE_VNDK),)
|
2018-03-19 23:16:14 +01:00
|
|
|
# Required VNDK version for vendor modules is BOARD_VNDK_VERSION.
|
2019-07-26 02:43:04 +02:00
|
|
|
my_api_level := $(BOARD_VNDK_VERSION)
|
|
|
|
ifeq ($(my_api_level),current)
|
2018-03-19 23:16:14 +01:00
|
|
|
# Build with current PLATFORM_VNDK_VERSION.
|
|
|
|
# If PLATFORM_VNDK_VERSION has a CODENAME, it will return
|
|
|
|
# __ANDROID_API_FUTURE__.
|
2019-07-26 02:43:04 +02:00
|
|
|
my_api_level := $(call codename-or-sdk-to-sdk,$(PLATFORM_VNDK_VERSION))
|
2019-12-03 07:09:44 +01:00
|
|
|
else
|
|
|
|
# Build with current BOARD_VNDK_VERSION.
|
|
|
|
my_api_level := $(call codename-or-sdk-to-sdk,$(BOARD_VNDK_VERSION))
|
2018-03-19 23:16:14 +01:00
|
|
|
endif
|
2019-07-26 02:43:04 +02:00
|
|
|
my_cflags += -D__ANDROID_VNDK__
|
2021-03-08 11:31:37 +01:00
|
|
|
ifneq ($(LOCAL_USE_VNDK_VENDOR),)
|
|
|
|
# Vendor modules have LOCAL_USE_VNDK_VENDOR when
|
|
|
|
# BOARD_VNDK_VERSION is defined.
|
|
|
|
my_cflags += -D__ANDROID_VENDOR__
|
|
|
|
else ifneq ($(LOCAL_USE_VNDK_PRODUCT),)
|
|
|
|
# Product modules have LOCAL_USE_VNDK_PRODUCT when
|
|
|
|
# PRODUCT_PRODUCT_VNDK_VERSION is defined.
|
|
|
|
my_cflags += -D__ANDROID_PRODUCT__
|
|
|
|
endif
|
2016-08-04 23:14:50 +02:00
|
|
|
endif
|
2016-07-21 19:04:12 +02:00
|
|
|
|
2016-08-04 23:14:50 +02:00
|
|
|
ifndef LOCAL_IS_HOST_MODULE
|
|
|
|
# For device libraries, move LOCAL_LDLIBS references to my_shared_libraries. We
|
|
|
|
# no longer need to use my_ldlibs to pick up NDK prebuilt libraries since we're
|
|
|
|
# linking my_shared_libraries by full path now.
|
|
|
|
my_allowed_ldlibs :=
|
|
|
|
|
|
|
|
# Sort ldlibs and ldflags between -l and other linker flags
|
|
|
|
# We'll do this again later, since there are still changes happening, but that's fine.
|
|
|
|
my_ldlib_flags := $(my_ldflags) $(my_ldlibs)
|
|
|
|
my_ldlibs := $(filter -l%,$(my_ldlib_flags))
|
|
|
|
my_ldflags := $(filter-out -l%,$(my_ldlib_flags))
|
|
|
|
my_ldlib_flags :=
|
|
|
|
|
|
|
|
# Move other ldlibs back to shared libraries
|
|
|
|
my_shared_libraries += $(patsubst -l%,lib%,$(filter-out $(my_allowed_ldlibs),$(my_ldlibs)))
|
|
|
|
my_ldlibs := $(filter $(my_allowed_ldlibs),$(my_ldlibs))
|
2017-09-08 23:41:22 +02:00
|
|
|
else # LOCAL_IS_HOST_MODULE
|
2017-09-27 05:26:11 +02:00
|
|
|
# Add -ldl, -lpthread, -lm and -lrt to host builds to match the default behavior of
|
2017-09-08 23:41:22 +02:00
|
|
|
# device builds
|
2019-01-26 01:54:37 +01:00
|
|
|
my_ldlibs += -ldl -lpthread -lm
|
|
|
|
ifneq ($(HOST_OS),darwin)
|
|
|
|
my_ldlibs += -lrt
|
2017-09-08 23:41:22 +02:00
|
|
|
endif
|
2016-08-04 23:14:50 +02:00
|
|
|
endif
|
|
|
|
|
2017-03-19 21:22:45 +01:00
|
|
|
ifneq ($(LOCAL_SDK_VERSION),)
|
2020-06-30 21:46:41 +02:00
|
|
|
my_all_ndk_libraries := $(NDK_KNOWN_LIBS)
|
2016-08-04 23:14:50 +02:00
|
|
|
my_ndk_shared_libraries := \
|
|
|
|
$(filter $(my_all_ndk_libraries),\
|
|
|
|
$(my_shared_libraries) $(my_system_shared_libraries))
|
|
|
|
|
|
|
|
my_shared_libraries := \
|
|
|
|
$(filter-out $(my_all_ndk_libraries),$(my_shared_libraries))
|
2016-07-21 19:04:12 +02:00
|
|
|
my_system_shared_libraries := \
|
2016-08-04 23:14:50 +02:00
|
|
|
$(filter-out $(my_all_ndk_libraries),$(my_system_shared_libraries))
|
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.
|
2016-08-02 02:36:39 +02:00
|
|
|
ifneq ($(LOCAL_NO_PIC),true)
|
2019-01-26 01:54:37 +01:00
|
|
|
ifneq ($(filter EXECUTABLES NATIVE_TESTS,$(LOCAL_MODULE_CLASS)),)
|
|
|
|
my_cflags += -fPIE
|
|
|
|
ifndef BUILD_HOST_static
|
|
|
|
ifneq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true)
|
|
|
|
my_ldflags += -pie
|
2018-09-19 23:45:52 +02:00
|
|
|
endif
|
|
|
|
endif
|
2019-01-26 01:54:37 +01:00
|
|
|
else
|
|
|
|
my_cflags += -fPIC
|
2018-09-19 23:45:52 +02:00
|
|
|
endif
|
2016-08-02 02:36:39 +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))
|
2017-02-16 00:48:11 +01:00
|
|
|
my_header_libraries += $(LOCAL_HEADER_LIBRARIES_$($(my_prefix)OS))
|
2015-08-14 02:51:40 +02:00
|
|
|
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))
|
2015-06-30 21:21:59 +02:00
|
|
|
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))
|
2014-04-17 19:03:35 +02:00
|
|
|
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
|
|
|
|
2015-12-04 07:58:39 +01:00
|
|
|
my_missing_exclude_files := $(filter-out $(my_src_files),$(my_src_files_exclude))
|
|
|
|
ifneq ($(my_missing_exclude_files),)
|
|
|
|
$(warning Files are listed in LOCAL_SRC_FILES_EXCLUDE but not LOCAL_SRC_FILES)
|
|
|
|
$(error $(my_missing_exclude_files))
|
|
|
|
endif
|
2015-06-30 21:21:59 +02:00
|
|
|
my_src_files := $(filter-out $(my_src_files_exclude),$(my_src_files))
|
|
|
|
|
2016-10-29 01:30:48 +02:00
|
|
|
# Strip '/' from the beginning of each src file. This helps the ../ detection in case
|
|
|
|
# the source file is in the form of /../file
|
|
|
|
my_src_files := $(patsubst /%,%,$(my_src_files))
|
|
|
|
|
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
|
2016-08-02 23:22:06 +02:00
|
|
|
ifeq ($(my_clang),false)
|
2018-09-05 07:25:22 +02:00
|
|
|
$(call pretty-error,LOCAL_CLANG false is no longer supported)
|
2015-09-10 00:45:21 +02:00
|
|
|
endif
|
|
|
|
|
2017-02-04 01:16:11 +01:00
|
|
|
ifeq ($(LOCAL_C_STD),)
|
|
|
|
my_c_std_version := $(DEFAULT_C_STD_VERSION)
|
|
|
|
else ifeq ($(LOCAL_C_STD),experimental)
|
|
|
|
my_c_std_version := $(EXPERIMENTAL_C_STD_VERSION)
|
|
|
|
else
|
|
|
|
my_c_std_version := $(LOCAL_C_STD)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(LOCAL_CPP_STD),)
|
|
|
|
my_cpp_std_version := $(DEFAULT_CPP_STD_VERSION)
|
|
|
|
else ifeq ($(LOCAL_CPP_STD),experimental)
|
|
|
|
my_cpp_std_version := $(EXPERIMENTAL_CPP_STD_VERSION)
|
|
|
|
else
|
|
|
|
my_cpp_std_version := $(LOCAL_CPP_STD)
|
|
|
|
endif
|
2015-10-26 19:09:24 +01:00
|
|
|
|
2016-10-18 00:34:29 +02:00
|
|
|
my_c_std_conlyflags :=
|
|
|
|
my_cpp_std_cppflags :=
|
|
|
|
ifneq (,$(my_c_std_version))
|
|
|
|
my_c_std_conlyflags := -std=$(my_c_std_version)
|
|
|
|
endif
|
2015-07-30 00:13:57 +02:00
|
|
|
|
2016-10-18 00:34:29 +02:00
|
|
|
ifneq (,$(my_cpp_std_version))
|
|
|
|
my_cpp_std_cppflags := -std=$(my_cpp_std_version)
|
|
|
|
endif
|
2014-08-13 20:53:07 +02:00
|
|
|
|
2018-06-07 01:42:22 +02:00
|
|
|
# Extra cflags for projects under external/ directory
|
2018-06-13 00:28:26 +02:00
|
|
|
ifneq ($(filter external/%,$(LOCAL_PATH)),)
|
2018-06-07 01:42:22 +02:00
|
|
|
my_cflags += $(CLANG_EXTERNAL_CFLAGS)
|
|
|
|
endif
|
|
|
|
|
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)
|
2017-02-16 00:48:11 +01:00
|
|
|
my_header_libraries := $(LOCAL_HEADER_LIBRARIES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_HEADER_LIBRARIES_$(my_32_64_bit_suffix)) $(my_header_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
|
|
|
|
2015-09-25 14:54:09 +02:00
|
|
|
ifneq ($(strip $(CUSTOM_$(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)LINKER)),)
|
|
|
|
my_linker := $(CUSTOM_$(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)LINKER)
|
|
|
|
else
|
2016-08-02 02:41:49 +02:00
|
|
|
my_linker := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)LINKER)
|
2015-09-25 14:54:09 +02:00
|
|
|
endif
|
2015-07-11 03:06:51 +02:00
|
|
|
|
2014-11-01 00:23:08 +01:00
|
|
|
include $(BUILD_SYSTEM)/config_sanitizers.mk
|
2012-03-30 10:15:12 +02:00
|
|
|
|
2016-08-26 22:27:13 +02:00
|
|
|
ifneq ($(filter ../%,$(my_src_files)),)
|
|
|
|
my_soong_problems += dotdot_srcs
|
|
|
|
endif
|
|
|
|
ifneq ($(foreach i,$(my_c_includes),$(filter %/..,$(i))$(findstring /../,$(i))),)
|
|
|
|
my_soong_problems += dotdot_incs
|
|
|
|
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-09-24 10:51:20 +02:00
|
|
|
# Disable ccache (or other compiler wrapper) except gomacc, which
|
|
|
|
# can handle -fprofile-use properly.
|
2019-11-12 01:04:34 +01:00
|
|
|
my_cc_wrapper := $(filter $(GOMA_CC) $(RBE_WRAPPER),$(my_cc_wrapper))
|
|
|
|
my_cxx_wrapper := $(filter $(GOMA_CC) $(RBE_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
|
|
|
|
2010-10-20 00:19:45 +02:00
|
|
|
###########################################################
|
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
|
|
|
|
|
|
|
|
# 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)),)
|
2016-10-20 21:38:21 +02:00
|
|
|
ifeq ($(my_allow_undefined_symbols),)
|
|
|
|
ifneq ($(HOST_OS),darwin)
|
|
|
|
my_ldflags += -Wl,--no-undefined
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
ifdef LOCAL_IS_HOST_MODULE
|
|
|
|
ifeq ($(HOST_OS),darwin)
|
|
|
|
# darwin defaults to treating undefined symbols as errors
|
|
|
|
my_ldflags += -Wl,-undefined,dynamic_lookup
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
2009-03-04 04:28:42 +01:00
|
|
|
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
|
|
|
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
|
|
|
normal_objects_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)$(normal_objects_mode)_CFLAGS)
|
2012-04-05 09:44:37 +02:00
|
|
|
|
2010-07-09 04:07:52 +02:00
|
|
|
else
|
|
|
|
normal_objects_mode :=
|
|
|
|
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
|
|
|
|
|
2016-01-20 05:07:08 +01:00
|
|
|
####################################################
|
|
|
|
## Keep track of src -> obj mapping
|
|
|
|
####################################################
|
|
|
|
|
|
|
|
my_tracked_gen_files :=
|
|
|
|
my_tracked_src_files :=
|
|
|
|
|
|
|
|
###########################################################
|
|
|
|
## Stuff source generated from one-off tools
|
|
|
|
###########################################################
|
|
|
|
$(my_generated_sources): PRIVATE_MODULE := $(my_register_name)
|
|
|
|
|
|
|
|
my_gen_sources_copy := $(patsubst $(generated_sources_dir)/%,$(intermediates)/%,$(filter $(generated_sources_dir)/%,$(my_generated_sources)))
|
|
|
|
|
2016-03-01 02:52:39 +01:00
|
|
|
$(my_gen_sources_copy): $(intermediates)/% : $(generated_sources_dir)/%
|
2016-01-20 05:07:08 +01:00
|
|
|
@echo "Copy: $@"
|
|
|
|
$(copy-file-to-target)
|
|
|
|
|
|
|
|
my_generated_sources := $(patsubst $(generated_sources_dir)/%,$(intermediates)/%,$(my_generated_sources))
|
|
|
|
|
|
|
|
# Generated sources that will actually produce object files.
|
|
|
|
# Other files (like headers) are allowed in LOCAL_GENERATED_SOURCES,
|
|
|
|
# since other compiled sources may depend on them, and we set up
|
|
|
|
# the dependencies.
|
2016-02-04 23:18:48 +01:00
|
|
|
my_gen_src_files := $(filter %.c %$(LOCAL_CPP_EXTENSION) %.S %.s,$(my_generated_sources))
|
2016-01-20 05:07:08 +01:00
|
|
|
|
|
|
|
ALL_GENERATED_SOURCES += $(my_generated_sources)
|
|
|
|
|
2012-10-30 00:06:00 +01:00
|
|
|
####################################################
|
|
|
|
## Compile RenderScript with reflected C++
|
|
|
|
####################################################
|
|
|
|
|
2019-07-12 17:33:31 +02:00
|
|
|
renderscript_sources := $(filter %.rscript %.fs,$(my_src_files))
|
2012-10-30 00:06:00 +01:00
|
|
|
|
|
|
|
ifneq (,$(renderscript_sources))
|
2016-08-26 22:27:13 +02:00
|
|
|
my_soong_problems += rs
|
2012-10-30 00:06:00 +01:00
|
|
|
|
|
|
|
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.
|
2015-11-06 16:20:51 +01:00
|
|
|
ifneq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION)))
|
2017-10-16 12:20:34 +02:00
|
|
|
renderscript_target_api := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION))
|
2015-08-14 02:04:10 +02:00
|
|
|
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 \
|
2017-01-09 02:40:21 +01:00
|
|
|
$(TOPDIR)frameworks/rs/script_api/include \
|
2012-10-30 00:06:00 +01:00
|
|
|
$(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)/, \
|
2019-07-12 17:33:31 +02:00
|
|
|
$(patsubst %.fs,%.d, $(patsubst %.rscript,%.d, $(notdir $(renderscript_sources)))))
|
2015-04-04 01:15:28 +02:00
|
|
|
|
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)
|
2018-05-16 18:53:40 +02:00
|
|
|
$(RenderScript_file_stamp): PRIVATE_RS_TARGET_API := $(patsubst current,0,$(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)
|
|
|
|
|
2016-11-11 03:19:36 +01:00
|
|
|
# include the dependency files (.d) generated by llvm-rs-cc.
|
|
|
|
$(call include-depfile,$(RenderScript_file_stamp).d,$(RenderScript_file_stamp))
|
2012-10-30 00:06:00 +01:00
|
|
|
|
|
|
|
LOCAL_INTERMEDIATE_TARGETS += $(RenderScript_file_stamp)
|
|
|
|
|
|
|
|
rs_generated_cpps := $(addprefix \
|
2019-07-12 17:33:31 +02:00
|
|
|
$(renderscript_intermediate)/ScriptC_,$(patsubst %.fs,%.cpp, $(patsubst %.rscript,%.cpp, \
|
2012-10-30 00:06:00 +01:00
|
|
|
$(notdir $(renderscript_sources)))))
|
|
|
|
|
2016-01-20 05:07:08 +01:00
|
|
|
$(call track-src-file-gen,$(renderscript_sources),$(rs_generated_cpps))
|
|
|
|
|
2020-07-30 00:15:33 +02:00
|
|
|
# This is just a no-op 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 $@."
|
2015-02-27 03:47:21 +01:00
|
|
|
$(hide) touch $@
|
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
|
|
|
|
|
|
|
|
|
2014-05-07 00:45:57 +02: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
|
|
|
###########################################################
|
2017-10-08 05:44:05 +02:00
|
|
|
ifeq ($(strip $(LOCAL_PROTOC_OPTIMIZE_TYPE)),)
|
|
|
|
LOCAL_PROTOC_OPTIMIZE_TYPE := lite
|
|
|
|
endif
|
2014-01-24 00:09:04 +01:00
|
|
|
proto_sources := $(filter %.proto,$(my_src_files))
|
2010-11-03 02:43:16 +01:00
|
|
|
ifneq ($(proto_sources),)
|
2016-05-06 05:02:08 +02:00
|
|
|
proto_gen_dir := $(generated_sources_dir)/proto
|
2016-04-05 10:34:51 +02:00
|
|
|
proto_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(proto_sources))
|
2015-04-07 20:59:34 +02:00
|
|
|
|
2016-05-06 05:02:08 +02:00
|
|
|
my_rename_cpp_ext :=
|
2019-01-26 02:11:02 +01:00
|
|
|
ifneq (,$(filter nanopb-c nanopb-c-enable_malloc nanopb-c-16bit nanopb-c-enable_malloc-16bit nanopb-c-32bit nanopb-c-enable_malloc-32bit, $(LOCAL_PROTOC_OPTIMIZE_TYPE)))
|
2015-04-07 20:59:34 +02:00
|
|
|
my_proto_source_suffix := .c
|
|
|
|
my_proto_c_includes := external/nanopb-c
|
2016-05-06 05:02:08 +02:00
|
|
|
my_protoc_flags := --nanopb_out=$(proto_gen_dir) \
|
2018-08-04 01:48:10 +02:00
|
|
|
--plugin=$(HOST_OUT_EXECUTABLES)/protoc-gen-nanopb
|
2016-04-05 10:34:51 +02:00
|
|
|
my_protoc_deps := $(NANOPB_SRCS) $(proto_sources_fullpath:%.proto=%.options)
|
2015-04-07 20:59:34 +02:00
|
|
|
else
|
2016-05-06 05:02:08 +02:00
|
|
|
my_proto_source_suffix := $(LOCAL_CPP_EXTENSION)
|
|
|
|
ifneq ($(my_proto_source_suffix),.cc)
|
|
|
|
# aprotoc is hardcoded to write out only .cc file.
|
|
|
|
# We need to rename the extension to $(LOCAL_CPP_EXTENSION) if it's not .cc.
|
|
|
|
my_rename_cpp_ext := true
|
|
|
|
endif
|
2015-04-07 20:59:34 +02:00
|
|
|
my_proto_c_includes := external/protobuf/src
|
|
|
|
my_cflags += -DGOOGLE_PROTOBUF_NO_RTTI
|
2017-10-08 05:44:05 +02:00
|
|
|
my_protoc_flags := --cpp_out=$(if $(filter lite lite-static,$(LOCAL_PROTOC_OPTIMIZE_TYPE)),lite:,)$(proto_gen_dir)
|
2016-04-05 10:34:51 +02:00
|
|
|
my_protoc_deps :=
|
2015-04-07 20:59:34 +02:00
|
|
|
endif
|
2016-05-06 05:02:08 +02:00
|
|
|
my_proto_c_includes += $(proto_gen_dir)
|
2015-04-07 20:59:34 +02:00
|
|
|
|
2016-05-06 05:02:08 +02:00
|
|
|
proto_generated_cpps := $(addprefix $(proto_gen_dir)/, \
|
2015-04-07 20:59:34 +02:00
|
|
|
$(patsubst %.proto,%.pb$(my_proto_source_suffix),$(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.
|
2016-05-06 05:02:08 +02:00
|
|
|
ifndef $(my_host)$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_proto_defined
|
|
|
|
$(proto_generated_cpps): PRIVATE_PROTO_INCLUDES := $(TOP)
|
|
|
|
$(proto_generated_cpps): PRIVATE_PROTOC_FLAGS := $(LOCAL_PROTOC_FLAGS) $(my_protoc_flags)
|
|
|
|
$(proto_generated_cpps): PRIVATE_RENAME_CPP_EXT := $(my_rename_cpp_ext)
|
|
|
|
$(proto_generated_cpps): $(proto_gen_dir)/%.pb$(my_proto_source_suffix): %.proto $(my_protoc_deps) $(PROTOC)
|
2010-11-03 02:43:16 +01:00
|
|
|
$(transform-proto-to-cc)
|
|
|
|
|
2016-05-06 05:02:08 +02:00
|
|
|
$(my_host)$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_proto_defined := true
|
2015-04-07 20:59:34 +02:00
|
|
|
endif
|
2016-05-06 05:02:08 +02:00
|
|
|
# Ideally we can generate the source directly into $(intermediates).
|
|
|
|
# But many Android.mks assume the .pb.hs are in $(generated_sources_dir).
|
|
|
|
# As a workaround, we make a copy in the $(intermediates).
|
|
|
|
proto_intermediate_dir := $(intermediates)/proto
|
|
|
|
proto_intermediate_cpps := $(patsubst $(proto_gen_dir)/%,$(proto_intermediate_dir)/%,\
|
|
|
|
$(proto_generated_cpps))
|
|
|
|
$(proto_intermediate_cpps) : $(proto_intermediate_dir)/% : $(proto_gen_dir)/%
|
|
|
|
@echo "Copy: $@"
|
|
|
|
$(copy-file-to-target)
|
|
|
|
$(hide) cp $(basename $<).h $(basename $@).h
|
|
|
|
$(call track-src-file-gen,$(proto_sources),$(proto_intermediate_cpps))
|
|
|
|
|
|
|
|
my_generated_sources += $(proto_intermediate_cpps)
|
2010-11-03 02:43:16 +01:00
|
|
|
|
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
|
2019-01-26 02:11:02 +01:00
|
|
|
else ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nanopb-c-enable_malloc-16bit)
|
|
|
|
my_static_libraries += libprotobuf-c-nano-enable_malloc-16bit
|
|
|
|
else ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nanopb-c-16bit)
|
|
|
|
my_static_libraries += libprotobuf-c-nano-16bit
|
|
|
|
else ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nanopb-c-enable_malloc-32bit)
|
|
|
|
my_static_libraries += libprotobuf-c-nano-enable_malloc-32bit
|
|
|
|
else ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nanopb-c-32bit)
|
|
|
|
my_static_libraries += libprotobuf-c-nano-32bit
|
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
|
2016-06-08 04:21:12 +02:00
|
|
|
else ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),lite-static)
|
|
|
|
my_static_libraries += libprotobuf-cpp-lite
|
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-10-15 02:27:24 +02:00
|
|
|
###########################################################
|
|
|
|
## AIDL: Compile .aidl files to .cpp and .h files
|
|
|
|
###########################################################
|
|
|
|
aidl_src := $(strip $(filter %.aidl,$(my_src_files)))
|
|
|
|
aidl_gen_cpp :=
|
|
|
|
ifneq ($(aidl_src),)
|
|
|
|
|
2016-01-19 17:58:35 +01:00
|
|
|
# Use the intermediates directory to avoid writing our own .cpp -> .o rules.
|
2015-10-15 02:27:24 +02:00
|
|
|
aidl_gen_cpp_root := $(intermediates)/aidl-generated/src
|
|
|
|
aidl_gen_include_root := $(intermediates)/aidl-generated/include
|
|
|
|
|
2016-01-19 17:58:35 +01:00
|
|
|
# Multi-architecture builds have distinct intermediates directories.
|
|
|
|
# Thus we'll actually generate source for each architecture.
|
|
|
|
$(foreach s,$(aidl_src),\
|
|
|
|
$(eval $(call define-aidl-cpp-rule,$(s),$(aidl_gen_cpp_root),aidl_gen_cpp)))
|
2016-01-19 18:26:10 +01:00
|
|
|
$(foreach cpp,$(aidl_gen_cpp), \
|
2016-11-13 18:42:19 +01:00
|
|
|
$(call include-depfile,$(addsuffix .aidl.d,$(basename $(cpp))),$(cpp)))
|
2016-01-20 05:07:08 +01:00
|
|
|
$(call track-src-file-gen,$(aidl_src),$(aidl_gen_cpp))
|
2015-10-15 02:27:24 +02:00
|
|
|
|
|
|
|
$(aidl_gen_cpp) : PRIVATE_MODULE := $(LOCAL_MODULE)
|
|
|
|
$(aidl_gen_cpp) : PRIVATE_HEADER_OUTPUT_DIR := $(aidl_gen_include_root)
|
|
|
|
$(aidl_gen_cpp) : PRIVATE_AIDL_FLAGS := $(addprefix -I,$(LOCAL_AIDL_INCLUDES))
|
|
|
|
|
2015-11-19 16:06:01 +01:00
|
|
|
# Add generated headers to include paths.
|
2015-10-15 02:27:24 +02:00
|
|
|
my_c_includes += $(aidl_gen_include_root)
|
2015-11-19 16:06:01 +01:00
|
|
|
my_export_c_include_dirs += $(aidl_gen_include_root)
|
2015-10-15 02:27:24 +02:00
|
|
|
# Pick up the generated C++ files later for transformation to .o files.
|
|
|
|
my_generated_sources += $(aidl_gen_cpp)
|
|
|
|
|
|
|
|
endif # $(aidl_src) non-empty
|
|
|
|
|
2016-02-19 20:06:58 +01:00
|
|
|
###########################################################
|
|
|
|
## Compile the .vts files to .cc (or .c) and then to .o
|
|
|
|
###########################################################
|
|
|
|
|
|
|
|
vts_src := $(strip $(filter %.vts,$(my_src_files)))
|
|
|
|
vts_gen_cpp :=
|
|
|
|
ifneq ($(vts_src),)
|
2016-08-26 22:27:13 +02:00
|
|
|
my_soong_problems += vts
|
2016-02-19 20:06:58 +01:00
|
|
|
|
|
|
|
# Use the intermediates directory to avoid writing our own .cpp -> .o rules.
|
|
|
|
vts_gen_cpp_root := $(intermediates)/vts-generated/src
|
|
|
|
vts_gen_include_root := $(intermediates)/vts-generated/include
|
|
|
|
|
|
|
|
# Multi-architecture builds have distinct intermediates directories.
|
|
|
|
# Thus we'll actually generate source for each architecture.
|
|
|
|
$(foreach s,$(vts_src),\
|
|
|
|
$(eval $(call define-vts-cpp-rule,$(s),$(vts_gen_cpp_root),vts_gen_cpp)))
|
|
|
|
$(call track-src-file-gen,$(vts_src),$(vts_gen_cpp))
|
|
|
|
|
|
|
|
$(vts_gen_cpp) : PRIVATE_MODULE := $(LOCAL_MODULE)
|
|
|
|
$(vts_gen_cpp) : PRIVATE_HEADER_OUTPUT_DIR := $(vts_gen_include_root)
|
2016-09-09 03:30:28 +02:00
|
|
|
$(vts_gen_cpp) : PRIVATE_VTS_FLAGS := $(addprefix -I,$(LOCAL_VTS_INCLUDES)) $(addprefix -m,$(LOCAL_VTS_MODE))
|
2016-02-19 20:06:58 +01:00
|
|
|
|
|
|
|
# Add generated headers to include paths.
|
|
|
|
my_c_includes += $(vts_gen_include_root)
|
|
|
|
my_export_c_include_dirs += $(vts_gen_include_root)
|
|
|
|
# Pick up the generated C++ files later for transformation to .o files.
|
|
|
|
my_generated_sources += $(vts_gen_cpp)
|
|
|
|
|
|
|
|
endif # $(vts_src) non-empty
|
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
###########################################################
|
2016-01-12 01:28:45 +01:00
|
|
|
## YACC: Compile .y/.yy files to .c/.cpp and then 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))
|
2016-01-12 01:28:45 +01:00
|
|
|
y_yacc_cs := $(addprefix \
|
|
|
|
$(intermediates)/,$(y_yacc_sources:.y=.c))
|
|
|
|
ifneq ($(y_yacc_cs),)
|
|
|
|
$(y_yacc_cs): $(intermediates)/%.c: \
|
2020-01-09 07:31:12 +01:00
|
|
|
$(TOPDIR)$(LOCAL_PATH)/%.y $(BISON) $(BISON_DATA) $(M4) \
|
2016-01-12 01:28:45 +01:00
|
|
|
$(my_additional_dependencies)
|
|
|
|
$(call transform-y-to-c-or-cpp)
|
2016-01-20 05:07:08 +01:00
|
|
|
$(call track-src-file-gen,$(y_yacc_sources),$(y_yacc_cs))
|
2016-01-12 01:28:45 +01:00
|
|
|
|
|
|
|
my_generated_sources += $(y_yacc_cs)
|
|
|
|
endif
|
2014-03-03 16:57:06 +01:00
|
|
|
|
|
|
|
yy_yacc_sources := $(filter %.yy,$(my_src_files))
|
|
|
|
yy_yacc_cpps := $(addprefix \
|
|
|
|
$(intermediates)/,$(yy_yacc_sources:.yy=$(LOCAL_CPP_EXTENSION)))
|
2016-01-12 01:28:45 +01:00
|
|
|
ifneq ($(yy_yacc_cpps),)
|
2014-03-03 16:57:06 +01:00
|
|
|
$(yy_yacc_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
|
2020-01-09 07:31:12 +01:00
|
|
|
$(TOPDIR)$(LOCAL_PATH)/%.yy $(BISON) $(BISON_DATA) $(M4) \
|
2016-01-12 01:28:45 +01:00
|
|
|
$(my_additional_dependencies)
|
|
|
|
$(call transform-y-to-c-or-cpp)
|
2016-01-20 05:07:08 +01:00
|
|
|
$(call track-src-file-gen,$(yy_yacc_sources),$(yy_yacc_cpps))
|
2009-03-04 04:28:42 +01:00
|
|
|
|
2016-01-12 01:28:45 +01:00
|
|
|
my_generated_sources += $(yy_yacc_cpps)
|
2009-03-04 04:28:42 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
###########################################################
|
2016-01-12 01:28:45 +01:00
|
|
|
## LEX: Compile .l/.ll files to .c/.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))
|
2016-01-12 01:28:45 +01:00
|
|
|
l_lex_cs := $(addprefix \
|
|
|
|
$(intermediates)/,$(l_lex_sources:.l=.c))
|
|
|
|
ifneq ($(l_lex_cs),)
|
2020-01-09 07:31:12 +01:00
|
|
|
$(l_lex_cs): $(LEX) $(M4)
|
2016-01-12 01:28:45 +01:00
|
|
|
$(l_lex_cs): $(intermediates)/%.c: \
|
|
|
|
$(TOPDIR)$(LOCAL_PATH)/%.l
|
|
|
|
$(transform-l-to-c-or-cpp)
|
2016-01-20 05:07:08 +01:00
|
|
|
$(call track-src-file-gen,$(l_lex_sources),$(l_lex_cs))
|
2016-01-12 01:28:45 +01:00
|
|
|
|
|
|
|
my_generated_sources += $(l_lex_cs)
|
|
|
|
endif
|
2014-03-03 16:57:06 +01:00
|
|
|
|
|
|
|
ll_lex_sources := $(filter %.ll,$(my_src_files))
|
|
|
|
ll_lex_cpps := $(addprefix \
|
|
|
|
$(intermediates)/,$(ll_lex_sources:.ll=$(LOCAL_CPP_EXTENSION)))
|
2016-01-12 01:28:45 +01:00
|
|
|
ifneq ($(ll_lex_cpps),)
|
2020-01-09 07:31:12 +01:00
|
|
|
$(ll_lex_cpps): $(LEX) $(M4)
|
2014-03-03 16:57:06 +01:00
|
|
|
$(ll_lex_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
|
|
|
|
$(TOPDIR)$(LOCAL_PATH)/%.ll
|
2016-01-12 01:28:45 +01:00
|
|
|
$(transform-l-to-c-or-cpp)
|
2016-01-20 05:07:08 +01:00
|
|
|
$(call track-src-file-gen,$(ll_lex_sources),$(ll_lex_cpps))
|
2014-03-03 16:57:06 +01:00
|
|
|
|
2016-01-12 01:28:45 +01:00
|
|
|
my_generated_sources += $(ll_lex_cpps)
|
2009-03-04 04:28:42 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
###########################################################
|
|
|
|
## C++: Compile .cpp files to .o.
|
|
|
|
###########################################################
|
|
|
|
|
2019-01-25 23:35:58 +01:00
|
|
|
ifneq ($(filter %$(LOCAL_CPP_EXTENSION).arm,$(my_src_files)),)
|
|
|
|
$(call pretty-error,Files ending in $(LOCAL_CPP_EXTENSION).arm are deprecated. See $(CHANGES_URL)#file_arm)
|
|
|
|
endif
|
2015-03-11 02:03:11 +01:00
|
|
|
|
|
|
|
dotdot_sources := $(filter ../%$(LOCAL_CPP_EXTENSION),$(my_src_files))
|
|
|
|
dotdot_objects :=
|
|
|
|
$(foreach s,$(dotdot_sources),\
|
|
|
|
$(eval $(call compile-dotdot-cpp-file,$(s),\
|
2016-05-06 05:02:08 +02:00
|
|
|
$(my_additional_dependencies),\
|
2019-11-12 01:04:34 +01:00
|
|
|
dotdot_objects,\
|
|
|
|
$(my_pool))))
|
2016-01-20 05:07:08 +01:00
|
|
|
$(call track-src-file-obj,$(dotdot_sources),$(dotdot_objects))
|
2015-03-11 02:03:11 +01:00
|
|
|
|
|
|
|
cpp_normal_sources := $(filter-out ../%,$(filter %$(LOCAL_CPP_EXTENSION),$(my_src_files)))
|
2019-01-25 23:35:58 +01:00
|
|
|
cpp_objects := $(addprefix $(intermediates)/,$(cpp_normal_sources:$(LOCAL_CPP_EXTENSION)=.o))
|
|
|
|
$(call track-src-file-obj,$(cpp_normal_sources),$(cpp_objects))
|
2009-03-04 04:28:42 +01:00
|
|
|
|
2019-01-25 23:35:58 +01:00
|
|
|
$(dotdot_objects) $(cpp_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
|
|
|
|
$(dotdot_objects) $(cpp_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
|
2009-03-04 04:28:42 +01:00
|
|
|
|
|
|
|
ifneq ($(strip $(cpp_objects)),)
|
2019-11-12 01:04:34 +01:00
|
|
|
$(cpp_objects): .KATI_NINJA_POOL := $(my_pool)
|
2009-03-04 04:28:42 +01:00
|
|
|
$(cpp_objects): $(intermediates)/%.o: \
|
2012-03-22 19:26:22 +01:00
|
|
|
$(TOPDIR)$(LOCAL_PATH)/%$(LOCAL_CPP_EXTENSION) \
|
2019-06-12 07:59:53 +02:00
|
|
|
$(my_additional_dependencies) $(CLANG_CXX)
|
2009-03-04 04:28:42 +01:00
|
|
|
$(transform-$(PRIVATE_HOST)cpp-to-o)
|
2016-03-03 10:12:52 +01:00
|
|
|
$(call include-depfiles-for-objs, $(cpp_objects))
|
2009-03-04 04:28:42 +01:00
|
|
|
endif
|
|
|
|
|
2019-01-25 23:35:58 +01:00
|
|
|
cpp_objects += $(dotdot_objects)
|
2015-03-11 02:03:11 +01:00
|
|
|
|
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)
|
2016-01-20 05:07:08 +01:00
|
|
|
$(call track-gen-file-obj,$(gen_cpp_sources),$(gen_cpp_objects))
|
2009-03-04 04:28:42 +01:00
|
|
|
|
|
|
|
ifneq ($(strip $(gen_cpp_objects)),)
|
|
|
|
# Compile all generated files as thumb.
|
2019-11-12 01:04:34 +01:00
|
|
|
$(gen_cpp_objects): .KATI_NINJA_POOL := $(my_pool)
|
2009-03-04 04:28:42 +01:00
|
|
|
$(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: \
|
2016-05-06 05:02:08 +02:00
|
|
|
$(intermediates)/%$(LOCAL_CPP_EXTENSION) \
|
2019-06-12 07:59:53 +02:00
|
|
|
$(my_additional_dependencies) $(CLANG_CXX)
|
2009-03-04 04:28:42 +01:00
|
|
|
$(transform-$(PRIVATE_HOST)cpp-to-o)
|
2016-03-03 10:12:52 +01:00
|
|
|
$(call include-depfiles-for-objs, $(gen_cpp_objects))
|
2009-03-04 04:28:42 +01:00
|
|
|
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)
|
2016-01-20 05:07:08 +01:00
|
|
|
$(call track-gen-file-obj,$(gen_S_sources),$(gen_S_objects))
|
2009-03-04 04:28:42 +01:00
|
|
|
|
|
|
|
ifneq ($(strip $(gen_S_sources)),)
|
2019-11-12 01:04:34 +01:00
|
|
|
$(gen_S_objects): .KATI_NINJA_POOL := $(my_pool)
|
2012-03-20 15:00:16 +01:00
|
|
|
$(gen_S_objects): $(intermediates)/%.o: $(intermediates)/%.S \
|
2019-06-12 07:59:53 +02:00
|
|
|
$(my_additional_dependencies) $(CLANG)
|
2009-03-04 04:28:42 +01:00
|
|
|
$(transform-$(PRIVATE_HOST)s-to-o)
|
2016-03-03 10:12:52 +01:00
|
|
|
$(call include-depfiles-for-objs, $(gen_S_objects))
|
2009-03-04 04:28:42 +01:00
|
|
|
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)
|
2016-01-20 05:07:08 +01:00
|
|
|
$(call track-gen-file-obj,$(gen_s_sources),$(gen_s_objects))
|
2009-03-04 04:28:42 +01:00
|
|
|
|
|
|
|
ifneq ($(strip $(gen_s_objects)),)
|
2019-11-12 01:04:34 +01:00
|
|
|
$(gen_s_objects): .KATI_NINJA_POOL := $(my_pool)
|
2012-03-20 15:00:16 +01:00
|
|
|
$(gen_s_objects): $(intermediates)/%.o: $(intermediates)/%.s \
|
2019-06-12 07:59:53 +02:00
|
|
|
$(my_additional_dependencies) $(CLANG)
|
2016-11-11 03:19:36 +01:00
|
|
|
$(transform-$(PRIVATE_HOST)s-to-o)
|
2009-03-04 04:28:42 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
gen_asm_objects := $(gen_S_objects) $(gen_s_objects)
|
2016-01-16 01:38:46 +01:00
|
|
|
$(gen_asm_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
|
2009-03-04 04:28:42 +01:00
|
|
|
|
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.
|
|
|
|
###########################################################
|
|
|
|
|
2019-01-25 23:35:58 +01:00
|
|
|
ifneq ($(filter %.c.arm,$(my_src_files)),)
|
|
|
|
$(call pretty-error,Files ending in .c.arm are deprecated. See $(CHANGES_URL)#file_arm)
|
|
|
|
endif
|
2015-03-11 02:03:11 +01:00
|
|
|
|
|
|
|
dotdot_sources := $(filter ../%.c, $(my_src_files))
|
|
|
|
dotdot_objects :=
|
|
|
|
$(foreach s, $(dotdot_sources),\
|
|
|
|
$(eval $(call compile-dotdot-c-file,$(s),\
|
2016-05-06 05:02:08 +02:00
|
|
|
$(my_additional_dependencies),\
|
2019-11-12 01:04:34 +01:00
|
|
|
dotdot_objects,\
|
|
|
|
$(my_pool))))
|
2016-01-20 05:07:08 +01:00
|
|
|
$(call track-src-file-obj,$(dotdot_sources),$(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)))
|
2019-01-25 23:35:58 +01:00
|
|
|
c_objects := $(addprefix $(intermediates)/,$(c_normal_sources:.c=.o))
|
|
|
|
$(call track-src-file-obj,$(c_normal_sources),$(c_objects))
|
2009-03-04 04:28:42 +01:00
|
|
|
|
2019-01-25 23:35:58 +01:00
|
|
|
$(dotdot_objects) $(c_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
|
|
|
|
$(dotdot_objects) $(c_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
|
2009-03-04 04:28:42 +01:00
|
|
|
|
|
|
|
ifneq ($(strip $(c_objects)),)
|
2019-11-12 01:04:34 +01:00
|
|
|
$(c_objects): .KATI_NINJA_POOL := $(my_pool)
|
2016-05-06 05:02:08 +02:00
|
|
|
$(c_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.c \
|
2019-06-12 07:59:53 +02:00
|
|
|
$(my_additional_dependencies) $(CLANG)
|
2009-03-04 04:28:42 +01:00
|
|
|
$(transform-$(PRIVATE_HOST)c-to-o)
|
2016-03-03 10:12:52 +01:00
|
|
|
$(call include-depfiles-for-objs, $(c_objects))
|
2009-03-04 04:28:42 +01:00
|
|
|
endif
|
|
|
|
|
2019-01-25 23:35:58 +01:00
|
|
|
c_objects += $(dotdot_objects)
|
2015-03-11 02:03:11 +01:00
|
|
|
|
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)
|
2016-01-20 05:07:08 +01:00
|
|
|
$(call track-gen-file-obj,$(gen_c_sources),$(gen_c_objects))
|
2009-05-04 23:32:44 +02:00
|
|
|
|
|
|
|
ifneq ($(strip $(gen_c_objects)),)
|
|
|
|
# Compile all generated files as thumb.
|
2019-11-12 01:04:34 +01:00
|
|
|
$(gen_c_objects): .KATI_NINJA_POOL := $(my_pool)
|
2009-05-04 23:32:44 +02:00
|
|
|
$(gen_c_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
|
|
|
|
$(gen_c_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
|
2016-05-06 05:02:08 +02:00
|
|
|
$(gen_c_objects): $(intermediates)/%.o: $(intermediates)/%.c \
|
2019-06-12 07:59:53 +02:00
|
|
|
$(my_additional_dependencies) $(CLANG)
|
2009-05-04 23:32:44 +02:00
|
|
|
$(transform-$(PRIVATE_HOST)c-to-o)
|
2016-03-03 10:12:52 +01:00
|
|
|
$(call include-depfiles-for-objs, $(gen_c_objects))
|
2009-05-04 23:32:44 +02:00
|
|
|
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))
|
2016-02-02 03:55:23 +01:00
|
|
|
$(call track-src-file-obj,$(objc_sources),$(objc_objects))
|
2009-05-14 16:00:09 +02:00
|
|
|
|
|
|
|
ifneq ($(strip $(objc_objects)),)
|
2016-08-26 22:27:13 +02:00
|
|
|
my_soong_problems += objc
|
2019-11-12 01:04:34 +01:00
|
|
|
$(objc_objects): .KATI_NINJA_POOL := $(my_pool)
|
2016-05-06 05:02:08 +02:00
|
|
|
$(objc_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.m \
|
2019-06-12 07:59:53 +02:00
|
|
|
$(my_additional_dependencies) $(CLANG)
|
2009-05-14 16:00:09 +02:00
|
|
|
$(transform-$(PRIVATE_HOST)m-to-o)
|
2016-03-03 10:12:52 +01:00
|
|
|
$(call include-depfiles-for-objs, $(objc_objects))
|
2009-05-14 16:00:09 +02:00
|
|
|
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))
|
2016-02-02 03:55:23 +01:00
|
|
|
$(call track-src-file-obj,$(objcpp_sources),$(objcpp_objects))
|
2015-09-18 00:40:49 +02:00
|
|
|
|
|
|
|
ifneq ($(strip $(objcpp_objects)),)
|
2019-11-12 01:04:34 +01:00
|
|
|
$(objcpp_objects): .KATI_NINJA_POOL := $(my_pool)
|
2016-05-06 05:02:08 +02:00
|
|
|
$(objcpp_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.mm \
|
2019-06-12 07:59:53 +02:00
|
|
|
$(my_additional_dependencies) $(CLANG_CXX)
|
2015-09-18 00:40:49 +02:00
|
|
|
$(transform-$(PRIVATE_HOST)mm-to-o)
|
2016-03-03 10:12:52 +01:00
|
|
|
$(call include-depfiles-for-objs, $(objcpp_objects))
|
2015-09-18 00:40:49 +02:00
|
|
|
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))
|
2016-01-20 05:07:08 +01:00
|
|
|
$(call track-src-file-obj,$(asm_sources_S),$(asm_objects_S))
|
2009-03-04 04:28:42 +01:00
|
|
|
|
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),\
|
2019-11-12 01:04:34 +01:00
|
|
|
dotdot_objects_S,\
|
|
|
|
$(my_pool))))
|
2016-01-20 05:07:08 +01:00
|
|
|
$(call track-src-file-obj,$(dotdot_sources),$(dotdot_objects_S))
|
2015-03-11 02:03:11 +01:00
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
ifneq ($(strip $(asm_objects_S)),)
|
2019-11-12 01:04:34 +01:00
|
|
|
$(asm_objects_S): .KATI_NINJA_POOL := $(my_pool)
|
2012-03-20 15:00:16 +01:00
|
|
|
$(asm_objects_S): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.S \
|
2019-06-12 07:59:53 +02:00
|
|
|
$(my_additional_dependencies) $(CLANG)
|
2009-03-04 04:28:42 +01:00
|
|
|
$(transform-$(PRIVATE_HOST)s-to-o)
|
2016-03-15 22:40:04 +01:00
|
|
|
$(call include-depfiles-for-objs, $(asm_objects_S))
|
2009-03-04 04:28:42 +01:00
|
|
|
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))
|
2016-01-20 05:07:08 +01:00
|
|
|
$(call track-src-file-obj,$(asm_sources_s),$(asm_objects_s))
|
2009-03-04 04:28:42 +01:00
|
|
|
|
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),\
|
2019-11-12 01:04:34 +01:00
|
|
|
dotdot_objects_s,\
|
|
|
|
$(my_pool))))
|
2016-01-20 05:07:08 +01:00
|
|
|
$(call track-src-file-obj,$(dotdot_sources),$(dotdot_objects_s))
|
2015-03-11 02:03:11 +01:00
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
ifneq ($(strip $(asm_objects_s)),)
|
2019-11-12 01:04:34 +01:00
|
|
|
$(asm_objects_s): .KATI_NINJA_POOL := $(my_pool)
|
2012-03-20 15:00:16 +01:00
|
|
|
$(asm_objects_s): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.s \
|
2019-06-12 07:59:53 +02:00
|
|
|
$(my_additional_dependencies) $(CLANG)
|
2016-11-11 03:19:36 +01:00
|
|
|
$(transform-$(PRIVATE_HOST)s-to-o)
|
2009-03-04 04:28:42 +01:00
|
|
|
endif
|
|
|
|
|
2015-03-11 02:03:11 +01:00
|
|
|
asm_objects := $(dotdot_objects_S) $(dotdot_objects_s) $(asm_objects_S) $(asm_objects_s)
|
2016-01-16 01:38:46 +01:00
|
|
|
$(asm_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
|
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 \
|
2019-06-12 07:59:53 +02:00
|
|
|
$(my_additional_dependencies) $(YASM)
|
2014-06-06 04:05:47 +02:00
|
|
|
$(transform-asm-to-o)
|
2016-01-20 05:07:08 +01:00
|
|
|
$(call track-src-file-obj,$(asm_sources_asm),$(asm_objects_asm))
|
2014-06-06 04:05:47 +02:00
|
|
|
|
|
|
|
asm_objects += $(asm_objects_asm)
|
|
|
|
endif
|
|
|
|
|
2017-11-17 20:19:36 +01:00
|
|
|
###################################################################
|
2020-08-03 17:51:33 +02:00
|
|
|
## Convert to sanitized names where they exist.
|
|
|
|
## These lists come from sanitizerStaticLibsMap; see
|
|
|
|
## build/soong/cc/sanitize.go
|
|
|
|
##
|
|
|
|
## $(1): list of static dependencies
|
|
|
|
## $(2): name of sanitizer (e.g. cfi, hwasan)
|
2017-11-17 20:19:36 +01:00
|
|
|
##################################################################
|
2020-08-03 17:51:33 +02:00
|
|
|
define use_soong_sanitized_static_libraries
|
|
|
|
$(foreach lib,$(1),$(if $(filter $(lib),\
|
|
|
|
$(SOONG_$(2)_$(my_image_variant)_$(my_arch)_STATIC_LIBRARIES)),\
|
|
|
|
$(lib).$(2),$(lib)))
|
2017-11-17 20:19:36 +01:00
|
|
|
endef
|
|
|
|
|
2020-08-03 17:51:33 +02:00
|
|
|
###################################################################
|
|
|
|
## When compiling a CFI enabled target, use the .cfi variant of any
|
|
|
|
## static dependencies (where they exist).
|
|
|
|
##################################################################
|
2017-11-17 20:19:36 +01:00
|
|
|
ifneq ($(filter cfi,$(my_sanitize)),)
|
2020-08-03 17:51:33 +02:00
|
|
|
my_whole_static_libraries := $(call use_soong_sanitized_static_libraries,\
|
|
|
|
$(my_whole_static_libraries),cfi)
|
|
|
|
my_static_libraries := $(call use_soong_sanitized_static_libraries,\
|
|
|
|
$(my_static_libraries),cfi)
|
2017-11-17 20:19:36 +01:00
|
|
|
endif
|
|
|
|
|
2020-08-03 17:51:33 +02:00
|
|
|
###################################################################
|
|
|
|
## When compiling a hwasan enabled target, use the .hwasan variant
|
|
|
|
## of any static dependencies (where they exist).
|
|
|
|
##################################################################
|
2018-07-27 20:54:32 +02:00
|
|
|
ifneq ($(filter hwaddress,$(my_sanitize)),)
|
2020-08-03 17:51:33 +02:00
|
|
|
my_whole_static_libraries := $(call use_soong_sanitized_static_libraries,\
|
|
|
|
$(my_whole_static_libraries),hwasan)
|
|
|
|
my_static_libraries := $(call use_soong_sanitized_static_libraries,\
|
|
|
|
$(my_static_libraries),hwasan)
|
2018-07-27 20:54:32 +02:00
|
|
|
endif
|
|
|
|
|
2017-04-18 13:15:14 +02:00
|
|
|
###########################################################
|
|
|
|
## When compiling against the VNDK, use LL-NDK libraries
|
|
|
|
###########################################################
|
|
|
|
ifneq ($(LOCAL_USE_VNDK),)
|
2020-01-20 10:57:01 +01:00
|
|
|
#####################################################
|
|
|
|
## Soong modules may be built three times, once for
|
|
|
|
## /system, once for /vendor and once for /product.
|
|
|
|
## If we're using the VNDK, switch all soong
|
|
|
|
## libraries over to the /vendor or /product variant.
|
|
|
|
#####################################################
|
|
|
|
ifeq ($(LOCAL_USE_VNDK_PRODUCT),true)
|
|
|
|
my_whole_static_libraries := $(foreach l,$(my_whole_static_libraries),\
|
|
|
|
$(if $(SPLIT_PRODUCT.STATIC_LIBRARIES.$(l)),$(l).product,$(l)))
|
|
|
|
my_static_libraries := $(foreach l,$(my_static_libraries),\
|
|
|
|
$(if $(SPLIT_PRODUCT.STATIC_LIBRARIES.$(l)),$(l).product,$(l)))
|
|
|
|
my_shared_libraries := $(foreach l,$(my_shared_libraries),\
|
|
|
|
$(if $(SPLIT_PRODUCT.SHARED_LIBRARIES.$(l)),$(l).product,$(l)))
|
|
|
|
my_system_shared_libraries := $(foreach l,$(my_system_shared_libraries),\
|
|
|
|
$(if $(SPLIT_PRODUCT.SHARED_LIBRARIES.$(l)),$(l).product,$(l)))
|
|
|
|
my_header_libraries := $(foreach l,$(my_header_libraries),\
|
|
|
|
$(if $(SPLIT_PRODUCT.HEADER_LIBRARIES.$(l)),$(l).product,$(l)))
|
|
|
|
else
|
|
|
|
my_whole_static_libraries := $(foreach l,$(my_whole_static_libraries),\
|
|
|
|
$(if $(SPLIT_VENDOR.STATIC_LIBRARIES.$(l)),$(l).vendor,$(l)))
|
|
|
|
my_static_libraries := $(foreach l,$(my_static_libraries),\
|
|
|
|
$(if $(SPLIT_VENDOR.STATIC_LIBRARIES.$(l)),$(l).vendor,$(l)))
|
|
|
|
my_shared_libraries := $(foreach l,$(my_shared_libraries),\
|
|
|
|
$(if $(SPLIT_VENDOR.SHARED_LIBRARIES.$(l)),$(l).vendor,$(l)))
|
|
|
|
my_system_shared_libraries := $(foreach l,$(my_system_shared_libraries),\
|
|
|
|
$(if $(SPLIT_VENDOR.SHARED_LIBRARIES.$(l)),$(l).vendor,$(l)))
|
|
|
|
my_header_libraries := $(foreach l,$(my_header_libraries),\
|
|
|
|
$(if $(SPLIT_VENDOR.HEADER_LIBRARIES.$(l)),$(l).vendor,$(l)))
|
|
|
|
endif
|
2017-04-18 13:15:14 +02:00
|
|
|
endif
|
2015-01-09 03:25:30 +01:00
|
|
|
|
2018-03-19 10:12:39 +01:00
|
|
|
# Platform can use vendor public libraries. If a required shared lib is one of
|
|
|
|
# the vendor public libraries, the lib is switched to the stub version of the lib.
|
|
|
|
ifeq ($(LOCAL_USE_VNDK),)
|
2018-09-07 01:25:22 +02:00
|
|
|
my_shared_libraries := $(foreach l,$(my_shared_libraries),\
|
|
|
|
$(if $(filter $(l),$(VENDOR_PUBLIC_LIBRARIES)),$(l).vendorpublic,$(l)))
|
2018-03-19 10:12:39 +01:00
|
|
|
endif
|
|
|
|
|
2020-04-07 18:50:32 +02:00
|
|
|
###########################################################
|
|
|
|
## When compiling against the NDK, use SDK variants of Soong libraries
|
|
|
|
###########################################################
|
|
|
|
|
|
|
|
ifneq ($(LOCAL_SDK_VERSION),)
|
|
|
|
my_whole_static_libraries := $(call use_soong_sdk_libraries,$(my_whole_static_libraries))
|
|
|
|
my_static_libraries := $(call use_soong_sdk_libraries,$(my_static_libraries))
|
|
|
|
my_shared_libraries := $(call use_soong_sdk_libraries,$(my_shared_libraries))
|
|
|
|
my_system_shared_libraries := $(call use_soong_sdk_libraries,$(my_system_shared_libraries))
|
|
|
|
my_header_libraries := $(call use_soong_sdk_libraries,$(my_header_libraries))
|
|
|
|
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.
|
2017-03-19 21:22:45 +01:00
|
|
|
ifneq ($(LOCAL_SDK_VERSION),)
|
2015-01-09 03:25:30 +01:00
|
|
|
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 += \
|
2017-06-26 22:13:44 +02:00
|
|
|
$(my_register_name):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(installed_shared_library_module_names))
|
2015-01-09 03:25:30 +01:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
2016-06-07 23:25:14 +02:00
|
|
|
####################################################
|
|
|
|
## Verify that NDK-built libraries only link against
|
|
|
|
## other NDK-built libraries
|
|
|
|
####################################################
|
|
|
|
|
2017-12-19 20:26:05 +01:00
|
|
|
include $(BUILD_SYSTEM)/allowed_ndk_types.mk
|
|
|
|
|
2016-06-07 23:25:14 +02:00
|
|
|
ifdef LOCAL_SDK_VERSION
|
2017-12-19 20:27:39 +01:00
|
|
|
my_link_type := native:ndk:$(my_ndk_stl_family):$(my_ndk_stl_link_type)
|
2017-12-19 20:26:05 +01:00
|
|
|
my_warn_types := $(my_warn_ndk_types)
|
|
|
|
my_allowed_types := $(my_allowed_ndk_types)
|
2017-04-08 05:58:43 +02:00
|
|
|
else ifdef LOCAL_USE_VNDK
|
2017-08-16 11:28:12 +02:00
|
|
|
_name := $(patsubst %.vendor,%,$(LOCAL_MODULE))
|
2020-01-20 10:57:01 +01:00
|
|
|
_name := $(patsubst %.product,%,$(LOCAL_MODULE))
|
2017-08-16 11:28:12 +02:00
|
|
|
ifneq ($(filter $(_name),$(VNDK_CORE_LIBRARIES) $(VNDK_SAMEPROCESS_LIBRARIES) $(LLNDK_LIBRARIES)),)
|
|
|
|
ifeq ($(filter $(_name),$(VNDK_PRIVATE_LIBRARIES)),)
|
|
|
|
my_link_type := native:vndk
|
|
|
|
else
|
|
|
|
my_link_type := native:vndk_private
|
|
|
|
endif
|
|
|
|
my_warn_types :=
|
|
|
|
my_allowed_types := native:vndk native:vndk_private
|
2020-01-20 10:57:01 +01:00
|
|
|
else ifeq ($(LOCAL_USE_VNDK_PRODUCT),true)
|
|
|
|
# Modules installed to /product cannot directly depend on modules marked
|
|
|
|
# with vendor_available: false
|
|
|
|
my_link_type := native:product
|
|
|
|
my_warn_types :=
|
|
|
|
my_allowed_types := native:product native:vndk native:platform_vndk
|
2017-08-16 11:28:12 +02:00
|
|
|
else
|
|
|
|
# Modules installed to /vendor cannot directly depend on modules marked
|
|
|
|
# with vendor_available: false
|
|
|
|
my_link_type := native:vendor
|
|
|
|
my_warn_types :=
|
2018-11-13 05:16:26 +01:00
|
|
|
my_allowed_types := native:vendor native:vndk native:platform_vndk
|
2017-08-16 11:28:12 +02:00
|
|
|
endif
|
2018-09-12 03:03:37 +02:00
|
|
|
else ifneq ($(filter $(TARGET_RECOVERY_OUT)/%,$(call get_non_asan_path,$(LOCAL_MODULE_PATH))),)
|
2018-08-28 05:32:45 +02:00
|
|
|
my_link_type := native:recovery
|
|
|
|
my_warn_types :=
|
|
|
|
# TODO(b/113303515) remove native:platform and my_allowed_ndk_types
|
2018-11-13 05:16:26 +01:00
|
|
|
my_allowed_types := native:recovery native:platform native:platform_vndk $(my_allowed_ndk_types)
|
2016-06-07 23:25:14 +02:00
|
|
|
else
|
2017-04-08 09:31:31 +02:00
|
|
|
my_link_type := native:platform
|
2017-12-19 20:26:05 +01:00
|
|
|
my_warn_types := $(my_warn_ndk_types)
|
2018-11-13 05:16:26 +01:00
|
|
|
my_allowed_types := $(my_allowed_ndk_types) native:platform native:platform_vndk
|
2016-06-07 23:25:14 +02:00
|
|
|
endif
|
2017-04-08 09:31:31 +02:00
|
|
|
|
|
|
|
my_link_deps := $(addprefix STATIC_LIBRARIES:,$(my_whole_static_libraries) $(my_static_libraries))
|
|
|
|
ifneq ($(filter-out STATIC_LIBRARIES HEADER_LIBRARIES,$(LOCAL_MODULE_CLASS)),)
|
|
|
|
my_link_deps += $(addprefix SHARED_LIBRARIES:,$(my_shared_libraries))
|
2017-02-16 00:48:11 +01:00
|
|
|
endif
|
2016-06-07 23:25:14 +02:00
|
|
|
|
2017-04-08 09:31:31 +02:00
|
|
|
my_2nd_arch_prefix := $(LOCAL_2ND_ARCH_VAR_PREFIX)
|
|
|
|
my_common :=
|
|
|
|
include $(BUILD_SYSTEM)/link_type.mk
|
2016-06-07 23:25:14 +02:00
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
###########################################################
|
|
|
|
## Common object handling.
|
|
|
|
###########################################################
|
|
|
|
|
2016-01-20 05:07:08 +01:00
|
|
|
my_unused_src_files := $(filter-out $(logtags_sources) $(my_tracked_src_files),$(my_src_files) $(my_gen_src_files))
|
|
|
|
ifneq ($(my_unused_src_files),)
|
2016-06-28 19:22:08 +02:00
|
|
|
$(error $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): Unused source files: $(my_unused_src_files))
|
2016-01-20 05:07:08 +01:00
|
|
|
endif
|
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
# 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) \
|
2016-05-06 05:02:08 +02:00
|
|
|
$(objcpp_objects)
|
2016-01-20 05:07:08 +01:00
|
|
|
|
|
|
|
new_order_normal_objects := $(foreach f,$(my_src_files),$(my_src_file_obj_$(f)))
|
|
|
|
new_order_normal_objects += $(foreach f,$(my_gen_src_files),$(my_src_file_obj_$(f)))
|
|
|
|
|
|
|
|
ifneq ($(sort $(normal_objects)),$(sort $(new_order_normal_objects)))
|
|
|
|
$(warning $(LOCAL_MODULE_MAKEFILE) Internal build system warning: New object list does not match old)
|
|
|
|
$(info Only in old: $(filter-out $(new_order_normal_objects),$(sort $(normal_objects))))
|
|
|
|
$(info Only in new: $(filter-out $(normal_objects),$(sort $(new_order_normal_objects))))
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(BINARY_OBJECTS_ORDER),soong)
|
|
|
|
normal_objects := $(new_order_normal_objects)
|
|
|
|
endif
|
|
|
|
|
|
|
|
normal_objects += $(addprefix $(TOPDIR)$(LOCAL_PATH)/,$(LOCAL_PREBUILT_OBJ_FILES))
|
2013-08-29 16:36:34 +02:00
|
|
|
|
|
|
|
all_objects := $(normal_objects) $(gen_o_objects)
|
2009-03-04 04:28:42 +01:00
|
|
|
|
2019-01-10 22:21:07 +01:00
|
|
|
LOCAL_INTERMEDIATE_TARGETS += $(all_objects)
|
|
|
|
|
2016-01-20 05:07:08 +01:00
|
|
|
# Cleanup file tracking
|
|
|
|
$(foreach f,$(my_tracked_gen_files),$(eval my_src_file_gen_$(s):=))
|
|
|
|
my_tracked_gen_files :=
|
|
|
|
$(foreach f,$(my_tracked_src_files),$(eval my_src_file_obj_$(s):=))
|
|
|
|
my_tracked_src_files :=
|
|
|
|
|
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
|
|
|
|
2019-11-07 22:53:57 +01:00
|
|
|
my_c_includes := $(foreach inc,$(my_c_includes),$(call clean-path,$(inc)))
|
|
|
|
|
2019-11-26 02:51:18 +01:00
|
|
|
my_outside_includes := $(filter-out $(OUT_DIR)/%,$(filter /%,$(my_c_includes)) $(filter ../%,$(my_c_includes)))
|
2016-05-24 22:06:07 +02:00
|
|
|
ifneq ($(my_outside_includes),)
|
2019-11-26 02:51:18 +01:00
|
|
|
ifeq ($(BUILD_BROKEN_OUTSIDE_INCLUDE_DIRS),true)
|
|
|
|
$(call pretty-warning,C_INCLUDES must be under the source or output directories: $(my_outside_includes))
|
|
|
|
else
|
|
|
|
$(call pretty-error,C_INCLUDES must be under the source or output directories: $(my_outside_includes))
|
|
|
|
endif
|
2016-05-24 22:06:07 +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)
|
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)
|
|
|
|
|
2017-03-19 21:22:45 +01:00
|
|
|
ifneq ($(LOCAL_SDK_VERSION),)
|
2009-03-04 04:28:42 +01:00
|
|
|
built_shared_libraries := \
|
2018-09-05 20:01:12 +02:00
|
|
|
$(foreach lib,$(my_shared_libraries), \
|
|
|
|
$(call intermediates-dir-for, \
|
|
|
|
SHARED_LIBRARIES,$(lib),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/$(lib)$(so_suffix))
|
2015-12-15 19:00:19 +01:00
|
|
|
built_shared_library_deps := $(addsuffix .toc, $(built_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
|
|
|
|
2016-08-04 23:14:50 +02:00
|
|
|
# We need to preserve the ordering of LOCAL_SHARED_LIBRARIES regardless of
|
|
|
|
# whether the libs are generated or prebuilt, so we simply can't split into two
|
|
|
|
# lists and use addprefix.
|
|
|
|
my_ndk_shared_libraries_fullpath := \
|
|
|
|
$(foreach _lib,$(my_ndk_shared_libraries),\
|
2020-06-30 21:46:41 +02:00
|
|
|
$(if $(filter $(NDK_KNOWN_LIBS),$(_lib)),\
|
2016-08-04 23:14:50 +02:00
|
|
|
$(my_built_ndk_libs)/$(_lib)$(so_suffix),\
|
|
|
|
$(my_ndk_sysroot_lib)/$(_lib)$(so_suffix)))
|
2016-07-21 19:04:12 +02:00
|
|
|
|
|
|
|
built_shared_libraries += \
|
2016-08-04 23:14:50 +02:00
|
|
|
$(my_ndk_shared_libraries_fullpath) \
|
2016-07-21 19:04:12 +02:00
|
|
|
$(my_system_shared_libraries_fullpath) \
|
|
|
|
|
2019-06-12 19:25:23 +02:00
|
|
|
built_shared_library_deps += \
|
|
|
|
$(my_ndk_shared_libraries_fullpath) \
|
|
|
|
$(my_system_shared_libraries_fullpath) \
|
|
|
|
|
2010-07-13 23:55:47 +02:00
|
|
|
else
|
|
|
|
built_shared_libraries := \
|
2018-09-05 20:01:12 +02:00
|
|
|
$(foreach lib,$(installed_shared_library_module_names), \
|
|
|
|
$(call intermediates-dir-for, \
|
|
|
|
SHARED_LIBRARIES,$(lib),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/$(lib)$(so_suffix))
|
2015-12-15 19:00:19 +01:00
|
|
|
built_shared_library_deps := $(addsuffix .toc, $(built_shared_libraries))
|
2015-10-09 07:36:04 +02:00
|
|
|
my_system_shared_libraries_fullpath :=
|
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, \
|
2016-08-02 02:41:49 +02:00
|
|
|
STATIC_LIBRARIES,$(lib),$(my_kind),,$(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, \
|
2016-08-02 02:41:49 +02:00
|
|
|
STATIC_LIBRARIES,$(lib),$(my_kind),,$(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), \
|
2018-11-09 01:53:02 +01:00
|
|
|
NOTICE-$(if $(LOCAL_IS_HOST_MODULE),HOST$(if $(my_host_cross),_CROSS,),TARGET)-STATIC_LIBRARIES-$(lib))
|
2009-03-04 04:28:42 +01:00
|
|
|
|
2018-08-14 22:13:47 +02:00
|
|
|
$(notice_target): | $(installed_static_library_notice_file_targets)
|
|
|
|
$(LOCAL_INSTALLED_MODULE): | $(notice_target)
|
|
|
|
|
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-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)
|
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))
|
2016-05-19 23:39:25 +02:00
|
|
|
my_cflags := $(call convert-to-clang-flags,$(my_cflags))
|
|
|
|
my_cppflags := $(call convert-to-clang-flags,$(my_cppflags))
|
|
|
|
my_asflags := $(call convert-to-clang-flags,$(my_asflags))
|
|
|
|
my_ldflags := $(call convert-to-clang-flags,$(my_ldflags))
|
2013-12-10 12:07:41 +01:00
|
|
|
|
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))
|
|
|
|
|
2016-01-30 01:51:51 +01:00
|
|
|
# We can enforce some rules more strictly in the code we own. my_strict
|
|
|
|
# indicates if this is code that we can be stricter with. If we have rules that
|
|
|
|
# we want to apply to *our* code (but maybe can't for vendor/device specific
|
|
|
|
# things), we could extend this to be a ternary value.
|
|
|
|
my_strict := true
|
|
|
|
ifneq ($(filter external/%,$(LOCAL_PATH)),)
|
|
|
|
my_strict := false
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Can be used to make some annotations stricter for code we can fix (such as
|
|
|
|
# when we mark functions as deprecated).
|
|
|
|
ifeq ($(my_strict),true)
|
|
|
|
my_cflags += -DANDROID_STRICT
|
|
|
|
endif
|
|
|
|
|
2017-11-06 19:47:24 +01:00
|
|
|
# Check if -Werror or -Wno-error is used in C compiler flags.
|
2018-09-07 01:25:22 +02:00
|
|
|
# Header libraries do not need cflags.
|
2019-11-13 00:53:04 +01:00
|
|
|
my_all_cflags := $(my_cflags) $(my_cppflags) $(my_cflags_no_override)
|
2018-09-07 01:25:22 +02:00
|
|
|
ifneq (HEADER_LIBRARIES,$(LOCAL_MODULE_CLASS))
|
|
|
|
# Prebuilt modules do not need cflags.
|
|
|
|
ifeq (,$(LOCAL_PREBUILT_MODULE_FILE))
|
|
|
|
# Issue warning if -Wno-error is used.
|
|
|
|
ifneq (,$(filter -Wno-error,$(my_all_cflags)))
|
|
|
|
$(eval MODULES_USING_WNO_ERROR := $(MODULES_USING_WNO_ERROR) $(LOCAL_MODULE_MAKEFILE):$(LOCAL_MODULE))
|
|
|
|
else
|
|
|
|
# Issue warning if -Werror is not used. Add it.
|
|
|
|
ifeq (,$(filter -Werror,$(my_all_cflags)))
|
|
|
|
# Add -Wall -Werror unless the project is in the WARNING_ALLOWED project list.
|
|
|
|
ifeq (,$(strip $(call find_warning_allowed_projects,$(LOCAL_PATH))))
|
|
|
|
my_cflags := -Wall -Werror $(my_cflags)
|
|
|
|
else
|
|
|
|
$(eval MODULES_ADDED_WALL := $(MODULES_ADDED_WALL) $(LOCAL_MODULE_MAKEFILE):$(LOCAL_MODULE))
|
|
|
|
my_cflags := -Wall $(my_cflags)
|
2017-11-06 19:47:24 +01:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
2016-10-12 00:38:39 +02:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2019-11-13 00:53:04 +01:00
|
|
|
ifneq (,$(filter -Weverything,$(my_all_cflags)))
|
|
|
|
ifeq (,$(ANDROID_TEMPORARILY_ALLOW_WEVERYTHING))
|
|
|
|
$(call pretty-error, -Weverything is not allowed in Android.mk files.\
|
|
|
|
Build with `m ANDROID_TEMPORARILY_ALLOW_WEVERYTHING=true` to experiment locally with -Weverything.)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2020-08-06 02:06:34 +02:00
|
|
|
ifneq ($(my_tidy_checks),)
|
2018-09-05 07:25:22 +02:00
|
|
|
tidy_only: $(cpp_objects) $(c_objects) $(gen_c_objects) $(gen_cpp_objects)
|
2016-04-01 01:30:23 +02:00
|
|
|
|
2020-08-06 02:06:34 +02:00
|
|
|
# Add dependency of clang-tidy and clang-tidy.sh
|
2019-04-05 01:21:53 +02:00
|
|
|
$(cpp_objects): $(intermediates)/%.o: $(PATH_TO_CLANG_TIDY)
|
|
|
|
$(c_objects): $(intermediates)/%.o: $(PATH_TO_CLANG_TIDY)
|
|
|
|
$(gen_cpp_objects): $(intermediates)/%.o: $(PATH_TO_CLANG_TIDY)
|
|
|
|
$(gen_c_objects): $(intermediates)/%.o: $(PATH_TO_CLANG_TIDY)
|
2018-08-27 05:37:49 +02:00
|
|
|
endif
|
|
|
|
|
Rewrite LDLIBS and SHARED_LIBRARIES
LOCAL_LDLIBS was the only correct way to use NDK libraries, but few used
it correctly. It also often got confused with LOCAL_LDFLAGS, so move the
flags to the correct variable.
For binaries that weren't using the NDK (empty LOCAL_SDK_VERSION), it
was never valid to use LOCAL_LDLIBS, as dependencies would not be
properly set up, and could lead to random build failures. So convert any
-l linker flags to using LOCAL_SHARED_LIBRARIES automatically.
For binaries built using the NDK (LOCAL_SDK_VERSION set), they were
required to use LOCAL_LDLIBS for prebuilt NDK libraries, otherwise they
would get headers and dependencies to the platform versions. Any
non-prebuilt LOCAL_LDLIBS would miss dependencies. So move the NDK
prebuilt libraries to LDLIBS from SHARED_LIBRARIES, and move everything
else to SHARED_LIBRARIES.
So now, for device modules, LOCAL_SHARED_LIBRARIES should always be
used, and we'll do the right thing. LOCAL_LDLIBS should only be used for
host libraries from the system.
Change-Id: Ide34c7afdcfb6507a378d45a42471729e489a9e0
2016-06-08 01:55:57 +02:00
|
|
|
# Move -l* entries from ldflags to ldlibs, and everything else to ldflags
|
|
|
|
my_ldlib_flags := $(my_ldflags) $(my_ldlibs)
|
|
|
|
my_ldlibs := $(filter -l%,$(my_ldlib_flags))
|
|
|
|
my_ldflags := $(filter-out -l%,$(my_ldlib_flags))
|
|
|
|
|
|
|
|
# One last verification check for ldlibs
|
|
|
|
my_allowed_ldlibs :=
|
2017-09-26 09:14:01 +02:00
|
|
|
ifndef LOCAL_IS_HOST_MODULE
|
|
|
|
ifneq ($(LOCAL_SDK_VERSION),)
|
2020-06-30 21:46:41 +02:00
|
|
|
my_allowed_ldlibs := $(NDK_KNOWN_LIBS:lib%=-l%)
|
2017-09-26 09:14:01 +02:00
|
|
|
endif
|
|
|
|
else
|
|
|
|
my_allowed_ldlibs := $($(my_prefix)AVAILABLE_LIBRARIES)
|
Rewrite LDLIBS and SHARED_LIBRARIES
LOCAL_LDLIBS was the only correct way to use NDK libraries, but few used
it correctly. It also often got confused with LOCAL_LDFLAGS, so move the
flags to the correct variable.
For binaries that weren't using the NDK (empty LOCAL_SDK_VERSION), it
was never valid to use LOCAL_LDLIBS, as dependencies would not be
properly set up, and could lead to random build failures. So convert any
-l linker flags to using LOCAL_SHARED_LIBRARIES automatically.
For binaries built using the NDK (LOCAL_SDK_VERSION set), they were
required to use LOCAL_LDLIBS for prebuilt NDK libraries, otherwise they
would get headers and dependencies to the platform versions. Any
non-prebuilt LOCAL_LDLIBS would miss dependencies. So move the NDK
prebuilt libraries to LDLIBS from SHARED_LIBRARIES, and move everything
else to SHARED_LIBRARIES.
So now, for device modules, LOCAL_SHARED_LIBRARIES should always be
used, and we'll do the right thing. LOCAL_LDLIBS should only be used for
host libraries from the system.
Change-Id: Ide34c7afdcfb6507a378d45a42471729e489a9e0
2016-06-08 01:55:57 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
my_bad_ldlibs := $(filter-out $(my_allowed_ldlibs),$(my_ldlibs))
|
|
|
|
ifneq ($(my_bad_ldlibs),)
|
|
|
|
$(error $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): Bad LOCAL_LDLIBS entries: $(my_bad_ldlibs))
|
|
|
|
endif
|
|
|
|
|
2016-09-13 19:44:44 +02:00
|
|
|
# my_cxx_ldlibs may contain linker flags need to wrap certain libraries
|
|
|
|
# (start-group/end-group), so append after the check above.
|
|
|
|
my_ldlibs += $(my_cxx_ldlibs)
|
|
|
|
|
2019-01-10 22:10:17 +01:00
|
|
|
###########################################################
|
|
|
|
## Define PRIVATE_ variables from global vars
|
|
|
|
###########################################################
|
|
|
|
ifndef LOCAL_IS_HOST_MODULE
|
2020-05-01 06:18:58 +02:00
|
|
|
|
2019-01-10 22:10:17 +01:00
|
|
|
ifdef LOCAL_USE_VNDK
|
2020-05-01 06:18:58 +02:00
|
|
|
my_target_global_c_includes :=
|
|
|
|
my_target_global_c_system_includes := $(TARGET_OUT_HEADERS)
|
2019-01-10 22:10:17 +01:00
|
|
|
else ifdef LOCAL_SDK_VERSION
|
2020-05-01 06:18:58 +02:00
|
|
|
my_target_global_c_includes :=
|
|
|
|
my_target_global_c_system_includes := $(my_ndk_stl_include_path) $(my_ndk_sysroot_include)
|
2019-01-10 22:10:17 +01:00
|
|
|
else ifdef BOARD_VNDK_VERSION
|
2020-05-01 06:18:58 +02:00
|
|
|
my_target_global_c_includes := $(SRC_HEADERS) \
|
2019-01-10 22:10:17 +01:00
|
|
|
$($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES)
|
2020-05-01 06:18:58 +02:00
|
|
|
my_target_global_c_system_includes := $(SRC_SYSTEM_HEADERS) \
|
2019-01-10 22:10:17 +01:00
|
|
|
$($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_SYSTEM_INCLUDES)
|
|
|
|
else
|
2020-05-01 06:18:58 +02:00
|
|
|
my_target_global_c_includes := $(SRC_HEADERS) \
|
2019-01-10 22:10:17 +01:00
|
|
|
$($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES)
|
2020-05-01 06:18:58 +02:00
|
|
|
my_target_global_c_system_includes := $(SRC_SYSTEM_HEADERS) $(TARGET_OUT_HEADERS) \
|
2019-01-10 22:10:17 +01:00
|
|
|
$($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_SYSTEM_INCLUDES)
|
|
|
|
endif
|
|
|
|
|
|
|
|
my_target_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CFLAGS)
|
|
|
|
my_target_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CONLYFLAGS) $(my_c_std_conlyflags)
|
|
|
|
my_target_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CPPFLAGS) $(my_cpp_std_cppflags)
|
|
|
|
ifeq ($(my_use_clang_lld),true)
|
|
|
|
my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_LLDFLAGS)
|
|
|
|
include $(BUILD_SYSTEM)/pack_dyn_relocs_setup.mk
|
2019-07-31 07:32:20 +02:00
|
|
|
ifeq ($(my_pack_module_relocations),true)
|
|
|
|
my_target_global_ldflags += -Wl,--pack-dyn-relocs=android+relr -Wl,--use-android-relr-tags
|
|
|
|
else
|
2019-01-10 22:10:17 +01:00
|
|
|
my_target_global_ldflags += -Wl,--pack-dyn-relocs=none
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_LDFLAGS)
|
|
|
|
endif # my_use_clang_lld
|
|
|
|
|
2019-07-26 02:43:04 +02:00
|
|
|
my_target_triple := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)TRIPLE)
|
|
|
|
ifndef LOCAL_IS_HOST_MODULE
|
|
|
|
my_target_triple_flag := -target $(my_target_triple)$(my_api_level)
|
|
|
|
else
|
|
|
|
my_target_triple_flag := -target $(my_target_triple)
|
|
|
|
endif
|
|
|
|
my_asflags += $(my_target_triple_flag)
|
|
|
|
my_cflags += $(my_target_triple_flag)
|
|
|
|
my_ldflags += $(my_target_triple_flag)
|
|
|
|
|
2019-01-10 22:10:17 +01:00
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_GLOBAL_C_INCLUDES := $(my_target_global_c_includes)
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_GLOBAL_C_SYSTEM_INCLUDES := $(my_target_global_c_system_includes)
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CFLAGS := $(my_target_global_cflags)
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CONLYFLAGS := $(my_target_global_conlyflags)
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CPPFLAGS := $(my_target_global_cppflags)
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(my_target_global_ldflags)
|
|
|
|
|
|
|
|
else # LOCAL_IS_HOST_MODULE
|
|
|
|
|
|
|
|
my_host_global_c_includes := $(SRC_HEADERS) \
|
|
|
|
$($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES)
|
|
|
|
my_host_global_c_system_includes := $(SRC_SYSTEM_HEADERS) \
|
|
|
|
$($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_SYSTEM_INCLUDES)
|
|
|
|
|
|
|
|
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_c_std_conlyflags)
|
|
|
|
my_host_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CPPFLAGS) $(my_cpp_std_cppflags)
|
|
|
|
ifeq ($(my_use_clang_lld),true)
|
|
|
|
my_host_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_LLDFLAGS)
|
|
|
|
else
|
|
|
|
my_host_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_LDFLAGS)
|
|
|
|
endif # my_use_clang_lld
|
|
|
|
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_GLOBAL_C_INCLUDES := $(my_host_global_c_includes)
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_GLOBAL_C_SYSTEM_INCLUDES := $(my_host_global_c_system_includes)
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_CFLAGS := $(my_host_global_cflags)
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_CONLYFLAGS := $(my_host_global_conlyflags)
|
|
|
|
$(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
|
|
|
|
|
|
|
|
# To enable coverage for a given module, set LOCAL_NATIVE_COVERAGE=true and
|
|
|
|
# build with NATIVE_COVERAGE=true in your enviornment.
|
|
|
|
ifeq ($(NATIVE_COVERAGE),true)
|
|
|
|
ifeq ($(my_native_coverage),true)
|
|
|
|
# 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
|
|
|
|
my_cflags += --coverage -O0
|
|
|
|
my_ldflags += --coverage
|
|
|
|
endif
|
|
|
|
|
|
|
|
my_coverage_lib := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)LIBPROFILE_RT)
|
|
|
|
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_COVERAGE_LIB := $(my_coverage_lib)
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): $(my_coverage_lib)
|
|
|
|
endif
|
|
|
|
|
2019-07-31 19:31:20 +02:00
|
|
|
####################################################
|
|
|
|
## Import includes
|
|
|
|
####################################################
|
2020-05-01 06:18:58 +02:00
|
|
|
imported_includes :=
|
|
|
|
|
|
|
|
ifdef LOCAL_USE_VNDK
|
|
|
|
imported_includes += $(call intermediates-dir-for,HEADER_LIBRARIES,device_kernel_headers,$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))
|
|
|
|
else ifdef LOCAL_SDK_VERSION
|
|
|
|
# Apps shouldn't need device-specific kernel headers
|
|
|
|
else ifdef BOARD_VNDK_VERSION
|
|
|
|
# For devices building with the VNDK, only the VNDK gets device-specific kernel headers by default
|
|
|
|
# In soong, it's entirely opt-in
|
|
|
|
else
|
|
|
|
# For older non-VNDK builds, continue adding in kernel headers to everything like we used to
|
|
|
|
imported_includes += $(call intermediates-dir-for,HEADER_LIBRARIES,device_kernel_headers,$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))
|
|
|
|
endif
|
|
|
|
|
2019-07-31 19:31:20 +02:00
|
|
|
imported_includes := $(strip \
|
2020-05-01 06:18:58 +02:00
|
|
|
$(imported_includes) \
|
2019-07-31 19:31:20 +02:00
|
|
|
$(foreach l, $(installed_shared_library_module_names), \
|
|
|
|
$(call intermediates-dir-for,SHARED_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))) \
|
|
|
|
$(foreach l, $(my_static_libraries) $(my_whole_static_libraries), \
|
|
|
|
$(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))) \
|
|
|
|
$(foreach l, $(my_header_libraries), \
|
|
|
|
$(call intermediates-dir-for,HEADER_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))))
|
|
|
|
|
|
|
|
$(foreach dep,$(imported_includes),\
|
|
|
|
$(eval EXPORTS.$$(dep).USERS := $$(EXPORTS.$$(dep).USERS) $$(all_objects)))
|
|
|
|
|
2019-01-10 22:10:17 +01:00
|
|
|
###########################################################
|
|
|
|
## Define PRIVATE_ variables used by multiple module types
|
|
|
|
###########################################################
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_NO_DEFAULT_COMPILER_FLAGS := \
|
|
|
|
$(strip $(LOCAL_NO_DEFAULT_COMPILER_FLAGS))
|
|
|
|
|
|
|
|
ifeq ($(strip $(WITH_STATIC_ANALYZER)),)
|
|
|
|
LOCAL_NO_STATIC_ANALYZER := true
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(strip $(LOCAL_IS_HOST_MODULE)),)
|
|
|
|
my_syntax_arch := host
|
|
|
|
else
|
|
|
|
my_syntax_arch := $($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(strip $(my_cc)),)
|
|
|
|
my_cc := $(my_cc_wrapper) $(CLANG)
|
|
|
|
endif
|
|
|
|
|
|
|
|
SYNTAX_TOOLS_PREFIX := \
|
|
|
|
$(LLVM_PREBUILTS_BASE)/$(BUILD_OS)-x86/$(LLVM_PREBUILTS_VERSION)/libexec
|
|
|
|
|
|
|
|
ifneq ($(LOCAL_NO_STATIC_ANALYZER),true)
|
|
|
|
my_cc := CCC_CC=$(CLANG) CLANG=$(CLANG) \
|
|
|
|
$(SYNTAX_TOOLS_PREFIX)/ccc-analyzer
|
|
|
|
endif
|
|
|
|
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CC := $(my_cc)
|
|
|
|
|
|
|
|
ifeq ($(strip $(my_cxx)),)
|
|
|
|
my_cxx := $(my_cxx_wrapper) $(CLANG_CXX)
|
|
|
|
endif
|
|
|
|
|
2019-08-06 21:54:48 +02:00
|
|
|
ifeq ($(strip $(my_cxx_link)),)
|
|
|
|
my_cxx_link := $(CLANG_CXX)
|
|
|
|
endif
|
|
|
|
|
2019-01-10 22:10:17 +01:00
|
|
|
ifneq ($(LOCAL_NO_STATIC_ANALYZER),true)
|
|
|
|
my_cxx := CCC_CXX=$(CLANG_CXX) CLANG_CXX=$(CLANG_CXX) \
|
|
|
|
$(SYNTAX_TOOLS_PREFIX)/c++-analyzer
|
2019-08-06 21:54:48 +02:00
|
|
|
my_cxx_link := CCC_CXX=$(CLANG_CXX) CLANG_CXX=$(CLANG_CXX) \
|
|
|
|
$(SYNTAX_TOOLS_PREFIX)/c++-analyzer
|
2019-01-10 22:10:17 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LINKER := $(my_linker)
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CXX := $(my_cxx)
|
2019-08-06 21:54:48 +02:00
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CXX_LINK := $(my_cxx_link)
|
2019-01-10 22:10:17 +01:00
|
|
|
|
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)
|
2019-07-31 19:31:20 +02:00
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_IMPORTED_INCLUDES := $(imported_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)
|
2016-04-01 01:30:23 +02:00
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TIDY_CHECKS := $(my_tidy_checks)
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TIDY_FLAGS := $(my_tidy_flags)
|
2017-01-24 01:57:38 +01:00
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ARFLAGS := $(my_arflags)
|
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)
|
2016-03-23 02:23:13 +01:00
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_OBJECTS := $(strip $(all_objects))
|
2009-03-04 04:28:42 +01:00
|
|
|
|
|
|
|
###########################################################
|
|
|
|
# Define library dependencies.
|
|
|
|
###########################################################
|
|
|
|
# all_libraries is used for the dependencies on LOCAL_BUILT_MODULE.
|
|
|
|
all_libraries := \
|
2015-12-15 19:00:19 +01:00
|
|
|
$(built_shared_library_deps) \
|
2015-10-09 07:36:04 +02:00
|
|
|
$(my_system_shared_libraries_fullpath) \
|
2009-03-04 04:28:42 +01:00
|
|
|
$(built_static_libraries) \
|
|
|
|
$(built_whole_libraries)
|
|
|
|
|
2011-11-08 18:31:21 +01:00
|
|
|
###########################################################
|
|
|
|
# Export includes
|
|
|
|
###########################################################
|
2019-07-31 19:31:20 +02:00
|
|
|
|
2016-04-11 21:40:36 +02:00
|
|
|
# Headers exported by whole static libraries are also exported by this library.
|
2016-03-04 21:40:25 +01:00
|
|
|
export_include_deps := $(strip \
|
|
|
|
$(foreach l,$(my_whole_static_libraries), \
|
2019-07-31 19:31:20 +02:00
|
|
|
$(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))))
|
2016-04-11 21:40:36 +02:00
|
|
|
# Re-export requested headers from shared libraries.
|
|
|
|
export_include_deps += $(strip \
|
|
|
|
$(foreach l,$(LOCAL_EXPORT_SHARED_LIBRARY_HEADERS), \
|
2019-07-31 19:31:20 +02:00
|
|
|
$(call intermediates-dir-for,SHARED_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))))
|
2016-04-11 21:40:36 +02:00
|
|
|
# Re-export requested headers from static libraries.
|
|
|
|
export_include_deps += $(strip \
|
|
|
|
$(foreach l,$(LOCAL_EXPORT_STATIC_LIBRARY_HEADERS), \
|
2019-07-31 19:31:20 +02:00
|
|
|
$(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))))
|
2017-02-16 00:48:11 +01:00
|
|
|
# Re-export requested headers from header libraries.
|
|
|
|
export_include_deps += $(strip \
|
|
|
|
$(foreach l,$(LOCAL_EXPORT_HEADER_LIBRARY_HEADERS), \
|
2019-07-31 19:31:20 +02:00
|
|
|
$(call intermediates-dir-for,HEADER_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))))
|
|
|
|
|
|
|
|
ifneq ($(strip $(my_export_c_include_dirs)$(export_include_deps)),)
|
2020-06-09 03:50:14 +02:00
|
|
|
EXPORTS_LIST += $(intermediates)
|
2019-11-07 22:53:57 +01:00
|
|
|
EXPORTS.$(intermediates).FLAGS := $(foreach d,$(my_export_c_include_dirs),-I $(call clean-path,$(d)))
|
2019-07-31 19:31:20 +02:00
|
|
|
EXPORTS.$(intermediates).REEXPORT := $(export_include_deps)
|
|
|
|
EXPORTS.$(intermediates).DEPS := $(my_export_c_include_deps) $(my_generated_sources) $(LOCAL_EXPORT_C_INCLUDE_DEPS)
|
|
|
|
endif
|
2016-08-26 22:27:13 +02:00
|
|
|
|
2016-12-14 03:28:33 +01:00
|
|
|
ifneq (,$(filter-out $(LOCAL_PATH)/%,$(my_export_c_include_dirs)))
|
|
|
|
my_soong_problems += non_local__export_c_include_dirs
|
|
|
|
endif
|
|
|
|
|
2016-08-26 22:27:13 +02:00
|
|
|
SOONG_CONV.$(LOCAL_MODULE).PROBLEMS := \
|
|
|
|
$(SOONG_CONV.$(LOCAL_MODULE).PROBLEMS) $(my_soong_problems)
|
|
|
|
SOONG_CONV.$(LOCAL_MODULE).DEPS := \
|
|
|
|
$(SOONG_CONV.$(LOCAL_MODULE).DEPS) \
|
2017-04-26 00:42:14 +02:00
|
|
|
$(filter-out $($(LOCAL_2ND_ARCH_VAR_PREFIX)UBSAN_RUNTIME_LIBRARY),\
|
|
|
|
$(my_static_libraries) \
|
|
|
|
$(my_whole_static_libraries) \
|
|
|
|
$(my_shared_libraries) \
|
|
|
|
$(my_system_shared_libraries))
|
2017-12-06 23:37:06 +01:00
|
|
|
SOONG_CONV.$(LOCAL_MODULE).TYPE := native
|
2020-06-27 09:10:23 +02:00
|
|
|
SOONG_CONV.$(LOCAL_MODULE).MAKEFILES := \
|
|
|
|
$(SOONG_CONV.$(LOCAL_MODULE).MAKEFILES) $(LOCAL_MODULE_MAKEFILE)
|
|
|
|
SOONG_CONV.$(LOCAL_MODULE).INSTALLED:= \
|
|
|
|
$(SOONG_CONV.$(LOCAL_MODULE).INSTALLED) $(LOCAL_INSTALLED_MODULE)
|
2016-08-26 22:27:13 +02:00
|
|
|
SOONG_CONV := $(SOONG_CONV) $(LOCAL_MODULE)
|
2016-09-12 22:56:50 +02:00
|
|
|
|
|
|
|
###########################################################
|
|
|
|
# Coverage packaging.
|
|
|
|
###########################################################
|
|
|
|
ifeq ($(my_native_coverage),true)
|
2017-03-01 01:20:23 +01:00
|
|
|
my_gcno_objects := \
|
|
|
|
$(cpp_objects) \
|
|
|
|
$(gen_cpp_objects) \
|
|
|
|
$(c_objects) \
|
|
|
|
$(gen_c_objects) \
|
|
|
|
$(objc_objects) \
|
|
|
|
$(objcpp_objects)
|
|
|
|
|
|
|
|
LOCAL_GCNO_FILES := $(patsubst %.o,%.gcno,$(my_gcno_objects))
|
|
|
|
$(foreach f,$(my_gcno_objects),$(eval $(call gcno-touch-rule,$(f),$(f:.o=.gcno))))
|
2016-09-12 22:56:50 +02:00
|
|
|
endif
|