The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1 | ########################################################### |
| 2 | ## Standard rules for building binary object files from |
Ying Wang | d8d3721 | 2014-03-21 16:17:04 -0700 | [diff] [blame] | 3 | ## asm/c/cpp/yacc/lex/etc source files. |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 4 | ## |
| 5 | ## The list of object files is exported in $(all_objects). |
| 6 | ########################################################### |
| 7 | |
Ying Wang | d8d3721 | 2014-03-21 16:17:04 -0700 | [diff] [blame] | 8 | ####################################### |
| 9 | include $(BUILD_SYSTEM)/base_rules.mk |
Chih-Hung Hsieh | 32427d6 | 2018-04-12 10:55:54 -0700 | [diff] [blame] | 10 | include $(BUILD_SYSTEM)/use_lld_setup.mk |
Ying Wang | d8d3721 | 2014-03-21 16:17:04 -0700 | [diff] [blame] | 11 | ####################################### |
| 12 | |
Dan Albert | d3d894d | 2014-11-14 15:28:49 -0800 | [diff] [blame] | 13 | ################################################## |
| 14 | # Compute the dependency of the shared libraries |
| 15 | ################################################## |
| 16 | # On the target, we compile with -nostdlib, so we must add in the |
| 17 | # default system shared libraries, unless they have requested not |
| 18 | # to by supplying a LOCAL_SYSTEM_SHARED_LIBRARIES value. One would |
| 19 | # supply that, for example, when building libc itself. |
| 20 | ifdef LOCAL_IS_HOST_MODULE |
| 21 | ifeq ($(LOCAL_SYSTEM_SHARED_LIBRARIES),none) |
| 22 | my_system_shared_libraries := |
| 23 | else |
| 24 | my_system_shared_libraries := $(LOCAL_SYSTEM_SHARED_LIBRARIES) |
| 25 | endif |
| 26 | else |
| 27 | ifeq ($(LOCAL_SYSTEM_SHARED_LIBRARIES),none) |
Dimitry Ivanov | cdf3927 | 2017-06-26 13:13:44 -0700 | [diff] [blame] | 28 | my_system_shared_libraries := libc libm libdl |
Dan Albert | d3d894d | 2014-11-14 15:28:49 -0800 | [diff] [blame] | 29 | else |
| 30 | my_system_shared_libraries := $(LOCAL_SYSTEM_SHARED_LIBRARIES) |
Dimitry Ivanov | cdf3927 | 2017-06-26 13:13:44 -0700 | [diff] [blame] | 31 | my_system_shared_libraries := $(patsubst libc,libc libdl,$(my_system_shared_libraries)) |
Dan Albert | d3d894d | 2014-11-14 15:28:49 -0800 | [diff] [blame] | 32 | endif |
| 33 | endif |
| 34 | |
Dan Willemsen | fc92fb2 | 2016-08-26 13:27:13 -0700 | [diff] [blame] | 35 | my_soong_problems := |
| 36 | |
Dan Albert | d3d894d | 2014-11-14 15:28:49 -0800 | [diff] [blame] | 37 | # The following LOCAL_ variables will be modified in this file. |
| 38 | # Because the same LOCAL_ variables may be used to define modules for both 1st arch and 2nd arch, |
| 39 | # we can't modify them in place. |
| 40 | my_src_files := $(LOCAL_SRC_FILES) |
Colin Cross | a04abc8 | 2015-06-30 12:21:59 -0700 | [diff] [blame] | 41 | my_src_files_exclude := $(LOCAL_SRC_FILES_EXCLUDE) |
Dan Albert | d3d894d | 2014-11-14 15:28:49 -0800 | [diff] [blame] | 42 | my_static_libraries := $(LOCAL_STATIC_LIBRARIES) |
| 43 | my_whole_static_libraries := $(LOCAL_WHOLE_STATIC_LIBRARIES) |
Dimitry Ivanov | cdf3927 | 2017-06-26 13:13:44 -0700 | [diff] [blame] | 44 | my_shared_libraries := $(filter-out $(my_system_shared_libraries),$(LOCAL_SHARED_LIBRARIES)) |
Dan Willemsen | 8dae49c | 2017-02-15 15:48:11 -0800 | [diff] [blame] | 45 | my_header_libraries := $(LOCAL_HEADER_LIBRARIES) |
Dan Albert | d3d894d | 2014-11-14 15:28:49 -0800 | [diff] [blame] | 46 | my_cflags := $(LOCAL_CFLAGS) |
Stephen Hines | 1568029 | 2014-11-26 00:53:46 -0800 | [diff] [blame] | 47 | my_conlyflags := $(LOCAL_CONLYFLAGS) |
Dan Albert | d3d894d | 2014-11-14 15:28:49 -0800 | [diff] [blame] | 48 | my_cppflags := $(LOCAL_CPPFLAGS) |
Dan Willemsen | 7a5c5d7 | 2018-10-07 19:41:21 -0700 | [diff] [blame] | 49 | my_cflags_no_override := $(GLOBAL_CLANG_CFLAGS_NO_OVERRIDE) |
| 50 | my_cppflags_no_override := $(GLOBAL_CLANG_CPPFLAGS_NO_OVERRIDE) |
Dan Albert | d3d894d | 2014-11-14 15:28:49 -0800 | [diff] [blame] | 51 | my_ldflags := $(LOCAL_LDFLAGS) |
| 52 | my_ldlibs := $(LOCAL_LDLIBS) |
| 53 | my_asflags := $(LOCAL_ASFLAGS) |
| 54 | my_cc := $(LOCAL_CC) |
Ying Wang | c671a7c | 2015-07-20 18:40:18 -0700 | [diff] [blame] | 55 | my_cc_wrapper := $(CC_WRAPPER) |
Dan Albert | d3d894d | 2014-11-14 15:28:49 -0800 | [diff] [blame] | 56 | my_cxx := $(LOCAL_CXX) |
Ramy Medhat | e5839f9 | 2019-08-06 15:54:48 -0400 | [diff] [blame] | 57 | my_cxx_link := $(LOCAL_CXX) |
Jiyong Park | 425d489 | 2017-08-18 12:22:57 +0900 | [diff] [blame] | 58 | my_cxx_ldlibs := |
Ying Wang | c671a7c | 2015-07-20 18:40:18 -0700 | [diff] [blame] | 59 | my_cxx_wrapper := $(CXX_WRAPPER) |
Dan Albert | d3d894d | 2014-11-14 15:28:49 -0800 | [diff] [blame] | 60 | my_c_includes := $(LOCAL_C_INCLUDES) |
| 61 | my_generated_sources := $(LOCAL_GENERATED_SOURCES) |
Dan Willemsen | 1c6dc5b | 2016-01-06 14:28:36 -0800 | [diff] [blame] | 62 | my_additional_dependencies := $(LOCAL_ADDITIONAL_DEPENDENCIES) |
Ying Wang | faeb693 | 2015-04-07 11:59:34 -0700 | [diff] [blame] | 63 | my_export_c_include_dirs := $(LOCAL_EXPORT_C_INCLUDE_DIRS) |
Dan Willemsen | ba6a164 | 2016-09-29 12:08:29 -0700 | [diff] [blame] | 64 | my_export_c_include_deps := $(LOCAL_EXPORT_C_INCLUDE_DEPS) |
Evgenii Stepanov | e1b96f3 | 2017-01-23 16:57:38 -0800 | [diff] [blame] | 65 | my_arflags := |
Dan Albert | d3d894d | 2014-11-14 15:28:49 -0800 | [diff] [blame] | 66 | |
Colin Cross | 23dcf76 | 2019-11-11 16:04:34 -0800 | [diff] [blame^] | 67 | # Configure the pool to use for clang rules. |
| 68 | # If LOCAL_CC or LOCAL_CXX is set don't use goma or RBE. |
| 69 | my_pool := |
| 70 | ifeq (,$(strip $(my_cc))$(strip $(my_cxx))) |
| 71 | my_pool := $(GOMA_OR_RBE_POOL) |
| 72 | endif |
| 73 | |
Ryan Campbell | a435aa5 | 2017-10-20 16:19:42 -0700 | [diff] [blame] | 74 | ifneq (,$(strip $(foreach dir,$(COVERAGE_PATHS),$(filter $(dir)%,$(LOCAL_PATH))))) |
| 75 | ifeq (,$(strip $(foreach dir,$(COVERAGE_EXCLUDE_PATHS),$(filter $(dir)%,$(LOCAL_PATH))))) |
Ryan Campbell | 81c9d29 | 2016-09-12 13:56:50 -0700 | [diff] [blame] | 76 | my_native_coverage := true |
| 77 | else |
| 78 | my_native_coverage := false |
| 79 | endif |
Ryan Campbell | b55ff74 | 2017-02-27 09:09:16 -0800 | [diff] [blame] | 80 | else |
| 81 | my_native_coverage := false |
| 82 | endif |
Dan Willemsen | e24da82 | 2019-01-10 13:10:17 -0800 | [diff] [blame] | 83 | ifneq ($(NATIVE_COVERAGE),true) |
| 84 | my_native_coverage := false |
| 85 | endif |
Ryan Campbell | 81c9d29 | 2016-09-12 13:56:50 -0700 | [diff] [blame] | 86 | |
Ivan Lozano | c244c21 | 2019-01-10 09:46:52 -0800 | [diff] [blame] | 87 | ifneq ($(strip $(ENABLE_XOM)),false) |
Ivan Lozano | fda9a6f | 2018-11-21 09:04:18 -0800 | [diff] [blame] | 88 | ifndef LOCAL_IS_HOST_MODULE |
| 89 | my_xom := true |
| 90 | # Disable XOM in excluded paths. |
| 91 | combined_xom_exclude_paths := $(XOM_EXCLUDE_PATHS) \ |
| 92 | $(PRODUCT_XOM_EXCLUDE_PATHS) |
| 93 | ifneq ($(strip $(foreach dir,$(subst $(comma),$(space),$(combined_xom_exclude_paths)),\ |
| 94 | $(filter $(dir)%,$(LOCAL_PATH)))),) |
| 95 | my_xom := false |
| 96 | endif |
| 97 | |
| 98 | # Allow LOCAL_XOM to override the above |
| 99 | ifdef LOCAL_XOM |
| 100 | my_xom := $(LOCAL_XOM) |
| 101 | endif |
| 102 | |
| 103 | ifeq ($(strip $(my_xom)),true) |
| 104 | ifeq (arm64,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) |
Ivan Lozano | f9f03e0 | 2018-11-27 14:39:33 -0800 | [diff] [blame] | 105 | ifeq ($(my_use_clang_lld),true) |
| 106 | my_ldflags += -Wl,-execute-only |
| 107 | endif |
Ivan Lozano | fda9a6f | 2018-11-21 09:04:18 -0800 | [diff] [blame] | 108 | endif |
| 109 | endif |
| 110 | endif |
| 111 | endif |
| 112 | |
Colin Cross | a82fa12 | 2016-10-20 12:38:21 -0700 | [diff] [blame] | 113 | my_allow_undefined_symbols := $(strip $(LOCAL_ALLOW_UNDEFINED_SYMBOLS)) |
| 114 | ifdef SANITIZE_HOST |
Dan Albert | b58fb4a | 2014-11-14 17:15:00 -0800 | [diff] [blame] | 115 | ifdef LOCAL_IS_HOST_MODULE |
| 116 | my_allow_undefined_symbols := true |
Colin Cross | a82fa12 | 2016-10-20 12:38:21 -0700 | [diff] [blame] | 117 | endif |
Dan Albert | b58fb4a | 2014-11-14 17:15:00 -0800 | [diff] [blame] | 118 | endif |
| 119 | |
Andrew Hsieh | 140761af0 | 2014-04-25 23:47:10 -0700 | [diff] [blame] | 120 | my_ndk_sysroot := |
| 121 | my_ndk_sysroot_include := |
| 122 | my_ndk_sysroot_lib := |
Peter Collingbourne | e3606ae | 2019-07-25 17:43:04 -0700 | [diff] [blame] | 123 | my_api_level := 10000 |
| 124 | |
Dan Willemsen | ffa3258 | 2017-03-19 13:22:45 -0700 | [diff] [blame] | 125 | ifneq ($(LOCAL_SDK_VERSION),) |
Ying Wang | 1a08100 | 2010-07-13 14:55:47 -0700 | [diff] [blame] | 126 | ifdef LOCAL_IS_HOST_MODULE |
Ian Rogers | 76a6dc3 | 2012-10-01 16:36:23 -0700 | [diff] [blame] | 127 | $(error $(LOCAL_PATH): LOCAL_SDK_VERSION cannot be used in host module) |
Ying Wang | 1a08100 | 2010-07-13 14:55:47 -0700 | [diff] [blame] | 128 | endif |
Nikola Veljkovic | f738562 | 2016-04-06 19:20:02 +0200 | [diff] [blame] | 129 | |
Dan Albert | 02bf138 | 2016-07-21 10:04:12 -0700 | [diff] [blame] | 130 | # Make sure we've built the NDK. |
Dan Albert | 248b832 | 2017-12-14 13:52:04 -0800 | [diff] [blame] | 131 | my_additional_dependencies += $(SOONG_OUT_DIR)/ndk_base.timestamp |
Dan Albert | 02bf138 | 2016-07-21 10:04:12 -0700 | [diff] [blame] | 132 | |
Nikola Veljkovic | f738562 | 2016-04-06 19:20:02 +0200 | [diff] [blame] | 133 | # mips32r6 is not supported by the NDK. No released NDK contains these |
| 134 | # libraries, but the r10 in prebuilts/ndk had a local hack to add them :( |
| 135 | # |
| 136 | # We need to find a real solution to this problem, but until we do just drop |
| 137 | # mips32r6 things back to r10 to get the tree building again. |
| 138 | ifeq (mips32r6,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH_VARIANT)) |
| 139 | ifeq ($(LOCAL_NDK_VERSION), current) |
| 140 | LOCAL_NDK_VERSION := r10 |
| 141 | endif |
| 142 | endif |
| 143 | |
Dan Albert | 02bf138 | 2016-07-21 10:04:12 -0700 | [diff] [blame] | 144 | my_arch := $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH) |
| 145 | ifneq (,$(filter arm64 mips64 x86_64,$(my_arch))) |
| 146 | my_min_sdk_version := 21 |
| 147 | else |
Dan Albert | 105e4fe | 2017-08-17 16:24:46 -0700 | [diff] [blame] | 148 | my_min_sdk_version := $(MIN_SUPPORTED_SDK_VERSION) |
Dan Albert | 02bf138 | 2016-07-21 10:04:12 -0700 | [diff] [blame] | 149 | endif |
| 150 | |
| 151 | # Historically we've just set up a bunch of symlinks in prebuilts/ndk to map |
| 152 | # missing API levels to existing ones where necessary, but we're not doing |
| 153 | # that for the generated libraries. Clip the API level to the minimum where |
| 154 | # appropriate. |
Dan Willemsen | ffa3258 | 2017-03-19 13:22:45 -0700 | [diff] [blame] | 155 | my_ndk_api := $(LOCAL_SDK_VERSION) |
| 156 | ifneq ($(my_ndk_api),current) |
| 157 | my_ndk_api := $(call math_max,$(my_ndk_api),$(my_min_sdk_version)) |
Dan Albert | 988107d | 2016-11-08 15:10:09 -0800 | [diff] [blame] | 158 | endif |
| 159 | |
Dan Albert | 988107d | 2016-11-08 15:10:09 -0800 | [diff] [blame] | 160 | my_ndk_hist_api := $(my_ndk_api) |
| 161 | ifeq ($(my_ndk_api),current) |
Dan Albert | 988107d | 2016-11-08 15:10:09 -0800 | [diff] [blame] | 162 | # The last API level supported by the old prebuilt NDKs. |
| 163 | my_ndk_hist_api := 24 |
Peter Collingbourne | e3606ae | 2019-07-25 17:43:04 -0700 | [diff] [blame] | 164 | else |
| 165 | my_api_level := $(my_ndk_api) |
Dan Albert | 988107d | 2016-11-08 15:10:09 -0800 | [diff] [blame] | 166 | endif |
| 167 | |
Dan Albert | 02bf138 | 2016-07-21 10:04:12 -0700 | [diff] [blame] | 168 | my_ndk_source_root := \ |
| 169 | $(HISTORICAL_NDK_VERSIONS_ROOT)/$(LOCAL_NDK_VERSION)/sources |
| 170 | my_ndk_sysroot := \ |
Dan Albert | 988107d | 2016-11-08 15:10:09 -0800 | [diff] [blame] | 171 | $(HISTORICAL_NDK_VERSIONS_ROOT)/$(LOCAL_NDK_VERSION)/platforms/android-$(my_ndk_hist_api)/arch-$(my_arch) |
Dan Albert | 02bf138 | 2016-07-21 10:04:12 -0700 | [diff] [blame] | 172 | my_built_ndk := $(SOONG_OUT_DIR)/ndk |
| 173 | my_ndk_triple := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_NDK_TRIPLE) |
| 174 | my_ndk_sysroot_include := \ |
| 175 | $(my_built_ndk)/sysroot/usr/include \ |
| 176 | $(my_built_ndk)/sysroot/usr/include/$(my_ndk_triple) \ |
| 177 | $(my_ndk_sysroot)/usr/include \ |
Dan Albert | 445bc2f | 2015-12-11 12:49:18 -0800 | [diff] [blame] | 178 | |
| 179 | # x86_64 and and mips64 are both multilib toolchains, so their libraries are |
| 180 | # installed in /usr/lib64. Aarch64, on the other hand, is not a multilib |
| 181 | # compiler, so its libraries are in /usr/lib. |
| 182 | # |
| 183 | # Mips32r6 is yet another variation, with libraries installed in libr6. |
| 184 | # |
| 185 | # For the rest, the libraries are installed simply to /usr/lib. |
Dan Albert | 02bf138 | 2016-07-21 10:04:12 -0700 | [diff] [blame] | 186 | ifneq (,$(filter x86_64 mips64,$(my_arch))) |
| 187 | my_ndk_libdir_name := lib64 |
Duane Sand | 1a07487 | 2014-11-08 15:25:18 -0800 | [diff] [blame] | 188 | else ifeq (mips32r6,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH_VARIANT)) |
Dan Albert | 02bf138 | 2016-07-21 10:04:12 -0700 | [diff] [blame] | 189 | my_ndk_libdir_name := libr6 |
Andrew Hsieh | 140761af0 | 2014-04-25 23:47:10 -0700 | [diff] [blame] | 190 | else |
Dan Albert | 02bf138 | 2016-07-21 10:04:12 -0700 | [diff] [blame] | 191 | my_ndk_libdir_name := lib |
Andrew Hsieh | 140761af0 | 2014-04-25 23:47:10 -0700 | [diff] [blame] | 192 | endif |
Ying Wang | cce4c97 | 2011-03-03 18:53:53 -0800 | [diff] [blame] | 193 | |
Dan Albert | 02bf138 | 2016-07-21 10:04:12 -0700 | [diff] [blame] | 194 | my_ndk_platform_dir := \ |
| 195 | $(my_built_ndk)/platforms/android-$(my_ndk_api)/arch-$(my_arch) |
| 196 | my_built_ndk_libs := $(my_ndk_platform_dir)/usr/$(my_ndk_libdir_name) |
| 197 | my_ndk_sysroot_lib := $(my_ndk_sysroot)/usr/$(my_ndk_libdir_name) |
| 198 | |
Dan Willemsen | ffa3258 | 2017-03-19 13:22:45 -0700 | [diff] [blame] | 199 | # The bionic linker now has support for packed relocations and gnu style |
| 200 | # hashes (which are much faster!), but shipping to older devices requires |
| 201 | # the old style hash. Fortunately, we can build with both and it'll work |
| 202 | # anywhere. |
| 203 | # |
| 204 | # This is not currently supported on MIPS architectures. |
| 205 | ifeq (,$(filter mips mips64,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))) |
| 206 | my_ldflags += -Wl,--hash-style=both |
Dan Willemsen | bab0fa6 | 2016-11-18 14:05:39 -0800 | [diff] [blame] | 207 | endif |
Dan Albert | d3d894d | 2014-11-14 15:28:49 -0800 | [diff] [blame] | 208 | |
Dan Willemsen | ffa3258 | 2017-03-19 13:22:45 -0700 | [diff] [blame] | 209 | # We don't want to expose the relocation packer to the NDK just yet. |
| 210 | LOCAL_PACK_MODULE_RELOCATIONS := false |
| 211 | |
Ying Wang | cce4c97 | 2011-03-03 18:53:53 -0800 | [diff] [blame] | 212 | # Set up the NDK stl variant. Starting from NDK-r5 the c++ stl resides in a separate location. |
| 213 | # See ndk/docs/CPLUSPLUS-SUPPORT.html |
| 214 | my_ndk_stl_include_path := |
| 215 | my_ndk_stl_shared_lib_fullpath := |
Ying Wang | cce4c97 | 2011-03-03 18:53:53 -0800 | [diff] [blame] | 216 | my_ndk_stl_static_lib := |
Duane Sand | 1a07487 | 2014-11-08 15:25:18 -0800 | [diff] [blame] | 217 | my_cpu_variant := $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)CPU_ABI) |
Nikola Veljkovic | f738562 | 2016-04-06 19:20:02 +0200 | [diff] [blame] | 218 | ifeq (mips32r6,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH_VARIANT)) |
| 219 | my_cpu_variant := mips32r6 |
| 220 | endif |
Andrew Hsieh | 73d800e | 2014-03-04 17:11:52 +0800 | [diff] [blame] | 221 | LOCAL_NDK_STL_VARIANT := $(strip $(LOCAL_NDK_STL_VARIANT)) |
Ying Wang | cce4c97 | 2011-03-03 18:53:53 -0800 | [diff] [blame] | 222 | ifeq (,$(LOCAL_NDK_STL_VARIANT)) |
Dan Albert | 3709968 | 2017-12-15 20:01:03 +0000 | [diff] [blame] | 223 | LOCAL_NDK_STL_VARIANT := system |
Ying Wang | cce4c97 | 2011-03-03 18:53:53 -0800 | [diff] [blame] | 224 | endif |
Dan Albert | 19fbd1c | 2018-01-04 13:34:21 -0800 | [diff] [blame] | 225 | ifneq (1,$(words $(filter none system c++_static c++_shared, $(LOCAL_NDK_STL_VARIANT)))) |
Ying Wang | 848020f | 2012-08-14 10:13:16 -0700 | [diff] [blame] | 226 | $(error $(LOCAL_PATH): Unknown LOCAL_NDK_STL_VARIANT $(LOCAL_NDK_STL_VARIANT)) |
Ying Wang | cce4c97 | 2011-03-03 18:53:53 -0800 | [diff] [blame] | 227 | endif |
Dan Albert | 19fbd1c | 2018-01-04 13:34:21 -0800 | [diff] [blame] | 228 | |
Ying Wang | cce4c97 | 2011-03-03 18:53:53 -0800 | [diff] [blame] | 229 | ifeq (system,$(LOCAL_NDK_STL_VARIANT)) |
| 230 | my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/system/include |
Dan Albert | 0e2e71d | 2015-12-09 14:46:13 -0800 | [diff] [blame] | 231 | my_system_shared_libraries += libstdc++ |
Dan Albert | 19fbd1c | 2018-01-04 13:34:21 -0800 | [diff] [blame] | 232 | else ifneq (,$(filter c++_%, $(LOCAL_NDK_STL_VARIANT))) |
Dan Albert | 3d1d1ea | 2017-12-15 15:25:06 -0800 | [diff] [blame] | 233 | my_ndk_stl_include_path := \ |
| 234 | $(my_ndk_source_root)/cxx-stl/llvm-libc++/include |
| 235 | my_ndk_stl_include_path += \ |
| 236 | $(my_ndk_source_root)/cxx-stl/llvm-libc++abi/include |
Dan Albert | 0960770 | 2016-08-08 17:14:59 -0700 | [diff] [blame] | 237 | |
| 238 | my_libcxx_libdir := \ |
| 239 | $(my_ndk_source_root)/cxx-stl/llvm-libc++/libs/$(my_cpu_variant) |
| 240 | |
Dan Albert | 3d1d1ea | 2017-12-15 15:25:06 -0800 | [diff] [blame] | 241 | ifeq (c++_static,$(LOCAL_NDK_STL_VARIANT)) |
| 242 | my_ndk_stl_static_lib := \ |
| 243 | $(my_libcxx_libdir)/libc++_static.a \ |
| 244 | $(my_libcxx_libdir)/libc++abi.a |
Dan Albert | 0960770 | 2016-08-08 17:14:59 -0700 | [diff] [blame] | 245 | else |
Dan Albert | 3d1d1ea | 2017-12-15 15:25:06 -0800 | [diff] [blame] | 246 | my_ndk_stl_shared_lib_fullpath := $(my_libcxx_libdir)/libc++_shared.so |
| 247 | endif |
Dan Albert | 0960770 | 2016-08-08 17:14:59 -0700 | [diff] [blame] | 248 | |
Dan Albert | e6d958a | 2018-11-15 11:33:21 -0800 | [diff] [blame] | 249 | ifneq ($(my_ndk_api),current) |
| 250 | ifeq ($(call math_lt,$(my_ndk_api),21),true) |
| 251 | my_ndk_stl_include_path += $(my_ndk_source_root)/android/support/include |
| 252 | my_ndk_stl_static_lib += $(my_libcxx_libdir)/libandroid_support.a |
| 253 | endif |
| 254 | endif |
| 255 | |
Dan Albert | 3d1d1ea | 2017-12-15 15:25:06 -0800 | [diff] [blame] | 256 | ifneq (,$(filter armeabi armeabi-v7a,$(my_cpu_variant))) |
| 257 | my_ndk_stl_static_lib += $(my_libcxx_libdir)/libunwind.a |
Dan Albert | 658d1e0 | 2016-03-22 17:17:40 -0700 | [diff] [blame] | 258 | endif |
| 259 | |
Dan Albert | 2936a1e | 2016-09-14 16:08:04 -0700 | [diff] [blame] | 260 | my_ldlibs += -ldl |
Dan Albert | 0e2e71d | 2015-12-09 14:46:13 -0800 | [diff] [blame] | 261 | else # LOCAL_NDK_STL_VARIANT must be none |
| 262 | # Do nothing. |
| 263 | endif |
Pirama Arumuga Nainar | 9305e20 | 2018-12-20 13:47:44 -0800 | [diff] [blame] | 264 | |
| 265 | # Clang's coverage/profile runtime needs symbols like 'stderr' that were not |
| 266 | # exported from libc prior to API level 23 |
| 267 | ifneq ($(my_ndk_api),current) |
| 268 | ifeq ($(call math_lt, $(my_ndk_api),23),true) |
| 269 | my_native_coverage := false |
| 270 | endif |
| 271 | endif |
Dan Willemsen | ffa3258 | 2017-03-19 13:22:45 -0700 | [diff] [blame] | 272 | endif |
| 273 | |
Pirama Arumuga Nainar | b8f898e | 2019-07-02 23:49:19 -0700 | [diff] [blame] | 274 | ifeq ($(NATIVE_COVERAGE),true) |
| 275 | ifndef LOCAL_IS_HOST_MODULE |
| 276 | my_ldflags += -Wl,--wrap,getenv |
| 277 | |
| 278 | ifneq ($(LOCAL_MODULE_CLASS),STATIC_LIBRARIES) |
| 279 | ifeq ($(LOCAL_SDK_VERSION),) |
| 280 | my_whole_static_libraries += libprofile-extras |
| 281 | else |
| 282 | my_whole_static_libraries += libprofile-extras_ndk |
| 283 | endif |
| 284 | endif |
| 285 | endif |
| 286 | endif |
| 287 | |
Dan Willemsen | ffa3258 | 2017-03-19 13:22:45 -0700 | [diff] [blame] | 288 | ifneq ($(LOCAL_USE_VNDK),) |
Justin Yun | 65c680e | 2018-03-20 07:16:14 +0900 | [diff] [blame] | 289 | # Required VNDK version for vendor modules is BOARD_VNDK_VERSION. |
Peter Collingbourne | e3606ae | 2019-07-25 17:43:04 -0700 | [diff] [blame] | 290 | my_api_level := $(BOARD_VNDK_VERSION) |
| 291 | ifeq ($(my_api_level),current) |
Justin Yun | 65c680e | 2018-03-20 07:16:14 +0900 | [diff] [blame] | 292 | # Build with current PLATFORM_VNDK_VERSION. |
| 293 | # If PLATFORM_VNDK_VERSION has a CODENAME, it will return |
| 294 | # __ANDROID_API_FUTURE__. |
Peter Collingbourne | e3606ae | 2019-07-25 17:43:04 -0700 | [diff] [blame] | 295 | my_api_level := $(call codename-or-sdk-to-sdk,$(PLATFORM_VNDK_VERSION)) |
Justin Yun | 65c680e | 2018-03-20 07:16:14 +0900 | [diff] [blame] | 296 | endif |
Peter Collingbourne | e3606ae | 2019-07-25 17:43:04 -0700 | [diff] [blame] | 297 | my_cflags += -D__ANDROID_VNDK__ |
Dan Albert | c1ca190 | 2016-08-04 14:14:50 -0700 | [diff] [blame] | 298 | endif |
Dan Albert | 02bf138 | 2016-07-21 10:04:12 -0700 | [diff] [blame] | 299 | |
Dan Albert | c1ca190 | 2016-08-04 14:14:50 -0700 | [diff] [blame] | 300 | ifndef LOCAL_IS_HOST_MODULE |
| 301 | # For device libraries, move LOCAL_LDLIBS references to my_shared_libraries. We |
| 302 | # no longer need to use my_ldlibs to pick up NDK prebuilt libraries since we're |
| 303 | # linking my_shared_libraries by full path now. |
| 304 | my_allowed_ldlibs := |
| 305 | |
| 306 | # Sort ldlibs and ldflags between -l and other linker flags |
| 307 | # We'll do this again later, since there are still changes happening, but that's fine. |
| 308 | my_ldlib_flags := $(my_ldflags) $(my_ldlibs) |
| 309 | my_ldlibs := $(filter -l%,$(my_ldlib_flags)) |
| 310 | my_ldflags := $(filter-out -l%,$(my_ldlib_flags)) |
| 311 | my_ldlib_flags := |
| 312 | |
| 313 | # Move other ldlibs back to shared libraries |
| 314 | my_shared_libraries += $(patsubst -l%,lib%,$(filter-out $(my_allowed_ldlibs),$(my_ldlibs))) |
| 315 | my_ldlibs := $(filter $(my_allowed_ldlibs),$(my_ldlibs)) |
Colin Cross | 0bd335f | 2017-09-08 14:41:22 -0700 | [diff] [blame] | 316 | else # LOCAL_IS_HOST_MODULE |
Dan Willemsen | a3a06fe | 2017-09-26 20:26:11 -0700 | [diff] [blame] | 317 | # Add -ldl, -lpthread, -lm and -lrt to host builds to match the default behavior of |
Colin Cross | 0bd335f | 2017-09-08 14:41:22 -0700 | [diff] [blame] | 318 | # device builds |
Dan Willemsen | f264690 | 2019-01-25 16:54:37 -0800 | [diff] [blame] | 319 | my_ldlibs += -ldl -lpthread -lm |
| 320 | ifneq ($(HOST_OS),darwin) |
| 321 | my_ldlibs += -lrt |
Colin Cross | 0bd335f | 2017-09-08 14:41:22 -0700 | [diff] [blame] | 322 | endif |
Dan Albert | c1ca190 | 2016-08-04 14:14:50 -0700 | [diff] [blame] | 323 | endif |
| 324 | |
Dan Willemsen | ffa3258 | 2017-03-19 13:22:45 -0700 | [diff] [blame] | 325 | ifneq ($(LOCAL_SDK_VERSION),) |
Dan Albert | c1ca190 | 2016-08-04 14:14:50 -0700 | [diff] [blame] | 326 | my_all_ndk_libraries := \ |
| 327 | $(NDK_MIGRATED_LIBS) $(addprefix lib,$(NDK_PREBUILT_SHARED_LIBRARIES)) |
| 328 | my_ndk_shared_libraries := \ |
| 329 | $(filter $(my_all_ndk_libraries),\ |
| 330 | $(my_shared_libraries) $(my_system_shared_libraries)) |
| 331 | |
| 332 | my_shared_libraries := \ |
| 333 | $(filter-out $(my_all_ndk_libraries),$(my_shared_libraries)) |
Dan Albert | 02bf138 | 2016-07-21 10:04:12 -0700 | [diff] [blame] | 334 | my_system_shared_libraries := \ |
Dan Albert | c1ca190 | 2016-08-04 14:14:50 -0700 | [diff] [blame] | 335 | $(filter-out $(my_all_ndk_libraries),$(my_system_shared_libraries)) |
Ying Wang | 1a08100 | 2010-07-13 14:55:47 -0700 | [diff] [blame] | 336 | endif |
| 337 | |
Dan Albert | 95994de | 2014-08-07 18:29:11 -0700 | [diff] [blame] | 338 | # MinGW spits out warnings about -fPIC even for -fpie?!) being ignored because |
| 339 | # all code is position independent, and then those warnings get promoted to |
| 340 | # errors. |
Alexey Polyudov | cbb038c | 2016-08-01 17:36:39 -0700 | [diff] [blame] | 341 | ifneq ($(LOCAL_NO_PIC),true) |
Dan Willemsen | f264690 | 2019-01-25 16:54:37 -0800 | [diff] [blame] | 342 | ifneq ($(filter EXECUTABLES NATIVE_TESTS,$(LOCAL_MODULE_CLASS)),) |
| 343 | my_cflags += -fPIE |
| 344 | ifndef BUILD_HOST_static |
| 345 | ifneq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true) |
| 346 | my_ldflags += -pie |
Colin Cross | feb4a7e | 2018-09-19 14:45:52 -0700 | [diff] [blame] | 347 | endif |
Colin Cross | feb4a7e | 2018-09-19 14:45:52 -0700 | [diff] [blame] | 348 | endif |
Dan Willemsen | f264690 | 2019-01-25 16:54:37 -0800 | [diff] [blame] | 349 | else |
| 350 | my_cflags += -fPIC |
Colin Cross | feb4a7e | 2018-09-19 14:45:52 -0700 | [diff] [blame] | 351 | endif |
Alexey Polyudov | cbb038c | 2016-08-01 17:36:39 -0700 | [diff] [blame] | 352 | endif |
Dan Albert | 4803ce2 | 2014-08-06 12:36:46 -0700 | [diff] [blame] | 353 | |
Dan Willemsen | 7a54985 | 2015-08-13 17:51:40 -0700 | [diff] [blame] | 354 | ifdef LOCAL_IS_HOST_MODULE |
Dan Willemsen | 85ac8d2 | 2015-08-18 17:47:06 -0700 | [diff] [blame] | 355 | my_src_files += $(LOCAL_SRC_FILES_$($(my_prefix)OS)) $(LOCAL_SRC_FILES_$($(my_prefix)OS)_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) |
Dan Willemsen | 7a54985 | 2015-08-13 17:51:40 -0700 | [diff] [blame] | 356 | my_static_libraries += $(LOCAL_STATIC_LIBRARIES_$($(my_prefix)OS)) |
| 357 | my_shared_libraries += $(LOCAL_SHARED_LIBRARIES_$($(my_prefix)OS)) |
Dan Willemsen | 8dae49c | 2017-02-15 15:48:11 -0800 | [diff] [blame] | 358 | my_header_libraries += $(LOCAL_HEADER_LIBRARIES_$($(my_prefix)OS)) |
Dan Willemsen | 7a54985 | 2015-08-13 17:51:40 -0700 | [diff] [blame] | 359 | my_cflags += $(LOCAL_CFLAGS_$($(my_prefix)OS)) |
| 360 | my_cppflags += $(LOCAL_CPPFLAGS_$($(my_prefix)OS)) |
| 361 | my_ldflags += $(LOCAL_LDFLAGS_$($(my_prefix)OS)) |
| 362 | my_ldlibs += $(LOCAL_LDLIBS_$($(my_prefix)OS)) |
| 363 | my_asflags += $(LOCAL_ASFLAGS_$($(my_prefix)OS)) |
| 364 | my_c_includes += $(LOCAL_C_INCLUDES_$($(my_prefix)OS)) |
| 365 | my_generated_sources += $(LOCAL_GENERATED_SOURCES_$($(my_prefix)OS)) |
| 366 | endif |
| 367 | |
Ying Wang | 6feb6d5 | 2014-04-17 10:03:35 -0700 | [diff] [blame] | 368 | my_src_files += $(LOCAL_SRC_FILES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_SRC_FILES_$(my_32_64_bit_suffix)) |
Colin Cross | a04abc8 | 2015-06-30 12:21:59 -0700 | [diff] [blame] | 369 | 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)) |
Ying Wang | 6feb6d5 | 2014-04-17 10:03:35 -0700 | [diff] [blame] | 370 | my_shared_libraries += $(LOCAL_SHARED_LIBRARIES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_SHARED_LIBRARIES_$(my_32_64_bit_suffix)) |
| 371 | my_cflags += $(LOCAL_CFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CFLAGS_$(my_32_64_bit_suffix)) |
| 372 | my_cppflags += $(LOCAL_CPPFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CPPFLAGS_$(my_32_64_bit_suffix)) |
| 373 | my_ldflags += $(LOCAL_LDFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_LDFLAGS_$(my_32_64_bit_suffix)) |
| 374 | my_asflags += $(LOCAL_ASFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_ASFLAGS_$(my_32_64_bit_suffix)) |
| 375 | my_c_includes += $(LOCAL_C_INCLUDES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_C_INCLUDES_$(my_32_64_bit_suffix)) |
| 376 | my_generated_sources += $(LOCAL_GENERATED_SOURCES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_GENERATED_SOURCES_$(my_32_64_bit_suffix)) |
Colin Cross | f4f2fbe | 2014-02-12 21:15:12 -0800 | [diff] [blame] | 377 | |
Dan Willemsen | c29172c | 2015-12-03 22:58:39 -0800 | [diff] [blame] | 378 | my_missing_exclude_files := $(filter-out $(my_src_files),$(my_src_files_exclude)) |
| 379 | ifneq ($(my_missing_exclude_files),) |
| 380 | $(warning Files are listed in LOCAL_SRC_FILES_EXCLUDE but not LOCAL_SRC_FILES) |
| 381 | $(error $(my_missing_exclude_files)) |
| 382 | endif |
Colin Cross | a04abc8 | 2015-06-30 12:21:59 -0700 | [diff] [blame] | 383 | my_src_files := $(filter-out $(my_src_files_exclude),$(my_src_files)) |
| 384 | |
Dan Willemsen | c57894c | 2016-10-28 16:30:48 -0700 | [diff] [blame] | 385 | # Strip '/' from the beginning of each src file. This helps the ../ detection in case |
| 386 | # the source file is in the form of /../file |
| 387 | my_src_files := $(patsubst /%,%,$(my_src_files)) |
| 388 | |
Dan Albert | db905e7 | 2014-08-18 11:14:38 -0700 | [diff] [blame] | 389 | my_clang := $(strip $(LOCAL_CLANG)) |
Ying Wang | 824344a | 2014-05-27 13:03:36 -0700 | [diff] [blame] | 390 | ifdef LOCAL_CLANG_$(my_32_64_bit_suffix) |
Dan Albert | db905e7 | 2014-08-18 11:14:38 -0700 | [diff] [blame] | 391 | my_clang := $(strip $(LOCAL_CLANG_$(my_32_64_bit_suffix))) |
Ying Wang | 824344a | 2014-05-27 13:03:36 -0700 | [diff] [blame] | 392 | endif |
| 393 | ifdef LOCAL_CLANG_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH) |
Dan Albert | db905e7 | 2014-08-18 11:14:38 -0700 | [diff] [blame] | 394 | my_clang := $(strip $(LOCAL_CLANG_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))) |
Ying Wang | 824344a | 2014-05-27 13:03:36 -0700 | [diff] [blame] | 395 | endif |
Chih-Hung Hsieh | d9cd1fa | 2016-08-02 14:22:06 -0700 | [diff] [blame] | 396 | ifeq ($(my_clang),false) |
Dan Willemsen | f063839 | 2018-09-04 22:25:22 -0700 | [diff] [blame] | 397 | $(call pretty-error,LOCAL_CLANG false is no longer supported) |
Dan Willemsen | 7728817 | 2015-09-09 15:45:21 -0700 | [diff] [blame] | 398 | endif |
| 399 | |
Dan Albert | 76bfcd4 | 2017-02-03 16:16:11 -0800 | [diff] [blame] | 400 | ifeq ($(LOCAL_C_STD),) |
| 401 | my_c_std_version := $(DEFAULT_C_STD_VERSION) |
| 402 | else ifeq ($(LOCAL_C_STD),experimental) |
| 403 | my_c_std_version := $(EXPERIMENTAL_C_STD_VERSION) |
| 404 | else |
| 405 | my_c_std_version := $(LOCAL_C_STD) |
| 406 | endif |
| 407 | |
| 408 | ifeq ($(LOCAL_CPP_STD),) |
| 409 | my_cpp_std_version := $(DEFAULT_CPP_STD_VERSION) |
| 410 | else ifeq ($(LOCAL_CPP_STD),experimental) |
| 411 | my_cpp_std_version := $(EXPERIMENTAL_CPP_STD_VERSION) |
| 412 | else |
| 413 | my_cpp_std_version := $(LOCAL_CPP_STD) |
| 414 | endif |
Dan Albert | da63739 | 2015-10-26 11:09:24 -0700 | [diff] [blame] | 415 | |
Colin Cross | e56e356 | 2016-10-17 15:34:29 -0700 | [diff] [blame] | 416 | my_c_std_conlyflags := |
| 417 | my_cpp_std_cppflags := |
| 418 | ifneq (,$(my_c_std_version)) |
| 419 | my_c_std_conlyflags := -std=$(my_c_std_version) |
| 420 | endif |
Dan Albert | c7d307d | 2015-07-29 15:13:57 -0700 | [diff] [blame] | 421 | |
Colin Cross | e56e356 | 2016-10-17 15:34:29 -0700 | [diff] [blame] | 422 | ifneq (,$(my_cpp_std_version)) |
| 423 | my_cpp_std_cppflags := -std=$(my_cpp_std_version) |
| 424 | endif |
Tim Murray | 06659bc | 2014-08-13 11:53:07 -0700 | [diff] [blame] | 425 | |
Yi Kong | 42e1896 | 2018-06-06 16:42:22 -0700 | [diff] [blame] | 426 | # Extra cflags for projects under external/ directory |
Yi Kong | 0047dbe | 2018-06-12 15:28:26 -0700 | [diff] [blame] | 427 | ifneq ($(filter external/%,$(LOCAL_PATH)),) |
Yi Kong | 42e1896 | 2018-06-06 16:42:22 -0700 | [diff] [blame] | 428 | my_cflags += $(CLANG_EXTERNAL_CFLAGS) |
| 429 | endif |
Yi Kong | 42e1896 | 2018-06-06 16:42:22 -0700 | [diff] [blame] | 430 | |
Colin Cross | f4f2fbe | 2014-02-12 21:15:12 -0800 | [diff] [blame] | 431 | # arch-specific static libraries go first so that generic ones can depend on them |
Ying Wang | 6feb6d5 | 2014-04-17 10:03:35 -0700 | [diff] [blame] | 432 | 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) |
| 433 | 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) |
Dan Willemsen | 8dae49c | 2017-02-15 15:48:11 -0800 | [diff] [blame] | 434 | 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) |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 435 | |
Ying Wang | 75e8fcb | 2014-10-07 13:03:29 -0700 | [diff] [blame] | 436 | include $(BUILD_SYSTEM)/cxx_stl_setup.mk |
Ying Wang | d90de32 | 2014-05-23 16:42:37 -0700 | [diff] [blame] | 437 | |
Ying Wang | 285045b | 2013-08-13 12:35:10 -0700 | [diff] [blame] | 438 | # Add static HAL libraries |
| 439 | ifdef LOCAL_HAL_STATIC_LIBRARIES |
| 440 | $(foreach lib, $(LOCAL_HAL_STATIC_LIBRARIES), \ |
| 441 | $(eval b_lib := $(filter $(lib).%,$(BOARD_HAL_STATIC_LIBRARIES)))\ |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 442 | $(if $(b_lib), $(eval my_static_libraries += $(b_lib)),\ |
| 443 | $(eval my_static_libraries += $(lib).default))) |
Ying Wang | 285045b | 2013-08-13 12:35:10 -0700 | [diff] [blame] | 444 | b_lib := |
| 445 | endif |
| 446 | |
Nicolas Geoffray | b7c9f32 | 2015-09-25 13:54:09 +0100 | [diff] [blame] | 447 | ifneq ($(strip $(CUSTOM_$(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)LINKER)),) |
| 448 | my_linker := $(CUSTOM_$(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)LINKER) |
| 449 | else |
Alexey Polyudov | ccdc311 | 2016-08-01 17:41:49 -0700 | [diff] [blame] | 450 | my_linker := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)LINKER) |
Nicolas Geoffray | b7c9f32 | 2015-09-25 13:54:09 +0100 | [diff] [blame] | 451 | endif |
Evgenii Stepanov | 8f5e67a | 2015-07-10 18:06:51 -0700 | [diff] [blame] | 452 | |
Dan Albert | 4ae5d4b | 2014-10-31 16:23:08 -0700 | [diff] [blame] | 453 | include $(BUILD_SYSTEM)/config_sanitizers.mk |
Evgeniy Stepanov | 6cc9c06 | 2012-03-30 12:15:12 +0400 | [diff] [blame] | 454 | |
Dan Willemsen | fc92fb2 | 2016-08-26 13:27:13 -0700 | [diff] [blame] | 455 | ifneq ($(filter ../%,$(my_src_files)),) |
| 456 | my_soong_problems += dotdot_srcs |
| 457 | endif |
| 458 | ifneq ($(foreach i,$(my_c_includes),$(filter %/..,$(i))$(findstring /../,$(i))),) |
| 459 | my_soong_problems += dotdot_incs |
| 460 | endif |
Dan Willemsen | fc92fb2 | 2016-08-26 13:27:13 -0700 | [diff] [blame] | 461 | |
Jing Yu | 2dcc806 | 2009-09-21 16:31:50 -0700 | [diff] [blame] | 462 | #################################################### |
| 463 | ## Add FDO flags if FDO is turned on and supported |
Dehao Chen | 295a6d2 | 2014-09-19 10:18:12 -0700 | [diff] [blame] | 464 | ## Please note that we will do option filtering during FDO build. |
| 465 | ## i.e. Os->O2, remove -fno-early-inline and -finline-limit. |
| 466 | ################################################################## |
Ying Wang | 45d0143 | 2014-10-28 14:50:59 -0700 | [diff] [blame] | 467 | my_fdo_build := |
| 468 | ifneq ($(filter true always, $(LOCAL_FDO_SUPPORT)),) |
| 469 | ifeq ($(BUILD_FDO_INSTRUMENT),true) |
| 470 | my_cflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_FDO_INSTRUMENT_CFLAGS) |
| 471 | my_ldflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_FDO_INSTRUMENT_LDFLAGS) |
| 472 | my_fdo_build := true |
| 473 | else ifneq ($(filter true,$(BUILD_FDO_OPTIMIZE))$(filter always,$(LOCAL_FDO_SUPPORT)),) |
| 474 | my_cflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_FDO_OPTIMIZE_CFLAGS) |
| 475 | my_fdo_build := true |
synergydev | 4a60576 | 2013-08-05 02:44:37 -0700 | [diff] [blame] | 476 | endif |
Shinichiro Hamaji | 09295a8 | 2015-09-24 17:51:20 +0900 | [diff] [blame] | 477 | # Disable ccache (or other compiler wrapper) except gomacc, which |
| 478 | # can handle -fprofile-use properly. |
Colin Cross | 23dcf76 | 2019-11-11 16:04:34 -0800 | [diff] [blame^] | 479 | my_cc_wrapper := $(filter $(GOMA_CC) $(RBE_WRAPPER),$(my_cc_wrapper)) |
| 480 | my_cxx_wrapper := $(filter $(GOMA_CC) $(RBE_WRAPPER),$(my_cxx_wrapper)) |
Jing Yu | 2dcc806 | 2009-09-21 16:31:50 -0700 | [diff] [blame] | 481 | endif |
| 482 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 483 | ########################################################### |
Jim Huang | 20d1ba6 | 2010-10-14 16:15:56 +0800 | [diff] [blame] | 484 | ## Explicitly declare assembly-only __ASSEMBLY__ macro for |
| 485 | ## assembly source |
| 486 | ########################################################### |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 487 | my_asflags += -D__ASSEMBLY__ |
Jim Huang | 20d1ba6 | 2010-10-14 16:15:56 +0800 | [diff] [blame] | 488 | |
Dan Willemsen | ffa3258 | 2017-03-19 13:22:45 -0700 | [diff] [blame] | 489 | ########################################################### |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 490 | # TODO: support a mix of standard extensions so that this isn't necessary |
| 491 | LOCAL_CPP_EXTENSION := $(strip $(LOCAL_CPP_EXTENSION)) |
| 492 | ifeq ($(LOCAL_CPP_EXTENSION),) |
| 493 | LOCAL_CPP_EXTENSION := .cpp |
| 494 | endif |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 495 | |
| 496 | # Certain modules like libdl have to have symbols resolved at runtime and blow |
| 497 | # up if --no-undefined is passed to the linker. |
| 498 | ifeq ($(strip $(LOCAL_NO_DEFAULT_COMPILER_FLAGS)),) |
Colin Cross | a82fa12 | 2016-10-20 12:38:21 -0700 | [diff] [blame] | 499 | ifeq ($(my_allow_undefined_symbols),) |
| 500 | ifneq ($(HOST_OS),darwin) |
| 501 | my_ldflags += -Wl,--no-undefined |
| 502 | endif |
| 503 | else |
| 504 | ifdef LOCAL_IS_HOST_MODULE |
| 505 | ifeq ($(HOST_OS),darwin) |
| 506 | # darwin defaults to treating undefined symbols as errors |
| 507 | my_ldflags += -Wl,-undefined,dynamic_lookup |
| 508 | endif |
| 509 | endif |
| 510 | endif |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 511 | endif |
| 512 | |
Ying Wang | fcdabd4 | 2011-04-25 14:22:41 -0700 | [diff] [blame] | 513 | ifeq (true,$(LOCAL_GROUP_STATIC_LIBRARIES)) |
| 514 | $(LOCAL_BUILT_MODULE): PRIVATE_GROUP_STATIC_LIBRARIES := true |
| 515 | else |
| 516 | $(LOCAL_BUILT_MODULE): PRIVATE_GROUP_STATIC_LIBRARIES := |
| 517 | endif |
| 518 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 519 | ########################################################### |
| 520 | ## Define arm-vs-thumb-mode flags. |
| 521 | ########################################################### |
| 522 | LOCAL_ARM_MODE := $(strip $(LOCAL_ARM_MODE)) |
Ying Wang | faeb693 | 2015-04-07 11:59:34 -0700 | [diff] [blame] | 523 | ifeq ($($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH),arm) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 524 | normal_objects_mode := $(if $(LOCAL_ARM_MODE),$(LOCAL_ARM_MODE),thumb) |
| 525 | |
Dave Bort | 9528248 | 2009-04-23 18:44:55 -0700 | [diff] [blame] | 526 | # Read the values from something like TARGET_arm_CFLAGS or |
| 527 | # TARGET_thumb_CFLAGS. HOST_(arm|thumb)_CFLAGS values aren't |
| 528 | # actually used (although they are usually empty). |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 529 | normal_objects_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)$(normal_objects_mode)_CFLAGS) |
Evgeniy Stepanov | f50f4c5 | 2012-04-05 11:44:37 +0400 | [diff] [blame] | 530 | |
Chih-Wei Huang | 0d09e58 | 2010-07-09 10:07:52 +0800 | [diff] [blame] | 531 | else |
Chih-Wei Huang | 0d09e58 | 2010-07-09 10:07:52 +0800 | [diff] [blame] | 532 | normal_objects_mode := |
Chih-Wei Huang | 0d09e58 | 2010-07-09 10:07:52 +0800 | [diff] [blame] | 533 | normal_objects_cflags := |
| 534 | endif |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 535 | |
| 536 | ########################################################### |
| 537 | ## Define per-module debugging flags. Users can turn on |
| 538 | ## debugging for a particular module by setting DEBUG_MODULE_ModuleName |
| 539 | ## to a non-empty value in their environment or buildspec.mk, |
| 540 | ## and setting HOST_/TARGET_CUSTOM_DEBUG_CFLAGS to the |
| 541 | ## debug flags that they want to use. |
| 542 | ########################################################### |
| 543 | ifdef DEBUG_MODULE_$(strip $(LOCAL_MODULE)) |
| 544 | debug_cflags := $($(my_prefix)CUSTOM_DEBUG_CFLAGS) |
| 545 | else |
| 546 | debug_cflags := |
| 547 | endif |
| 548 | |
Tim Murray | a7aa800 | 2012-10-29 16:06:00 -0700 | [diff] [blame] | 549 | #################################################### |
Dan Willemsen | 3bb168f | 2016-01-19 20:07:08 -0800 | [diff] [blame] | 550 | ## Keep track of src -> obj mapping |
| 551 | #################################################### |
| 552 | |
| 553 | my_tracked_gen_files := |
| 554 | my_tracked_src_files := |
| 555 | |
| 556 | ########################################################### |
| 557 | ## Stuff source generated from one-off tools |
| 558 | ########################################################### |
| 559 | $(my_generated_sources): PRIVATE_MODULE := $(my_register_name) |
| 560 | |
| 561 | my_gen_sources_copy := $(patsubst $(generated_sources_dir)/%,$(intermediates)/%,$(filter $(generated_sources_dir)/%,$(my_generated_sources))) |
| 562 | |
Dan Willemsen | 7f01615 | 2016-02-29 17:52:39 -0800 | [diff] [blame] | 563 | $(my_gen_sources_copy): $(intermediates)/% : $(generated_sources_dir)/% |
Dan Willemsen | 3bb168f | 2016-01-19 20:07:08 -0800 | [diff] [blame] | 564 | @echo "Copy: $@" |
| 565 | $(copy-file-to-target) |
| 566 | |
| 567 | my_generated_sources := $(patsubst $(generated_sources_dir)/%,$(intermediates)/%,$(my_generated_sources)) |
| 568 | |
| 569 | # Generated sources that will actually produce object files. |
| 570 | # Other files (like headers) are allowed in LOCAL_GENERATED_SOURCES, |
| 571 | # since other compiled sources may depend on them, and we set up |
| 572 | # the dependencies. |
Dan Willemsen | 444c323 | 2016-02-04 14:18:48 -0800 | [diff] [blame] | 573 | my_gen_src_files := $(filter %.c %$(LOCAL_CPP_EXTENSION) %.S %.s,$(my_generated_sources)) |
Dan Willemsen | 3bb168f | 2016-01-19 20:07:08 -0800 | [diff] [blame] | 574 | |
| 575 | ALL_GENERATED_SOURCES += $(my_generated_sources) |
| 576 | |
| 577 | #################################################### |
Tim Murray | a7aa800 | 2012-10-29 16:06:00 -0700 | [diff] [blame] | 578 | ## Compile RenderScript with reflected C++ |
| 579 | #################################################### |
| 580 | |
Jeff Vander Stoep | c44aa3b | 2019-07-12 08:33:31 -0700 | [diff] [blame] | 581 | renderscript_sources := $(filter %.rscript %.fs,$(my_src_files)) |
Tim Murray | a7aa800 | 2012-10-29 16:06:00 -0700 | [diff] [blame] | 582 | |
| 583 | ifneq (,$(renderscript_sources)) |
Dan Willemsen | fc92fb2 | 2016-08-26 13:27:13 -0700 | [diff] [blame] | 584 | my_soong_problems += rs |
Tim Murray | a7aa800 | 2012-10-29 16:06:00 -0700 | [diff] [blame] | 585 | |
| 586 | renderscript_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(renderscript_sources)) |
| 587 | RenderScript_file_stamp := $(intermediates)/RenderScriptCPP.stamp |
| 588 | renderscript_intermediate := $(intermediates)/renderscript |
| 589 | |
Noah Presler | 4796a8c | 2015-08-13 17:04:10 -0700 | [diff] [blame] | 590 | renderscript_target_api := |
| 591 | |
| 592 | ifneq (,$(LOCAL_RENDERSCRIPT_TARGET_API)) |
| 593 | renderscript_target_api := $(LOCAL_RENDERSCRIPT_TARGET_API) |
| 594 | else |
| 595 | ifneq (,$(LOCAL_SDK_VERSION)) |
| 596 | # Set target-api for LOCAL_SDK_VERSIONs other than current. |
Michael Wright | 0fb087f | 2015-11-06 15:20:51 +0000 | [diff] [blame] | 597 | ifneq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION))) |
Sundong Ahn | 5a44d1f | 2017-10-16 19:20:34 +0900 | [diff] [blame] | 598 | renderscript_target_api := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION)) |
Noah Presler | 4796a8c | 2015-08-13 17:04:10 -0700 | [diff] [blame] | 599 | endif |
| 600 | endif # LOCAL_SDK_VERSION is set |
| 601 | endif # LOCAL_RENDERSCRIPT_TARGET_API is set |
| 602 | |
| 603 | |
Tim Murray | a7aa800 | 2012-10-29 16:06:00 -0700 | [diff] [blame] | 604 | ifeq ($(LOCAL_RENDERSCRIPT_CC),) |
| 605 | LOCAL_RENDERSCRIPT_CC := $(LLVM_RS_CC) |
| 606 | endif |
| 607 | |
| 608 | # Turn on all warnings and warnings as errors for RS compiles. |
| 609 | # This can be disabled with LOCAL_RENDERSCRIPT_FLAGS := -Wno-error |
| 610 | renderscript_flags := -Wall -Werror |
| 611 | renderscript_flags += $(LOCAL_RENDERSCRIPT_FLAGS) |
Ying Wang | acaada1 | 2014-09-10 16:11:41 -0700 | [diff] [blame] | 612 | # -m32 or -m64 |
| 613 | renderscript_flags += -m$(my_32_64_bit_suffix) |
Tim Murray | f0020c6 | 2014-09-10 15:11:01 -0700 | [diff] [blame] | 614 | |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 615 | renderscript_includes := \ |
Tim Murray | a7aa800 | 2012-10-29 16:06:00 -0700 | [diff] [blame] | 616 | $(TOPDIR)external/clang/lib/Headers \ |
Jean-Luc Brouillet | eba4493 | 2017-01-08 17:40:21 -0800 | [diff] [blame] | 617 | $(TOPDIR)frameworks/rs/script_api/include \ |
Tim Murray | a7aa800 | 2012-10-29 16:06:00 -0700 | [diff] [blame] | 618 | $(LOCAL_RENDERSCRIPT_INCLUDES) |
| 619 | |
| 620 | ifneq ($(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE),) |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 621 | renderscript_includes := $(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE) |
Tim Murray | a7aa800 | 2012-10-29 16:06:00 -0700 | [diff] [blame] | 622 | endif |
| 623 | |
Ying Wang | b931956 | 2015-04-03 16:15:28 -0700 | [diff] [blame] | 624 | bc_dep_files := $(addprefix $(renderscript_intermediate)/, \ |
Jeff Vander Stoep | c44aa3b | 2019-07-12 08:33:31 -0700 | [diff] [blame] | 625 | $(patsubst %.fs,%.d, $(patsubst %.rscript,%.d, $(notdir $(renderscript_sources))))) |
Ying Wang | b931956 | 2015-04-03 16:15:28 -0700 | [diff] [blame] | 626 | |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 627 | $(RenderScript_file_stamp): PRIVATE_RS_INCLUDES := $(renderscript_includes) |
Tim Murray | a7aa800 | 2012-10-29 16:06:00 -0700 | [diff] [blame] | 628 | $(RenderScript_file_stamp): PRIVATE_RS_CC := $(LOCAL_RENDERSCRIPT_CC) |
| 629 | $(RenderScript_file_stamp): PRIVATE_RS_FLAGS := $(renderscript_flags) |
| 630 | $(RenderScript_file_stamp): PRIVATE_RS_SOURCE_FILES := $(renderscript_sources_fullpath) |
| 631 | $(RenderScript_file_stamp): PRIVATE_RS_OUTPUT_DIR := $(renderscript_intermediate) |
Colin Cross | e2f541b | 2018-05-16 09:53:40 -0700 | [diff] [blame] | 632 | $(RenderScript_file_stamp): PRIVATE_RS_TARGET_API := $(patsubst current,0,$(renderscript_target_api)) |
Ying Wang | b931956 | 2015-04-03 16:15:28 -0700 | [diff] [blame] | 633 | $(RenderScript_file_stamp): PRIVATE_DEP_FILES := $(bc_dep_files) |
Tim Murray | a7aa800 | 2012-10-29 16:06:00 -0700 | [diff] [blame] | 634 | $(RenderScript_file_stamp): $(renderscript_sources_fullpath) $(LOCAL_RENDERSCRIPT_CC) |
| 635 | $(transform-renderscripts-to-cpp-and-bc) |
| 636 | |
Dan Willemsen | 461d844 | 2016-11-10 18:19:36 -0800 | [diff] [blame] | 637 | # include the dependency files (.d) generated by llvm-rs-cc. |
| 638 | $(call include-depfile,$(RenderScript_file_stamp).d,$(RenderScript_file_stamp)) |
Tim Murray | a7aa800 | 2012-10-29 16:06:00 -0700 | [diff] [blame] | 639 | |
| 640 | LOCAL_INTERMEDIATE_TARGETS += $(RenderScript_file_stamp) |
| 641 | |
| 642 | rs_generated_cpps := $(addprefix \ |
Jeff Vander Stoep | c44aa3b | 2019-07-12 08:33:31 -0700 | [diff] [blame] | 643 | $(renderscript_intermediate)/ScriptC_,$(patsubst %.fs,%.cpp, $(patsubst %.rscript,%.cpp, \ |
Tim Murray | a7aa800 | 2012-10-29 16:06:00 -0700 | [diff] [blame] | 644 | $(notdir $(renderscript_sources))))) |
| 645 | |
Dan Willemsen | 3bb168f | 2016-01-19 20:07:08 -0800 | [diff] [blame] | 646 | $(call track-src-file-gen,$(renderscript_sources),$(rs_generated_cpps)) |
| 647 | |
Stephen Hines | 8ff9252 | 2014-06-06 12:51:47 -0700 | [diff] [blame] | 648 | # This is just a dummy rule to make sure gmake doesn't skip updating the dependents. |
Tim Murray | a7aa800 | 2012-10-29 16:06:00 -0700 | [diff] [blame] | 649 | $(rs_generated_cpps) : $(RenderScript_file_stamp) |
Ying Wang | 81ab833 | 2014-05-28 16:17:09 -0700 | [diff] [blame] | 650 | @echo "Updated RS generated cpp file $@." |
Ying Wang | e25b398 | 2015-02-26 18:47:21 -0800 | [diff] [blame] | 651 | $(hide) touch $@ |
Tim Murray | a7aa800 | 2012-10-29 16:06:00 -0700 | [diff] [blame] | 652 | |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 653 | my_c_includes += $(renderscript_intermediate) |
| 654 | my_generated_sources += $(rs_generated_cpps) |
Tim Murray | a7aa800 | 2012-10-29 16:06:00 -0700 | [diff] [blame] | 655 | |
| 656 | endif |
| 657 | |
| 658 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 659 | ########################################################### |
Ying Wang | faeb693 | 2015-04-07 11:59:34 -0700 | [diff] [blame] | 660 | ## Compile the .proto files to .cc (or .c) and then to .o |
Ying Wang | a5fc87a | 2010-11-02 18:43:16 -0700 | [diff] [blame] | 661 | ########################################################### |
Joe Onorato | bfc7811 | 2017-10-07 23:44:05 -0400 | [diff] [blame] | 662 | ifeq ($(strip $(LOCAL_PROTOC_OPTIMIZE_TYPE)),) |
| 663 | LOCAL_PROTOC_OPTIMIZE_TYPE := lite |
| 664 | endif |
Ying Wang | b8e0185 | 2014-01-23 15:09:04 -0800 | [diff] [blame] | 665 | proto_sources := $(filter %.proto,$(my_src_files)) |
Ying Wang | a5fc87a | 2010-11-02 18:43:16 -0700 | [diff] [blame] | 666 | ifneq ($(proto_sources),) |
Ying Wang | 05f9f35 | 2016-05-05 20:02:08 -0700 | [diff] [blame] | 667 | proto_gen_dir := $(generated_sources_dir)/proto |
Shinichiro Hamaji | a3184dc | 2016-04-05 17:34:51 +0900 | [diff] [blame] | 668 | proto_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(proto_sources)) |
Ying Wang | faeb693 | 2015-04-07 11:59:34 -0700 | [diff] [blame] | 669 | |
Ying Wang | 05f9f35 | 2016-05-05 20:02:08 -0700 | [diff] [blame] | 670 | my_rename_cpp_ext := |
Yu Shan | 655f17c | 2019-01-25 17:11:02 -0800 | [diff] [blame] | 671 | 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))) |
Ying Wang | faeb693 | 2015-04-07 11:59:34 -0700 | [diff] [blame] | 672 | my_proto_source_suffix := .c |
| 673 | my_proto_c_includes := external/nanopb-c |
Ying Wang | 05f9f35 | 2016-05-05 20:02:08 -0700 | [diff] [blame] | 674 | my_protoc_flags := --nanopb_out=$(proto_gen_dir) \ |
Yu Shan | 10be65d | 2018-08-03 23:48:10 +0000 | [diff] [blame] | 675 | --plugin=$(HOST_OUT_EXECUTABLES)/protoc-gen-nanopb |
Shinichiro Hamaji | a3184dc | 2016-04-05 17:34:51 +0900 | [diff] [blame] | 676 | my_protoc_deps := $(NANOPB_SRCS) $(proto_sources_fullpath:%.proto=%.options) |
Ying Wang | faeb693 | 2015-04-07 11:59:34 -0700 | [diff] [blame] | 677 | else |
Ying Wang | 05f9f35 | 2016-05-05 20:02:08 -0700 | [diff] [blame] | 678 | my_proto_source_suffix := $(LOCAL_CPP_EXTENSION) |
| 679 | ifneq ($(my_proto_source_suffix),.cc) |
| 680 | # aprotoc is hardcoded to write out only .cc file. |
| 681 | # We need to rename the extension to $(LOCAL_CPP_EXTENSION) if it's not .cc. |
| 682 | my_rename_cpp_ext := true |
| 683 | endif |
Ying Wang | faeb693 | 2015-04-07 11:59:34 -0700 | [diff] [blame] | 684 | my_proto_c_includes := external/protobuf/src |
| 685 | my_cflags += -DGOOGLE_PROTOBUF_NO_RTTI |
Joe Onorato | bfc7811 | 2017-10-07 23:44:05 -0400 | [diff] [blame] | 686 | my_protoc_flags := --cpp_out=$(if $(filter lite lite-static,$(LOCAL_PROTOC_OPTIMIZE_TYPE)),lite:,)$(proto_gen_dir) |
Shinichiro Hamaji | a3184dc | 2016-04-05 17:34:51 +0900 | [diff] [blame] | 687 | my_protoc_deps := |
Ying Wang | faeb693 | 2015-04-07 11:59:34 -0700 | [diff] [blame] | 688 | endif |
Ying Wang | 05f9f35 | 2016-05-05 20:02:08 -0700 | [diff] [blame] | 689 | my_proto_c_includes += $(proto_gen_dir) |
Ying Wang | faeb693 | 2015-04-07 11:59:34 -0700 | [diff] [blame] | 690 | |
Ying Wang | 05f9f35 | 2016-05-05 20:02:08 -0700 | [diff] [blame] | 691 | proto_generated_cpps := $(addprefix $(proto_gen_dir)/, \ |
Ying Wang | faeb693 | 2015-04-07 11:59:34 -0700 | [diff] [blame] | 692 | $(patsubst %.proto,%.pb$(my_proto_source_suffix),$(proto_sources_fullpath))) |
Ying Wang | a5fc87a | 2010-11-02 18:43:16 -0700 | [diff] [blame] | 693 | |
Ying Wang | ead8944 | 2014-02-25 11:18:40 -0800 | [diff] [blame] | 694 | # Ensure the transform-proto-to-cc rule is only defined once in multilib build. |
Ying Wang | 05f9f35 | 2016-05-05 20:02:08 -0700 | [diff] [blame] | 695 | ifndef $(my_host)$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_proto_defined |
| 696 | $(proto_generated_cpps): PRIVATE_PROTO_INCLUDES := $(TOP) |
| 697 | $(proto_generated_cpps): PRIVATE_PROTOC_FLAGS := $(LOCAL_PROTOC_FLAGS) $(my_protoc_flags) |
| 698 | $(proto_generated_cpps): PRIVATE_RENAME_CPP_EXT := $(my_rename_cpp_ext) |
| 699 | $(proto_generated_cpps): $(proto_gen_dir)/%.pb$(my_proto_source_suffix): %.proto $(my_protoc_deps) $(PROTOC) |
Ying Wang | a5fc87a | 2010-11-02 18:43:16 -0700 | [diff] [blame] | 700 | $(transform-proto-to-cc) |
| 701 | |
Ying Wang | 05f9f35 | 2016-05-05 20:02:08 -0700 | [diff] [blame] | 702 | $(my_host)$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_proto_defined := true |
Ying Wang | faeb693 | 2015-04-07 11:59:34 -0700 | [diff] [blame] | 703 | endif |
Ying Wang | 05f9f35 | 2016-05-05 20:02:08 -0700 | [diff] [blame] | 704 | # Ideally we can generate the source directly into $(intermediates). |
| 705 | # But many Android.mks assume the .pb.hs are in $(generated_sources_dir). |
| 706 | # As a workaround, we make a copy in the $(intermediates). |
| 707 | proto_intermediate_dir := $(intermediates)/proto |
| 708 | proto_intermediate_cpps := $(patsubst $(proto_gen_dir)/%,$(proto_intermediate_dir)/%,\ |
| 709 | $(proto_generated_cpps)) |
| 710 | $(proto_intermediate_cpps) : $(proto_intermediate_dir)/% : $(proto_gen_dir)/% |
| 711 | @echo "Copy: $@" |
| 712 | $(copy-file-to-target) |
| 713 | $(hide) cp $(basename $<).h $(basename $@).h |
| 714 | $(call track-src-file-gen,$(proto_sources),$(proto_intermediate_cpps)) |
| 715 | |
| 716 | my_generated_sources += $(proto_intermediate_cpps) |
Ying Wang | a5fc87a | 2010-11-02 18:43:16 -0700 | [diff] [blame] | 717 | |
Ying Wang | faeb693 | 2015-04-07 11:59:34 -0700 | [diff] [blame] | 718 | my_c_includes += $(my_proto_c_includes) |
| 719 | # Auto-export the generated proto source dir. |
| 720 | my_export_c_include_dirs += $(my_proto_c_includes) |
| 721 | |
| 722 | ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nanopb-c-enable_malloc) |
Ying Wang | 8a0d53e | 2015-04-08 09:54:34 -0700 | [diff] [blame] | 723 | my_static_libraries += libprotobuf-c-nano-enable_malloc |
Ying Wang | faeb693 | 2015-04-07 11:59:34 -0700 | [diff] [blame] | 724 | else ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nanopb-c) |
Ying Wang | 8a0d53e | 2015-04-08 09:54:34 -0700 | [diff] [blame] | 725 | my_static_libraries += libprotobuf-c-nano |
Yu Shan | 655f17c | 2019-01-25 17:11:02 -0800 | [diff] [blame] | 726 | else ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nanopb-c-enable_malloc-16bit) |
| 727 | my_static_libraries += libprotobuf-c-nano-enable_malloc-16bit |
| 728 | else ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nanopb-c-16bit) |
| 729 | my_static_libraries += libprotobuf-c-nano-16bit |
| 730 | else ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nanopb-c-enable_malloc-32bit) |
| 731 | my_static_libraries += libprotobuf-c-nano-enable_malloc-32bit |
| 732 | else ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nanopb-c-32bit) |
| 733 | my_static_libraries += libprotobuf-c-nano-32bit |
Ying Wang | faeb693 | 2015-04-07 11:59:34 -0700 | [diff] [blame] | 734 | else ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),full) |
Dan Albert | c3031c7 | 2014-11-11 10:42:17 -0800 | [diff] [blame] | 735 | ifdef LOCAL_SDK_VERSION |
Dan Albert | a187fb5 | 2015-09-08 10:47:03 -0700 | [diff] [blame] | 736 | my_static_libraries += libprotobuf-cpp-full-ndk |
Dan Albert | c3031c7 | 2014-11-11 10:42:17 -0800 | [diff] [blame] | 737 | else |
| 738 | my_shared_libraries += libprotobuf-cpp-full |
| 739 | endif |
Yabin Cui | 72a1156 | 2016-06-07 19:21:12 -0700 | [diff] [blame] | 740 | else ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),lite-static) |
| 741 | my_static_libraries += libprotobuf-cpp-lite |
Ying Wang | a5fc87a | 2010-11-02 18:43:16 -0700 | [diff] [blame] | 742 | else |
Dan Albert | c3031c7 | 2014-11-11 10:42:17 -0800 | [diff] [blame] | 743 | ifdef LOCAL_SDK_VERSION |
Dan Albert | a187fb5 | 2015-09-08 10:47:03 -0700 | [diff] [blame] | 744 | my_static_libraries += libprotobuf-cpp-lite-ndk |
Dan Albert | c3031c7 | 2014-11-11 10:42:17 -0800 | [diff] [blame] | 745 | else |
| 746 | my_shared_libraries += libprotobuf-cpp-lite |
| 747 | endif |
Ying Wang | a5fc87a | 2010-11-02 18:43:16 -0700 | [diff] [blame] | 748 | endif |
Ying Wang | ead8944 | 2014-02-25 11:18:40 -0800 | [diff] [blame] | 749 | endif # $(proto_sources) non-empty |
Ying Wang | a5fc87a | 2010-11-02 18:43:16 -0700 | [diff] [blame] | 750 | |
Ying Wang | a5fc87a | 2010-11-02 18:43:16 -0700 | [diff] [blame] | 751 | ########################################################### |
Christopher Wiley | 2df75d1 | 2015-10-14 17:27:24 -0700 | [diff] [blame] | 752 | ## AIDL: Compile .aidl files to .cpp and .h files |
| 753 | ########################################################### |
| 754 | aidl_src := $(strip $(filter %.aidl,$(my_src_files))) |
| 755 | aidl_gen_cpp := |
| 756 | ifneq ($(aidl_src),) |
| 757 | |
Christopher Wiley | 257796c | 2016-01-19 08:58:35 -0800 | [diff] [blame] | 758 | # Use the intermediates directory to avoid writing our own .cpp -> .o rules. |
Christopher Wiley | 2df75d1 | 2015-10-14 17:27:24 -0700 | [diff] [blame] | 759 | aidl_gen_cpp_root := $(intermediates)/aidl-generated/src |
| 760 | aidl_gen_include_root := $(intermediates)/aidl-generated/include |
| 761 | |
Christopher Wiley | 257796c | 2016-01-19 08:58:35 -0800 | [diff] [blame] | 762 | # Multi-architecture builds have distinct intermediates directories. |
| 763 | # Thus we'll actually generate source for each architecture. |
| 764 | $(foreach s,$(aidl_src),\ |
| 765 | $(eval $(call define-aidl-cpp-rule,$(s),$(aidl_gen_cpp_root),aidl_gen_cpp))) |
Christopher Wiley | 087f327 | 2016-01-19 09:26:10 -0800 | [diff] [blame] | 766 | $(foreach cpp,$(aidl_gen_cpp), \ |
Dan Willemsen | fb84281 | 2016-11-13 09:42:19 -0800 | [diff] [blame] | 767 | $(call include-depfile,$(addsuffix .aidl.d,$(basename $(cpp))),$(cpp))) |
Dan Willemsen | 3bb168f | 2016-01-19 20:07:08 -0800 | [diff] [blame] | 768 | $(call track-src-file-gen,$(aidl_src),$(aidl_gen_cpp)) |
Christopher Wiley | 2df75d1 | 2015-10-14 17:27:24 -0700 | [diff] [blame] | 769 | |
Christopher Wiley | 2df75d1 | 2015-10-14 17:27:24 -0700 | [diff] [blame] | 770 | $(aidl_gen_cpp) : PRIVATE_MODULE := $(LOCAL_MODULE) |
| 771 | $(aidl_gen_cpp) : PRIVATE_HEADER_OUTPUT_DIR := $(aidl_gen_include_root) |
| 772 | $(aidl_gen_cpp) : PRIVATE_AIDL_FLAGS := $(addprefix -I,$(LOCAL_AIDL_INCLUDES)) |
| 773 | |
Christopher Wiley | c7e936f | 2015-11-19 07:06:01 -0800 | [diff] [blame] | 774 | # Add generated headers to include paths. |
Christopher Wiley | 2df75d1 | 2015-10-14 17:27:24 -0700 | [diff] [blame] | 775 | my_c_includes += $(aidl_gen_include_root) |
Christopher Wiley | c7e936f | 2015-11-19 07:06:01 -0800 | [diff] [blame] | 776 | my_export_c_include_dirs += $(aidl_gen_include_root) |
Christopher Wiley | 2df75d1 | 2015-10-14 17:27:24 -0700 | [diff] [blame] | 777 | # Pick up the generated C++ files later for transformation to .o files. |
| 778 | my_generated_sources += $(aidl_gen_cpp) |
| 779 | |
| 780 | endif # $(aidl_src) non-empty |
| 781 | |
| 782 | ########################################################### |
Keun Soo Yim | 3d48475 | 2016-02-19 11:06:58 -0800 | [diff] [blame] | 783 | ## Compile the .vts files to .cc (or .c) and then to .o |
| 784 | ########################################################### |
| 785 | |
| 786 | vts_src := $(strip $(filter %.vts,$(my_src_files))) |
| 787 | vts_gen_cpp := |
| 788 | ifneq ($(vts_src),) |
Dan Willemsen | fc92fb2 | 2016-08-26 13:27:13 -0700 | [diff] [blame] | 789 | my_soong_problems += vts |
Keun Soo Yim | 3d48475 | 2016-02-19 11:06:58 -0800 | [diff] [blame] | 790 | |
| 791 | # Use the intermediates directory to avoid writing our own .cpp -> .o rules. |
| 792 | vts_gen_cpp_root := $(intermediates)/vts-generated/src |
| 793 | vts_gen_include_root := $(intermediates)/vts-generated/include |
| 794 | |
| 795 | # Multi-architecture builds have distinct intermediates directories. |
| 796 | # Thus we'll actually generate source for each architecture. |
| 797 | $(foreach s,$(vts_src),\ |
| 798 | $(eval $(call define-vts-cpp-rule,$(s),$(vts_gen_cpp_root),vts_gen_cpp))) |
Keun Soo Yim | 3d48475 | 2016-02-19 11:06:58 -0800 | [diff] [blame] | 799 | $(call track-src-file-gen,$(vts_src),$(vts_gen_cpp)) |
| 800 | |
| 801 | $(vts_gen_cpp) : PRIVATE_MODULE := $(LOCAL_MODULE) |
| 802 | $(vts_gen_cpp) : PRIVATE_HEADER_OUTPUT_DIR := $(vts_gen_include_root) |
Keun Soo Yim | 3c0ffa3 | 2016-09-08 18:30:28 -0700 | [diff] [blame] | 803 | $(vts_gen_cpp) : PRIVATE_VTS_FLAGS := $(addprefix -I,$(LOCAL_VTS_INCLUDES)) $(addprefix -m,$(LOCAL_VTS_MODE)) |
Keun Soo Yim | 3d48475 | 2016-02-19 11:06:58 -0800 | [diff] [blame] | 804 | |
| 805 | # Add generated headers to include paths. |
| 806 | my_c_includes += $(vts_gen_include_root) |
| 807 | my_export_c_include_dirs += $(vts_gen_include_root) |
| 808 | # Pick up the generated C++ files later for transformation to .o files. |
| 809 | my_generated_sources += $(vts_gen_cpp) |
| 810 | |
| 811 | endif # $(vts_src) non-empty |
| 812 | |
| 813 | ########################################################### |
Ying Wang | f0ebe16 | 2016-01-11 16:28:45 -0800 | [diff] [blame] | 814 | ## YACC: Compile .y/.yy files to .c/.cpp and then to .o. |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 815 | ########################################################### |
| 816 | |
Nicolas Geoffray | 9484e2e | 2014-03-03 15:57:06 +0000 | [diff] [blame] | 817 | y_yacc_sources := $(filter %.y,$(my_src_files)) |
Ying Wang | f0ebe16 | 2016-01-11 16:28:45 -0800 | [diff] [blame] | 818 | y_yacc_cs := $(addprefix \ |
| 819 | $(intermediates)/,$(y_yacc_sources:.y=.c)) |
| 820 | ifneq ($(y_yacc_cs),) |
| 821 | $(y_yacc_cs): $(intermediates)/%.c: \ |
Shinichiro Hamaji | b708bc5 | 2016-04-05 20:12:48 +0900 | [diff] [blame] | 822 | $(TOPDIR)$(LOCAL_PATH)/%.y $(BISON) $(BISON_DATA) \ |
Ying Wang | f0ebe16 | 2016-01-11 16:28:45 -0800 | [diff] [blame] | 823 | $(my_additional_dependencies) |
| 824 | $(call transform-y-to-c-or-cpp) |
Dan Willemsen | 3bb168f | 2016-01-19 20:07:08 -0800 | [diff] [blame] | 825 | $(call track-src-file-gen,$(y_yacc_sources),$(y_yacc_cs)) |
Ying Wang | f0ebe16 | 2016-01-11 16:28:45 -0800 | [diff] [blame] | 826 | |
| 827 | my_generated_sources += $(y_yacc_cs) |
| 828 | endif |
Nicolas Geoffray | 9484e2e | 2014-03-03 15:57:06 +0000 | [diff] [blame] | 829 | |
| 830 | yy_yacc_sources := $(filter %.yy,$(my_src_files)) |
| 831 | yy_yacc_cpps := $(addprefix \ |
| 832 | $(intermediates)/,$(yy_yacc_sources:.yy=$(LOCAL_CPP_EXTENSION))) |
Ying Wang | f0ebe16 | 2016-01-11 16:28:45 -0800 | [diff] [blame] | 833 | ifneq ($(yy_yacc_cpps),) |
Nicolas Geoffray | 9484e2e | 2014-03-03 15:57:06 +0000 | [diff] [blame] | 834 | $(yy_yacc_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \ |
Shinichiro Hamaji | b708bc5 | 2016-04-05 20:12:48 +0900 | [diff] [blame] | 835 | $(TOPDIR)$(LOCAL_PATH)/%.yy $(BISON) $(BISON_DATA) \ |
Ying Wang | f0ebe16 | 2016-01-11 16:28:45 -0800 | [diff] [blame] | 836 | $(my_additional_dependencies) |
| 837 | $(call transform-y-to-c-or-cpp) |
Dan Willemsen | 3bb168f | 2016-01-19 20:07:08 -0800 | [diff] [blame] | 838 | $(call track-src-file-gen,$(yy_yacc_sources),$(yy_yacc_cpps)) |
Nicolas Geoffray | 9484e2e | 2014-03-03 15:57:06 +0000 | [diff] [blame] | 839 | |
Ying Wang | f0ebe16 | 2016-01-11 16:28:45 -0800 | [diff] [blame] | 840 | my_generated_sources += $(yy_yacc_cpps) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 841 | endif |
| 842 | |
| 843 | ########################################################### |
Ying Wang | f0ebe16 | 2016-01-11 16:28:45 -0800 | [diff] [blame] | 844 | ## LEX: Compile .l/.ll files to .c/.cpp and then to .o. |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 845 | ########################################################### |
| 846 | |
Nicolas Geoffray | 9484e2e | 2014-03-03 15:57:06 +0000 | [diff] [blame] | 847 | l_lex_sources := $(filter %.l,$(my_src_files)) |
Ying Wang | f0ebe16 | 2016-01-11 16:28:45 -0800 | [diff] [blame] | 848 | l_lex_cs := $(addprefix \ |
| 849 | $(intermediates)/,$(l_lex_sources:.l=.c)) |
| 850 | ifneq ($(l_lex_cs),) |
| 851 | $(l_lex_cs): $(intermediates)/%.c: \ |
| 852 | $(TOPDIR)$(LOCAL_PATH)/%.l |
| 853 | $(transform-l-to-c-or-cpp) |
Dan Willemsen | 3bb168f | 2016-01-19 20:07:08 -0800 | [diff] [blame] | 854 | $(call track-src-file-gen,$(l_lex_sources),$(l_lex_cs)) |
Ying Wang | f0ebe16 | 2016-01-11 16:28:45 -0800 | [diff] [blame] | 855 | |
| 856 | my_generated_sources += $(l_lex_cs) |
| 857 | endif |
Nicolas Geoffray | 9484e2e | 2014-03-03 15:57:06 +0000 | [diff] [blame] | 858 | |
| 859 | ll_lex_sources := $(filter %.ll,$(my_src_files)) |
| 860 | ll_lex_cpps := $(addprefix \ |
| 861 | $(intermediates)/,$(ll_lex_sources:.ll=$(LOCAL_CPP_EXTENSION))) |
Ying Wang | f0ebe16 | 2016-01-11 16:28:45 -0800 | [diff] [blame] | 862 | ifneq ($(ll_lex_cpps),) |
Nicolas Geoffray | 9484e2e | 2014-03-03 15:57:06 +0000 | [diff] [blame] | 863 | $(ll_lex_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \ |
| 864 | $(TOPDIR)$(LOCAL_PATH)/%.ll |
Ying Wang | f0ebe16 | 2016-01-11 16:28:45 -0800 | [diff] [blame] | 865 | $(transform-l-to-c-or-cpp) |
Dan Willemsen | 3bb168f | 2016-01-19 20:07:08 -0800 | [diff] [blame] | 866 | $(call track-src-file-gen,$(ll_lex_sources),$(ll_lex_cpps)) |
Nicolas Geoffray | 9484e2e | 2014-03-03 15:57:06 +0000 | [diff] [blame] | 867 | |
Ying Wang | f0ebe16 | 2016-01-11 16:28:45 -0800 | [diff] [blame] | 868 | my_generated_sources += $(ll_lex_cpps) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 869 | endif |
| 870 | |
| 871 | ########################################################### |
| 872 | ## C++: Compile .cpp files to .o. |
| 873 | ########################################################### |
| 874 | |
Dan Willemsen | 46267cb | 2019-01-25 14:35:58 -0800 | [diff] [blame] | 875 | ifneq ($(filter %$(LOCAL_CPP_EXTENSION).arm,$(my_src_files)),) |
| 876 | $(call pretty-error,Files ending in $(LOCAL_CPP_EXTENSION).arm are deprecated. See $(CHANGES_URL)#file_arm) |
| 877 | endif |
Ying Wang | fb22a42 | 2015-03-10 18:03:11 -0700 | [diff] [blame] | 878 | |
| 879 | dotdot_sources := $(filter ../%$(LOCAL_CPP_EXTENSION),$(my_src_files)) |
| 880 | dotdot_objects := |
| 881 | $(foreach s,$(dotdot_sources),\ |
| 882 | $(eval $(call compile-dotdot-cpp-file,$(s),\ |
Ying Wang | 05f9f35 | 2016-05-05 20:02:08 -0700 | [diff] [blame] | 883 | $(my_additional_dependencies),\ |
Colin Cross | 23dcf76 | 2019-11-11 16:04:34 -0800 | [diff] [blame^] | 884 | dotdot_objects,\ |
| 885 | $(my_pool)))) |
Dan Willemsen | 3bb168f | 2016-01-19 20:07:08 -0800 | [diff] [blame] | 886 | $(call track-src-file-obj,$(dotdot_sources),$(dotdot_objects)) |
Ying Wang | fb22a42 | 2015-03-10 18:03:11 -0700 | [diff] [blame] | 887 | |
| 888 | cpp_normal_sources := $(filter-out ../%,$(filter %$(LOCAL_CPP_EXTENSION),$(my_src_files))) |
Dan Willemsen | 46267cb | 2019-01-25 14:35:58 -0800 | [diff] [blame] | 889 | cpp_objects := $(addprefix $(intermediates)/,$(cpp_normal_sources:$(LOCAL_CPP_EXTENSION)=.o)) |
| 890 | $(call track-src-file-obj,$(cpp_normal_sources),$(cpp_objects)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 891 | |
Dan Willemsen | 46267cb | 2019-01-25 14:35:58 -0800 | [diff] [blame] | 892 | $(dotdot_objects) $(cpp_objects): PRIVATE_ARM_MODE := $(normal_objects_mode) |
| 893 | $(dotdot_objects) $(cpp_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 894 | |
| 895 | ifneq ($(strip $(cpp_objects)),) |
Colin Cross | 23dcf76 | 2019-11-11 16:04:34 -0800 | [diff] [blame^] | 896 | $(cpp_objects): .KATI_NINJA_POOL := $(my_pool) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 897 | $(cpp_objects): $(intermediates)/%.o: \ |
Ying Wang | dfbe79b | 2012-03-22 11:26:22 -0700 | [diff] [blame] | 898 | $(TOPDIR)$(LOCAL_PATH)/%$(LOCAL_CPP_EXTENSION) \ |
Dan Willemsen | c5b7c4f | 2019-06-12 05:59:53 +0000 | [diff] [blame] | 899 | $(my_additional_dependencies) $(CLANG_CXX) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 900 | $(transform-$(PRIVATE_HOST)cpp-to-o) |
Shinichiro Hamaji | 4037c42 | 2016-03-03 18:12:52 +0900 | [diff] [blame] | 901 | $(call include-depfiles-for-objs, $(cpp_objects)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 902 | endif |
| 903 | |
Dan Willemsen | 46267cb | 2019-01-25 14:35:58 -0800 | [diff] [blame] | 904 | cpp_objects += $(dotdot_objects) |
Ying Wang | fb22a42 | 2015-03-10 18:03:11 -0700 | [diff] [blame] | 905 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 906 | ########################################################### |
| 907 | ## C++: Compile generated .cpp files to .o. |
| 908 | ########################################################### |
| 909 | |
Ying Wang | ec6d626 | 2014-01-16 16:21:03 -0800 | [diff] [blame] | 910 | gen_cpp_sources := $(filter %$(LOCAL_CPP_EXTENSION),$(my_generated_sources)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 911 | gen_cpp_objects := $(gen_cpp_sources:%$(LOCAL_CPP_EXTENSION)=%.o) |
Dan Willemsen | 3bb168f | 2016-01-19 20:07:08 -0800 | [diff] [blame] | 912 | $(call track-gen-file-obj,$(gen_cpp_sources),$(gen_cpp_objects)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 913 | |
| 914 | ifneq ($(strip $(gen_cpp_objects)),) |
| 915 | # Compile all generated files as thumb. |
Colin Cross | 23dcf76 | 2019-11-11 16:04:34 -0800 | [diff] [blame^] | 916 | $(gen_cpp_objects): .KATI_NINJA_POOL := $(my_pool) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 917 | $(gen_cpp_objects): PRIVATE_ARM_MODE := $(normal_objects_mode) |
| 918 | $(gen_cpp_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags) |
Evgeniy Stepanov | b71e2df | 2012-03-20 18:00:16 +0400 | [diff] [blame] | 919 | $(gen_cpp_objects): $(intermediates)/%.o: \ |
Ying Wang | 05f9f35 | 2016-05-05 20:02:08 -0700 | [diff] [blame] | 920 | $(intermediates)/%$(LOCAL_CPP_EXTENSION) \ |
Dan Willemsen | c5b7c4f | 2019-06-12 05:59:53 +0000 | [diff] [blame] | 921 | $(my_additional_dependencies) $(CLANG_CXX) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 922 | $(transform-$(PRIVATE_HOST)cpp-to-o) |
Shinichiro Hamaji | 4037c42 | 2016-03-03 18:12:52 +0900 | [diff] [blame] | 923 | $(call include-depfiles-for-objs, $(gen_cpp_objects)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 924 | endif |
| 925 | |
| 926 | ########################################################### |
| 927 | ## S: Compile generated .S and .s files to .o. |
| 928 | ########################################################### |
| 929 | |
Ying Wang | ec6d626 | 2014-01-16 16:21:03 -0800 | [diff] [blame] | 930 | gen_S_sources := $(filter %.S,$(my_generated_sources)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 931 | gen_S_objects := $(gen_S_sources:%.S=%.o) |
Dan Willemsen | 3bb168f | 2016-01-19 20:07:08 -0800 | [diff] [blame] | 932 | $(call track-gen-file-obj,$(gen_S_sources),$(gen_S_objects)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 933 | |
| 934 | ifneq ($(strip $(gen_S_sources)),) |
Colin Cross | 23dcf76 | 2019-11-11 16:04:34 -0800 | [diff] [blame^] | 935 | $(gen_S_objects): .KATI_NINJA_POOL := $(my_pool) |
Evgeniy Stepanov | b71e2df | 2012-03-20 18:00:16 +0400 | [diff] [blame] | 936 | $(gen_S_objects): $(intermediates)/%.o: $(intermediates)/%.S \ |
Dan Willemsen | c5b7c4f | 2019-06-12 05:59:53 +0000 | [diff] [blame] | 937 | $(my_additional_dependencies) $(CLANG) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 938 | $(transform-$(PRIVATE_HOST)s-to-o) |
Shinichiro Hamaji | 4037c42 | 2016-03-03 18:12:52 +0900 | [diff] [blame] | 939 | $(call include-depfiles-for-objs, $(gen_S_objects)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 940 | endif |
| 941 | |
Ying Wang | ec6d626 | 2014-01-16 16:21:03 -0800 | [diff] [blame] | 942 | gen_s_sources := $(filter %.s,$(my_generated_sources)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 943 | gen_s_objects := $(gen_s_sources:%.s=%.o) |
Dan Willemsen | 3bb168f | 2016-01-19 20:07:08 -0800 | [diff] [blame] | 944 | $(call track-gen-file-obj,$(gen_s_sources),$(gen_s_objects)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 945 | |
| 946 | ifneq ($(strip $(gen_s_objects)),) |
Colin Cross | 23dcf76 | 2019-11-11 16:04:34 -0800 | [diff] [blame^] | 947 | $(gen_s_objects): .KATI_NINJA_POOL := $(my_pool) |
Evgeniy Stepanov | b71e2df | 2012-03-20 18:00:16 +0400 | [diff] [blame] | 948 | $(gen_s_objects): $(intermediates)/%.o: $(intermediates)/%.s \ |
Dan Willemsen | c5b7c4f | 2019-06-12 05:59:53 +0000 | [diff] [blame] | 949 | $(my_additional_dependencies) $(CLANG) |
Dan Willemsen | 461d844 | 2016-11-10 18:19:36 -0800 | [diff] [blame] | 950 | $(transform-$(PRIVATE_HOST)s-to-o) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 951 | endif |
| 952 | |
| 953 | gen_asm_objects := $(gen_S_objects) $(gen_s_objects) |
Dan Willemsen | 45d38c0 | 2016-01-15 16:38:46 -0800 | [diff] [blame] | 954 | $(gen_asm_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 955 | |
| 956 | ########################################################### |
Torne (Richard Coles) | aace202 | 2013-02-21 14:01:35 +0000 | [diff] [blame] | 957 | ## o: Include generated .o files in output. |
| 958 | ########################################################### |
| 959 | |
Ying Wang | ec6d626 | 2014-01-16 16:21:03 -0800 | [diff] [blame] | 960 | gen_o_objects := $(filter %.o,$(my_generated_sources)) |
Torne (Richard Coles) | aace202 | 2013-02-21 14:01:35 +0000 | [diff] [blame] | 961 | |
| 962 | ########################################################### |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 963 | ## C: Compile .c files to .o. |
| 964 | ########################################################### |
| 965 | |
Dan Willemsen | 46267cb | 2019-01-25 14:35:58 -0800 | [diff] [blame] | 966 | ifneq ($(filter %.c.arm,$(my_src_files)),) |
| 967 | $(call pretty-error,Files ending in .c.arm are deprecated. See $(CHANGES_URL)#file_arm) |
| 968 | endif |
Ying Wang | fb22a42 | 2015-03-10 18:03:11 -0700 | [diff] [blame] | 969 | |
| 970 | dotdot_sources := $(filter ../%.c, $(my_src_files)) |
| 971 | dotdot_objects := |
| 972 | $(foreach s, $(dotdot_sources),\ |
| 973 | $(eval $(call compile-dotdot-c-file,$(s),\ |
Ying Wang | 05f9f35 | 2016-05-05 20:02:08 -0700 | [diff] [blame] | 974 | $(my_additional_dependencies),\ |
Colin Cross | 23dcf76 | 2019-11-11 16:04:34 -0800 | [diff] [blame^] | 975 | dotdot_objects,\ |
| 976 | $(my_pool)))) |
Dan Willemsen | 3bb168f | 2016-01-19 20:07:08 -0800 | [diff] [blame] | 977 | $(call track-src-file-obj,$(dotdot_sources),$(dotdot_objects)) |
Ying Wang | fb22a42 | 2015-03-10 18:03:11 -0700 | [diff] [blame] | 978 | |
| 979 | c_normal_sources := $(filter-out ../%,$(filter %.c,$(my_src_files))) |
Dan Willemsen | 46267cb | 2019-01-25 14:35:58 -0800 | [diff] [blame] | 980 | c_objects := $(addprefix $(intermediates)/,$(c_normal_sources:.c=.o)) |
| 981 | $(call track-src-file-obj,$(c_normal_sources),$(c_objects)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 982 | |
Dan Willemsen | 46267cb | 2019-01-25 14:35:58 -0800 | [diff] [blame] | 983 | $(dotdot_objects) $(c_objects): PRIVATE_ARM_MODE := $(normal_objects_mode) |
| 984 | $(dotdot_objects) $(c_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 985 | |
| 986 | ifneq ($(strip $(c_objects)),) |
Colin Cross | 23dcf76 | 2019-11-11 16:04:34 -0800 | [diff] [blame^] | 987 | $(c_objects): .KATI_NINJA_POOL := $(my_pool) |
Ying Wang | 05f9f35 | 2016-05-05 20:02:08 -0700 | [diff] [blame] | 988 | $(c_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.c \ |
Dan Willemsen | c5b7c4f | 2019-06-12 05:59:53 +0000 | [diff] [blame] | 989 | $(my_additional_dependencies) $(CLANG) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 990 | $(transform-$(PRIVATE_HOST)c-to-o) |
Shinichiro Hamaji | 4037c42 | 2016-03-03 18:12:52 +0900 | [diff] [blame] | 991 | $(call include-depfiles-for-objs, $(c_objects)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 992 | endif |
| 993 | |
Dan Willemsen | 46267cb | 2019-01-25 14:35:58 -0800 | [diff] [blame] | 994 | c_objects += $(dotdot_objects) |
Ying Wang | fb22a42 | 2015-03-10 18:03:11 -0700 | [diff] [blame] | 995 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 996 | ########################################################### |
Jack Palevich | e7b3e2c | 2009-05-04 14:32:44 -0700 | [diff] [blame] | 997 | ## C: Compile generated .c files to .o. |
| 998 | ########################################################### |
| 999 | |
Ying Wang | ec6d626 | 2014-01-16 16:21:03 -0800 | [diff] [blame] | 1000 | gen_c_sources := $(filter %.c,$(my_generated_sources)) |
Jack Palevich | e7b3e2c | 2009-05-04 14:32:44 -0700 | [diff] [blame] | 1001 | gen_c_objects := $(gen_c_sources:%.c=%.o) |
Dan Willemsen | 3bb168f | 2016-01-19 20:07:08 -0800 | [diff] [blame] | 1002 | $(call track-gen-file-obj,$(gen_c_sources),$(gen_c_objects)) |
Jack Palevich | e7b3e2c | 2009-05-04 14:32:44 -0700 | [diff] [blame] | 1003 | |
| 1004 | ifneq ($(strip $(gen_c_objects)),) |
| 1005 | # Compile all generated files as thumb. |
Colin Cross | 23dcf76 | 2019-11-11 16:04:34 -0800 | [diff] [blame^] | 1006 | $(gen_c_objects): .KATI_NINJA_POOL := $(my_pool) |
Jack Palevich | e7b3e2c | 2009-05-04 14:32:44 -0700 | [diff] [blame] | 1007 | $(gen_c_objects): PRIVATE_ARM_MODE := $(normal_objects_mode) |
| 1008 | $(gen_c_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags) |
Ying Wang | 05f9f35 | 2016-05-05 20:02:08 -0700 | [diff] [blame] | 1009 | $(gen_c_objects): $(intermediates)/%.o: $(intermediates)/%.c \ |
Dan Willemsen | c5b7c4f | 2019-06-12 05:59:53 +0000 | [diff] [blame] | 1010 | $(my_additional_dependencies) $(CLANG) |
Jack Palevich | e7b3e2c | 2009-05-04 14:32:44 -0700 | [diff] [blame] | 1011 | $(transform-$(PRIVATE_HOST)c-to-o) |
Shinichiro Hamaji | 4037c42 | 2016-03-03 18:12:52 +0900 | [diff] [blame] | 1012 | $(call include-depfiles-for-objs, $(gen_c_objects)) |
Jack Palevich | e7b3e2c | 2009-05-04 14:32:44 -0700 | [diff] [blame] | 1013 | endif |
| 1014 | |
| 1015 | ########################################################### |
David 'Digit' Turner | 5dbb529 | 2009-05-14 16:00:09 +0200 | [diff] [blame] | 1016 | ## ObjC: Compile .m files to .o |
| 1017 | ########################################################### |
| 1018 | |
Ying Wang | b8e0185 | 2014-01-23 15:09:04 -0800 | [diff] [blame] | 1019 | objc_sources := $(filter %.m,$(my_src_files)) |
David 'Digit' Turner | 5dbb529 | 2009-05-14 16:00:09 +0200 | [diff] [blame] | 1020 | objc_objects := $(addprefix $(intermediates)/,$(objc_sources:.m=.o)) |
Dan Willemsen | 62f2e56 | 2016-02-01 18:55:23 -0800 | [diff] [blame] | 1021 | $(call track-src-file-obj,$(objc_sources),$(objc_objects)) |
David 'Digit' Turner | 5dbb529 | 2009-05-14 16:00:09 +0200 | [diff] [blame] | 1022 | |
| 1023 | ifneq ($(strip $(objc_objects)),) |
Dan Willemsen | fc92fb2 | 2016-08-26 13:27:13 -0700 | [diff] [blame] | 1024 | my_soong_problems += objc |
Colin Cross | 23dcf76 | 2019-11-11 16:04:34 -0800 | [diff] [blame^] | 1025 | $(objc_objects): .KATI_NINJA_POOL := $(my_pool) |
Ying Wang | 05f9f35 | 2016-05-05 20:02:08 -0700 | [diff] [blame] | 1026 | $(objc_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.m \ |
Dan Willemsen | c5b7c4f | 2019-06-12 05:59:53 +0000 | [diff] [blame] | 1027 | $(my_additional_dependencies) $(CLANG) |
David 'Digit' Turner | 5dbb529 | 2009-05-14 16:00:09 +0200 | [diff] [blame] | 1028 | $(transform-$(PRIVATE_HOST)m-to-o) |
Shinichiro Hamaji | 4037c42 | 2016-03-03 18:12:52 +0900 | [diff] [blame] | 1029 | $(call include-depfiles-for-objs, $(objc_objects)) |
David 'Digit' Turner | 5dbb529 | 2009-05-14 16:00:09 +0200 | [diff] [blame] | 1030 | endif |
| 1031 | |
| 1032 | ########################################################### |
Scott James Remnant | dd86e5a | 2015-09-17 15:40:49 -0700 | [diff] [blame] | 1033 | ## ObjC++: Compile .mm files to .o |
| 1034 | ########################################################### |
| 1035 | |
| 1036 | objcpp_sources := $(filter %.mm,$(my_src_files)) |
| 1037 | objcpp_objects := $(addprefix $(intermediates)/,$(objcpp_sources:.mm=.o)) |
Dan Willemsen | 62f2e56 | 2016-02-01 18:55:23 -0800 | [diff] [blame] | 1038 | $(call track-src-file-obj,$(objcpp_sources),$(objcpp_objects)) |
Scott James Remnant | dd86e5a | 2015-09-17 15:40:49 -0700 | [diff] [blame] | 1039 | |
| 1040 | ifneq ($(strip $(objcpp_objects)),) |
Colin Cross | 23dcf76 | 2019-11-11 16:04:34 -0800 | [diff] [blame^] | 1041 | $(objcpp_objects): .KATI_NINJA_POOL := $(my_pool) |
Ying Wang | 05f9f35 | 2016-05-05 20:02:08 -0700 | [diff] [blame] | 1042 | $(objcpp_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.mm \ |
Dan Willemsen | c5b7c4f | 2019-06-12 05:59:53 +0000 | [diff] [blame] | 1043 | $(my_additional_dependencies) $(CLANG_CXX) |
Scott James Remnant | dd86e5a | 2015-09-17 15:40:49 -0700 | [diff] [blame] | 1044 | $(transform-$(PRIVATE_HOST)mm-to-o) |
Shinichiro Hamaji | 4037c42 | 2016-03-03 18:12:52 +0900 | [diff] [blame] | 1045 | $(call include-depfiles-for-objs, $(objcpp_objects)) |
Scott James Remnant | dd86e5a | 2015-09-17 15:40:49 -0700 | [diff] [blame] | 1046 | endif |
| 1047 | |
| 1048 | ########################################################### |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1049 | ## AS: Compile .S files to .o. |
| 1050 | ########################################################### |
| 1051 | |
Ying Wang | b8e0185 | 2014-01-23 15:09:04 -0800 | [diff] [blame] | 1052 | asm_sources_S := $(filter %.S,$(my_src_files)) |
Ying Wang | fb22a42 | 2015-03-10 18:03:11 -0700 | [diff] [blame] | 1053 | dotdot_sources := $(filter ../%,$(asm_sources_S)) |
| 1054 | asm_sources_S := $(filter-out ../%,$(asm_sources_S)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1055 | asm_objects_S := $(addprefix $(intermediates)/,$(asm_sources_S:.S=.o)) |
Dan Willemsen | 3bb168f | 2016-01-19 20:07:08 -0800 | [diff] [blame] | 1056 | $(call track-src-file-obj,$(asm_sources_S),$(asm_objects_S)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1057 | |
Ying Wang | fb22a42 | 2015-03-10 18:03:11 -0700 | [diff] [blame] | 1058 | dotdot_objects_S := |
| 1059 | $(foreach s,$(dotdot_sources),\ |
| 1060 | $(eval $(call compile-dotdot-s-file,$(s),\ |
| 1061 | $(my_additional_dependencies),\ |
Colin Cross | 23dcf76 | 2019-11-11 16:04:34 -0800 | [diff] [blame^] | 1062 | dotdot_objects_S,\ |
| 1063 | $(my_pool)))) |
Dan Willemsen | 3bb168f | 2016-01-19 20:07:08 -0800 | [diff] [blame] | 1064 | $(call track-src-file-obj,$(dotdot_sources),$(dotdot_objects_S)) |
Ying Wang | fb22a42 | 2015-03-10 18:03:11 -0700 | [diff] [blame] | 1065 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1066 | ifneq ($(strip $(asm_objects_S)),) |
Colin Cross | 23dcf76 | 2019-11-11 16:04:34 -0800 | [diff] [blame^] | 1067 | $(asm_objects_S): .KATI_NINJA_POOL := $(my_pool) |
Evgeniy Stepanov | b71e2df | 2012-03-20 18:00:16 +0400 | [diff] [blame] | 1068 | $(asm_objects_S): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.S \ |
Dan Willemsen | c5b7c4f | 2019-06-12 05:59:53 +0000 | [diff] [blame] | 1069 | $(my_additional_dependencies) $(CLANG) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1070 | $(transform-$(PRIVATE_HOST)s-to-o) |
Shinichiro Hamaji | 7290477 | 2016-03-16 06:40:04 +0900 | [diff] [blame] | 1071 | $(call include-depfiles-for-objs, $(asm_objects_S)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1072 | endif |
| 1073 | |
Ying Wang | b8e0185 | 2014-01-23 15:09:04 -0800 | [diff] [blame] | 1074 | asm_sources_s := $(filter %.s,$(my_src_files)) |
Ying Wang | fb22a42 | 2015-03-10 18:03:11 -0700 | [diff] [blame] | 1075 | dotdot_sources := $(filter ../%,$(asm_sources_s)) |
| 1076 | asm_sources_s := $(filter-out ../%,$(asm_sources_s)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1077 | asm_objects_s := $(addprefix $(intermediates)/,$(asm_sources_s:.s=.o)) |
Dan Willemsen | 3bb168f | 2016-01-19 20:07:08 -0800 | [diff] [blame] | 1078 | $(call track-src-file-obj,$(asm_sources_s),$(asm_objects_s)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1079 | |
Ying Wang | fb22a42 | 2015-03-10 18:03:11 -0700 | [diff] [blame] | 1080 | dotdot_objects_s := |
| 1081 | $(foreach s,$(dotdot_sources),\ |
| 1082 | $(eval $(call compile-dotdot-s-file-no-deps,$(s),\ |
| 1083 | $(my_additional_dependencies),\ |
Colin Cross | 23dcf76 | 2019-11-11 16:04:34 -0800 | [diff] [blame^] | 1084 | dotdot_objects_s,\ |
| 1085 | $(my_pool)))) |
Dan Willemsen | 3bb168f | 2016-01-19 20:07:08 -0800 | [diff] [blame] | 1086 | $(call track-src-file-obj,$(dotdot_sources),$(dotdot_objects_s)) |
Ying Wang | fb22a42 | 2015-03-10 18:03:11 -0700 | [diff] [blame] | 1087 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1088 | ifneq ($(strip $(asm_objects_s)),) |
Colin Cross | 23dcf76 | 2019-11-11 16:04:34 -0800 | [diff] [blame^] | 1089 | $(asm_objects_s): .KATI_NINJA_POOL := $(my_pool) |
Evgeniy Stepanov | b71e2df | 2012-03-20 18:00:16 +0400 | [diff] [blame] | 1090 | $(asm_objects_s): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.s \ |
Dan Willemsen | c5b7c4f | 2019-06-12 05:59:53 +0000 | [diff] [blame] | 1091 | $(my_additional_dependencies) $(CLANG) |
Dan Willemsen | 461d844 | 2016-11-10 18:19:36 -0800 | [diff] [blame] | 1092 | $(transform-$(PRIVATE_HOST)s-to-o) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1093 | endif |
| 1094 | |
Ying Wang | fb22a42 | 2015-03-10 18:03:11 -0700 | [diff] [blame] | 1095 | asm_objects := $(dotdot_objects_S) $(dotdot_objects_s) $(asm_objects_S) $(asm_objects_s) |
Dan Willemsen | 45d38c0 | 2016-01-15 16:38:46 -0800 | [diff] [blame] | 1096 | $(asm_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1097 | |
| 1098 | |
Ying Wang | fe1e5c3 | 2015-03-09 18:57:40 -0700 | [diff] [blame] | 1099 | # .asm for x86/x86_64 needs to be compiled with yasm. |
Ying Wang | 7b913ce | 2014-06-05 19:05:47 -0700 | [diff] [blame] | 1100 | asm_sources_asm := $(filter %.asm,$(my_src_files)) |
| 1101 | ifneq ($(strip $(asm_sources_asm)),) |
| 1102 | asm_objects_asm := $(addprefix $(intermediates)/,$(asm_sources_asm:.asm=.o)) |
| 1103 | $(asm_objects_asm): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.asm \ |
Dan Willemsen | c5b7c4f | 2019-06-12 05:59:53 +0000 | [diff] [blame] | 1104 | $(my_additional_dependencies) $(YASM) |
Ying Wang | 7b913ce | 2014-06-05 19:05:47 -0700 | [diff] [blame] | 1105 | $(transform-asm-to-o) |
Dan Willemsen | 3bb168f | 2016-01-19 20:07:08 -0800 | [diff] [blame] | 1106 | $(call track-src-file-obj,$(asm_sources_asm),$(asm_objects_asm)) |
Ying Wang | 7b913ce | 2014-06-05 19:05:47 -0700 | [diff] [blame] | 1107 | |
| 1108 | asm_objects += $(asm_objects_asm) |
| 1109 | endif |
Ying Wang | 7b913ce | 2014-06-05 19:05:47 -0700 | [diff] [blame] | 1110 | |
Vishwath Mohan | 96a130b | 2017-11-17 11:19:36 -0800 | [diff] [blame] | 1111 | ################################################################### |
| 1112 | ## When compiling a CFI enabled target, use the .cfi variant of any |
| 1113 | ## static dependencies (where they exist). |
| 1114 | ################################################################## |
| 1115 | define use_soong_cfi_static_libraries |
| 1116 | $(foreach l,$(1),$(if $(filter $(l),$(SOONG_CFI_STATIC_LIBRARIES)),\ |
| 1117 | $(l).cfi,$(l))) |
| 1118 | endef |
| 1119 | |
| 1120 | ifneq ($(filter cfi,$(my_sanitize)),) |
| 1121 | my_whole_static_libraries := $(call use_soong_cfi_static_libraries,\ |
| 1122 | $(my_whole_static_libraries)) |
| 1123 | my_static_libraries := $(call use_soong_cfi_static_libraries,\ |
| 1124 | $(my_static_libraries)) |
| 1125 | endif |
| 1126 | |
Evgenii Stepanov | 8841a7f | 2018-07-27 11:54:32 -0700 | [diff] [blame] | 1127 | ifneq ($(LOCAL_USE_VNDK),) |
| 1128 | my_soong_hwasan_static_libraries := $(SOONG_HWASAN_VENDOR_STATIC_LIBRARIES) |
| 1129 | else |
| 1130 | my_soong_hwasan_static_libraries = $(SOONG_HWASAN_STATIC_LIBRARIES) |
| 1131 | endif |
| 1132 | |
| 1133 | define use_soong_hwasan_static_libraries |
| 1134 | $(foreach l,$(1),$(if $(filter $(l),$(my_soong_hwasan_static_libraries)),\ |
| 1135 | $(l).hwasan,$(l))) |
| 1136 | endef |
| 1137 | |
| 1138 | ifneq ($(filter hwaddress,$(my_sanitize)),) |
| 1139 | my_whole_static_libraries := $(call use_soong_hwasan_static_libraries,\ |
| 1140 | $(my_whole_static_libraries)) |
| 1141 | my_static_libraries := $(call use_soong_hwasan_static_libraries,\ |
| 1142 | $(my_static_libraries)) |
| 1143 | endif |
| 1144 | |
Jiyong Park | c8f57d9 | 2017-04-18 20:15:14 +0900 | [diff] [blame] | 1145 | ########################################################### |
| 1146 | ## When compiling against the VNDK, use LL-NDK libraries |
| 1147 | ########################################################### |
| 1148 | ifneq ($(LOCAL_USE_VNDK),) |
| 1149 | #################################################### |
| 1150 | ## Soong modules may be built twice, once for /system |
| 1151 | ## and once for /vendor. If we're using the VNDK, |
| 1152 | ## switch all soong libraries over to the /vendor |
| 1153 | ## variant. |
| 1154 | #################################################### |
Colin Cross | 8fb525d | 2018-09-06 16:25:22 -0700 | [diff] [blame] | 1155 | my_whole_static_libraries := $(foreach l,$(my_whole_static_libraries),\ |
| 1156 | $(if $(SPLIT_VENDOR.STATIC_LIBRARIES.$(l)),$(l).vendor,$(l))) |
| 1157 | my_static_libraries := $(foreach l,$(my_static_libraries),\ |
| 1158 | $(if $(SPLIT_VENDOR.STATIC_LIBRARIES.$(l)),$(l).vendor,$(l))) |
| 1159 | my_shared_libraries := $(foreach l,$(my_shared_libraries),\ |
| 1160 | $(if $(SPLIT_VENDOR.SHARED_LIBRARIES.$(l)),$(l).vendor,$(l))) |
| 1161 | my_system_shared_libraries := $(foreach l,$(my_system_shared_libraries),\ |
| 1162 | $(if $(SPLIT_VENDOR.SHARED_LIBRARIES.$(l)),$(l).vendor,$(l))) |
| 1163 | my_header_libraries := $(foreach l,$(my_header_libraries),\ |
| 1164 | $(if $(SPLIT_VENDOR.HEADER_LIBRARIES.$(l)),$(l).vendor,$(l))) |
Jiyong Park | c8f57d9 | 2017-04-18 20:15:14 +0900 | [diff] [blame] | 1165 | endif |
Jeff Davidson | 680f071 | 2015-01-08 18:25:30 -0800 | [diff] [blame] | 1166 | |
Jiyong Park | c3f1356 | 2018-03-19 18:12:39 +0900 | [diff] [blame] | 1167 | # Platform can use vendor public libraries. If a required shared lib is one of |
| 1168 | # the vendor public libraries, the lib is switched to the stub version of the lib. |
| 1169 | ifeq ($(LOCAL_USE_VNDK),) |
Colin Cross | 8fb525d | 2018-09-06 16:25:22 -0700 | [diff] [blame] | 1170 | my_shared_libraries := $(foreach l,$(my_shared_libraries),\ |
| 1171 | $(if $(filter $(l),$(VENDOR_PUBLIC_LIBRARIES)),$(l).vendorpublic,$(l))) |
Jiyong Park | c3f1356 | 2018-03-19 18:12:39 +0900 | [diff] [blame] | 1172 | endif |
| 1173 | |
Jeff Davidson | 680f071 | 2015-01-08 18:25:30 -0800 | [diff] [blame] | 1174 | ########################################################## |
| 1175 | ## Set up installed module dependency |
| 1176 | ## We cannot compute the full path of the LOCAL_SHARED_LIBRARIES for |
| 1177 | ## they may cusomize their install path with LOCAL_MODULE_PATH |
| 1178 | ########################################################## |
| 1179 | # Get the list of INSTALLED libraries as module names. |
Dan Willemsen | ffa3258 | 2017-03-19 13:22:45 -0700 | [diff] [blame] | 1180 | ifneq ($(LOCAL_SDK_VERSION),) |
Jeff Davidson | 680f071 | 2015-01-08 18:25:30 -0800 | [diff] [blame] | 1181 | installed_shared_library_module_names := \ |
| 1182 | $(my_shared_libraries) |
| 1183 | else |
| 1184 | installed_shared_library_module_names := \ |
| 1185 | $(my_shared_libraries) $(my_system_shared_libraries) |
| 1186 | endif |
| 1187 | |
| 1188 | # The real dependency will be added after all Android.mks are loaded and the install paths |
| 1189 | # of the shared libraries are determined. |
| 1190 | ifdef LOCAL_INSTALLED_MODULE |
| 1191 | ifdef installed_shared_library_module_names |
| 1192 | $(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)DEPENDENCIES_ON_SHARED_LIBRARIES += \ |
Dimitry Ivanov | cdf3927 | 2017-06-26 13:13:44 -0700 | [diff] [blame] | 1193 | $(my_register_name):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(installed_shared_library_module_names)) |
Jeff Davidson | 680f071 | 2015-01-08 18:25:30 -0800 | [diff] [blame] | 1194 | endif |
| 1195 | endif |
| 1196 | |
| 1197 | |
Ying Wang | 5f07480 | 2011-11-08 09:31:21 -0800 | [diff] [blame] | 1198 | #################################################### |
Dan Willemsen | b097fbe | 2016-06-07 14:25:14 -0700 | [diff] [blame] | 1199 | ## Verify that NDK-built libraries only link against |
| 1200 | ## other NDK-built libraries |
| 1201 | #################################################### |
| 1202 | |
Dan Albert | 975e303 | 2017-12-19 11:26:05 -0800 | [diff] [blame] | 1203 | include $(BUILD_SYSTEM)/allowed_ndk_types.mk |
| 1204 | |
Dan Willemsen | b097fbe | 2016-06-07 14:25:14 -0700 | [diff] [blame] | 1205 | ifdef LOCAL_SDK_VERSION |
Dan Albert | 4297c39 | 2017-12-19 11:27:39 -0800 | [diff] [blame] | 1206 | my_link_type := native:ndk:$(my_ndk_stl_family):$(my_ndk_stl_link_type) |
Dan Albert | 975e303 | 2017-12-19 11:26:05 -0800 | [diff] [blame] | 1207 | my_warn_types := $(my_warn_ndk_types) |
| 1208 | my_allowed_types := $(my_allowed_ndk_types) |
Dan Willemsen | 9d2b328 | 2017-04-07 20:58:43 -0700 | [diff] [blame] | 1209 | else ifdef LOCAL_USE_VNDK |
Jiyong Park | a3fb158 | 2017-08-16 18:28:12 +0900 | [diff] [blame] | 1210 | _name := $(patsubst %.vendor,%,$(LOCAL_MODULE)) |
| 1211 | ifneq ($(filter $(_name),$(VNDK_CORE_LIBRARIES) $(VNDK_SAMEPROCESS_LIBRARIES) $(LLNDK_LIBRARIES)),) |
| 1212 | ifeq ($(filter $(_name),$(VNDK_PRIVATE_LIBRARIES)),) |
| 1213 | my_link_type := native:vndk |
| 1214 | else |
| 1215 | my_link_type := native:vndk_private |
| 1216 | endif |
| 1217 | my_warn_types := |
| 1218 | my_allowed_types := native:vndk native:vndk_private |
| 1219 | else |
| 1220 | # Modules installed to /vendor cannot directly depend on modules marked |
| 1221 | # with vendor_available: false |
| 1222 | my_link_type := native:vendor |
| 1223 | my_warn_types := |
Vic Yang | 51512c5 | 2018-11-12 20:16:26 -0800 | [diff] [blame] | 1224 | my_allowed_types := native:vendor native:vndk native:platform_vndk |
Jiyong Park | a3fb158 | 2017-08-16 18:28:12 +0900 | [diff] [blame] | 1225 | endif |
Jiyong Park | a52b6e9 | 2018-09-12 10:03:37 +0900 | [diff] [blame] | 1226 | else ifneq ($(filter $(TARGET_RECOVERY_OUT)/%,$(call get_non_asan_path,$(LOCAL_MODULE_PATH))),) |
Jiyong Park | 5dc3475 | 2018-08-28 12:32:45 +0900 | [diff] [blame] | 1227 | my_link_type := native:recovery |
| 1228 | my_warn_types := |
| 1229 | # TODO(b/113303515) remove native:platform and my_allowed_ndk_types |
Vic Yang | 51512c5 | 2018-11-12 20:16:26 -0800 | [diff] [blame] | 1230 | my_allowed_types := native:recovery native:platform native:platform_vndk $(my_allowed_ndk_types) |
Dan Willemsen | b097fbe | 2016-06-07 14:25:14 -0700 | [diff] [blame] | 1231 | else |
Dan Willemsen | b47d4e9 | 2017-04-08 00:31:31 -0700 | [diff] [blame] | 1232 | my_link_type := native:platform |
Dan Albert | 975e303 | 2017-12-19 11:26:05 -0800 | [diff] [blame] | 1233 | my_warn_types := $(my_warn_ndk_types) |
Vic Yang | 51512c5 | 2018-11-12 20:16:26 -0800 | [diff] [blame] | 1234 | my_allowed_types := $(my_allowed_ndk_types) native:platform native:platform_vndk |
Dan Willemsen | b097fbe | 2016-06-07 14:25:14 -0700 | [diff] [blame] | 1235 | endif |
Dan Willemsen | b097fbe | 2016-06-07 14:25:14 -0700 | [diff] [blame] | 1236 | |
Dan Willemsen | b47d4e9 | 2017-04-08 00:31:31 -0700 | [diff] [blame] | 1237 | my_link_deps := $(addprefix STATIC_LIBRARIES:,$(my_whole_static_libraries) $(my_static_libraries)) |
| 1238 | ifneq ($(filter-out STATIC_LIBRARIES HEADER_LIBRARIES,$(LOCAL_MODULE_CLASS)),) |
| 1239 | my_link_deps += $(addprefix SHARED_LIBRARIES:,$(my_shared_libraries)) |
| 1240 | endif |
| 1241 | |
| 1242 | my_2nd_arch_prefix := $(LOCAL_2ND_ARCH_VAR_PREFIX) |
| 1243 | my_common := |
| 1244 | include $(BUILD_SYSTEM)/link_type.mk |
Dan Willemsen | b097fbe | 2016-06-07 14:25:14 -0700 | [diff] [blame] | 1245 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1246 | ########################################################### |
| 1247 | ## Common object handling. |
| 1248 | ########################################################### |
| 1249 | |
Dan Willemsen | 3bb168f | 2016-01-19 20:07:08 -0800 | [diff] [blame] | 1250 | my_unused_src_files := $(filter-out $(logtags_sources) $(my_tracked_src_files),$(my_src_files) $(my_gen_src_files)) |
| 1251 | ifneq ($(my_unused_src_files),) |
Dan Willemsen | 9efeb1e | 2016-06-28 10:22:08 -0700 | [diff] [blame] | 1252 | $(error $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): Unused source files: $(my_unused_src_files)) |
Dan Willemsen | 3bb168f | 2016-01-19 20:07:08 -0800 | [diff] [blame] | 1253 | endif |
| 1254 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1255 | # some rules depend on asm_objects being first. If your code depends on |
| 1256 | # being first, it's reasonable to require it to be assembly |
Torne (Richard Coles) | a5afbe8 | 2013-08-29 15:36:34 +0100 | [diff] [blame] | 1257 | normal_objects := \ |
Ying Wang | dfbe79b | 2012-03-22 11:26:22 -0700 | [diff] [blame] | 1258 | $(asm_objects) \ |
| 1259 | $(cpp_objects) \ |
| 1260 | $(gen_cpp_objects) \ |
| 1261 | $(gen_asm_objects) \ |
| 1262 | $(c_objects) \ |
| 1263 | $(gen_c_objects) \ |
| 1264 | $(objc_objects) \ |
Ying Wang | 05f9f35 | 2016-05-05 20:02:08 -0700 | [diff] [blame] | 1265 | $(objcpp_objects) |
Dan Willemsen | 3bb168f | 2016-01-19 20:07:08 -0800 | [diff] [blame] | 1266 | |
| 1267 | new_order_normal_objects := $(foreach f,$(my_src_files),$(my_src_file_obj_$(f))) |
| 1268 | new_order_normal_objects += $(foreach f,$(my_gen_src_files),$(my_src_file_obj_$(f))) |
| 1269 | |
| 1270 | ifneq ($(sort $(normal_objects)),$(sort $(new_order_normal_objects))) |
| 1271 | $(warning $(LOCAL_MODULE_MAKEFILE) Internal build system warning: New object list does not match old) |
| 1272 | $(info Only in old: $(filter-out $(new_order_normal_objects),$(sort $(normal_objects)))) |
| 1273 | $(info Only in new: $(filter-out $(normal_objects),$(sort $(new_order_normal_objects)))) |
| 1274 | endif |
| 1275 | |
| 1276 | ifeq ($(BINARY_OBJECTS_ORDER),soong) |
| 1277 | normal_objects := $(new_order_normal_objects) |
| 1278 | endif |
| 1279 | |
| 1280 | normal_objects += $(addprefix $(TOPDIR)$(LOCAL_PATH)/,$(LOCAL_PREBUILT_OBJ_FILES)) |
Torne (Richard Coles) | a5afbe8 | 2013-08-29 15:36:34 +0100 | [diff] [blame] | 1281 | |
| 1282 | all_objects := $(normal_objects) $(gen_o_objects) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1283 | |
Dan Willemsen | 11ee341 | 2019-01-10 13:21:07 -0800 | [diff] [blame] | 1284 | LOCAL_INTERMEDIATE_TARGETS += $(all_objects) |
| 1285 | |
Dan Willemsen | 3bb168f | 2016-01-19 20:07:08 -0800 | [diff] [blame] | 1286 | # Cleanup file tracking |
| 1287 | $(foreach f,$(my_tracked_gen_files),$(eval my_src_file_gen_$(s):=)) |
| 1288 | my_tracked_gen_files := |
| 1289 | $(foreach f,$(my_tracked_src_files),$(eval my_src_file_obj_$(s):=)) |
| 1290 | my_tracked_src_files := |
| 1291 | |
Colin Cross | 2d20670 | 2014-02-13 13:41:52 -0800 | [diff] [blame] | 1292 | my_c_includes += $(TOPDIR)$(LOCAL_PATH) $(intermediates) $(generated_sources_dir) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1293 | |
Jiyong Park | b43a52d | 2017-07-13 15:51:07 +0900 | [diff] [blame] | 1294 | # The platform JNI header is for platform modules only. |
| 1295 | ifeq ($(LOCAL_SDK_VERSION)$(LOCAL_USE_VNDK),) |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 1296 | my_c_includes += $(JNI_H_INCLUDE) |
Ying Wang | bce4b75 | 2010-07-22 15:51:56 -0700 | [diff] [blame] | 1297 | endif |
| 1298 | |
Dan Willemsen | 062e30b | 2016-05-24 13:06:07 -0700 | [diff] [blame] | 1299 | my_outside_includes := $(filter-out $(OUT_DIR)/%,$(filter /%,$(my_c_includes))) |
| 1300 | ifneq ($(my_outside_includes),) |
| 1301 | $(error $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): C_INCLUDES must be under the source or output directories: $(my_outside_includes)) |
| 1302 | endif |
| 1303 | |
Torne (Richard Coles) | a5afbe8 | 2013-08-29 15:36:34 +0100 | [diff] [blame] | 1304 | # all_objects includes gen_o_objects which were part of LOCAL_GENERATED_SOURCES; |
| 1305 | # use normal_objects here to avoid creating circular dependencies. This assumes |
| 1306 | # that custom build rules which generate .o files don't consume other generated |
| 1307 | # sources as input (or if they do they take care of that dependency themselves). |
Ying Wang | ec6d626 | 2014-01-16 16:21:03 -0800 | [diff] [blame] | 1308 | $(normal_objects) : | $(my_generated_sources) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1309 | ALL_C_CPP_ETC_OBJECTS += $(all_objects) |
| 1310 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1311 | |
| 1312 | ########################################################### |
| 1313 | # Standard library handling. |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1314 | ########################################################### |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1315 | |
| 1316 | ########################################################### |
| 1317 | # The list of libraries that this module will link against are in |
| 1318 | # these variables. Each is a list of bare module names like "libc libm". |
| 1319 | # |
| 1320 | # LOCAL_SHARED_LIBRARIES |
| 1321 | # LOCAL_STATIC_LIBRARIES |
| 1322 | # LOCAL_WHOLE_STATIC_LIBRARIES |
| 1323 | # |
| 1324 | # We need to convert the bare names into the dependencies that |
| 1325 | # we'll use for LOCAL_BUILT_MODULE and LOCAL_INSTALLED_MODULE. |
| 1326 | # LOCAL_BUILT_MODULE should depend on the BUILT versions of the |
| 1327 | # libraries, so that simply building this module doesn't force |
| 1328 | # an install of a library. Similarly, LOCAL_INSTALLED_MODULE |
| 1329 | # should depend on the INSTALLED versions of the libraries so |
| 1330 | # that they get installed when this module does. |
| 1331 | ########################################################### |
| 1332 | # NOTE: |
| 1333 | # WHOLE_STATIC_LIBRARIES are libraries that are pulled into the |
| 1334 | # module without leaving anything out, which is useful for turning |
| 1335 | # a collection of .a files into a .so file. Linking against a |
| 1336 | # normal STATIC_LIBRARY will only pull in code/symbols that are |
| 1337 | # referenced by the module. (see gcc/ld's --whole-archive option) |
| 1338 | ########################################################### |
| 1339 | |
| 1340 | # Get the list of BUILT libraries, which are under |
| 1341 | # various intermediates directories. |
| 1342 | so_suffix := $($(my_prefix)SHLIB_SUFFIX) |
| 1343 | a_suffix := $($(my_prefix)STATIC_LIB_SUFFIX) |
| 1344 | |
Dan Willemsen | ffa3258 | 2017-03-19 13:22:45 -0700 | [diff] [blame] | 1345 | ifneq ($(LOCAL_SDK_VERSION),) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1346 | built_shared_libraries := \ |
Dan Willemsen | 8cf6b65 | 2018-09-05 11:01:12 -0700 | [diff] [blame] | 1347 | $(foreach lib,$(my_shared_libraries), \ |
| 1348 | $(call intermediates-dir-for, \ |
| 1349 | SHARED_LIBRARIES,$(lib),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/$(lib)$(so_suffix)) |
Ying Wang | c01f2dc | 2015-12-15 10:00:19 -0800 | [diff] [blame] | 1350 | built_shared_library_deps := $(addsuffix .toc, $(built_shared_libraries)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1351 | |
Ying Wang | d8d3721 | 2014-03-21 16:17:04 -0700 | [diff] [blame] | 1352 | # Add the NDK libraries to the built module dependency |
Ying Wang | cce4c97 | 2011-03-03 18:53:53 -0800 | [diff] [blame] | 1353 | my_system_shared_libraries_fullpath := \ |
| 1354 | $(my_ndk_stl_shared_lib_fullpath) \ |
Andrew Hsieh | 140761af0 | 2014-04-25 23:47:10 -0700 | [diff] [blame] | 1355 | $(addprefix $(my_ndk_sysroot_lib)/, \ |
Ying Wang | d8d3721 | 2014-03-21 16:17:04 -0700 | [diff] [blame] | 1356 | $(addsuffix $(so_suffix), $(my_system_shared_libraries))) |
Ying Wang | 1a08100 | 2010-07-13 14:55:47 -0700 | [diff] [blame] | 1357 | |
Dan Albert | c1ca190 | 2016-08-04 14:14:50 -0700 | [diff] [blame] | 1358 | # We need to preserve the ordering of LOCAL_SHARED_LIBRARIES regardless of |
| 1359 | # whether the libs are generated or prebuilt, so we simply can't split into two |
| 1360 | # lists and use addprefix. |
| 1361 | my_ndk_shared_libraries_fullpath := \ |
| 1362 | $(foreach _lib,$(my_ndk_shared_libraries),\ |
| 1363 | $(if $(filter $(NDK_MIGRATED_LIBS),$(_lib)),\ |
| 1364 | $(my_built_ndk_libs)/$(_lib)$(so_suffix),\ |
| 1365 | $(my_ndk_sysroot_lib)/$(_lib)$(so_suffix))) |
Dan Albert | 02bf138 | 2016-07-21 10:04:12 -0700 | [diff] [blame] | 1366 | |
| 1367 | built_shared_libraries += \ |
Dan Albert | c1ca190 | 2016-08-04 14:14:50 -0700 | [diff] [blame] | 1368 | $(my_ndk_shared_libraries_fullpath) \ |
Dan Albert | 02bf138 | 2016-07-21 10:04:12 -0700 | [diff] [blame] | 1369 | $(my_system_shared_libraries_fullpath) \ |
| 1370 | |
Dan Willemsen | b441630 | 2019-06-12 17:25:23 +0000 | [diff] [blame] | 1371 | built_shared_library_deps += \ |
| 1372 | $(my_ndk_shared_libraries_fullpath) \ |
| 1373 | $(my_system_shared_libraries_fullpath) \ |
| 1374 | |
Ying Wang | 1a08100 | 2010-07-13 14:55:47 -0700 | [diff] [blame] | 1375 | else |
Ying Wang | 1a08100 | 2010-07-13 14:55:47 -0700 | [diff] [blame] | 1376 | built_shared_libraries := \ |
Dan Willemsen | 8cf6b65 | 2018-09-05 11:01:12 -0700 | [diff] [blame] | 1377 | $(foreach lib,$(installed_shared_library_module_names), \ |
| 1378 | $(call intermediates-dir-for, \ |
| 1379 | SHARED_LIBRARIES,$(lib),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/$(lib)$(so_suffix)) |
Ying Wang | c01f2dc | 2015-12-15 10:00:19 -0800 | [diff] [blame] | 1380 | built_shared_library_deps := $(addsuffix .toc, $(built_shared_libraries)) |
Shinichiro Hamaji | 0e7587a | 2015-10-09 14:36:04 +0900 | [diff] [blame] | 1381 | my_system_shared_libraries_fullpath := |
Ying Wang | 1a08100 | 2010-07-13 14:55:47 -0700 | [diff] [blame] | 1382 | endif |
| 1383 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1384 | built_static_libraries := \ |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 1385 | $(foreach lib,$(my_static_libraries), \ |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1386 | $(call intermediates-dir-for, \ |
Alexey Polyudov | ccdc311 | 2016-08-01 17:41:49 -0700 | [diff] [blame] | 1387 | STATIC_LIBRARIES,$(lib),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/$(lib)$(a_suffix)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1388 | |
Ying Wang | 848020f | 2012-08-14 10:13:16 -0700 | [diff] [blame] | 1389 | ifdef LOCAL_SDK_VERSION |
Ying Wang | cce4c97 | 2011-03-03 18:53:53 -0800 | [diff] [blame] | 1390 | built_static_libraries += $(my_ndk_stl_static_lib) |
| 1391 | endif |
| 1392 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1393 | built_whole_libraries := \ |
Colin Cross | 90353fe | 2014-02-04 14:53:25 -0800 | [diff] [blame] | 1394 | $(foreach lib,$(my_whole_static_libraries), \ |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1395 | $(call intermediates-dir-for, \ |
Alexey Polyudov | ccdc311 | 2016-08-01 17:41:49 -0700 | [diff] [blame] | 1396 | STATIC_LIBRARIES,$(lib),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/$(lib)$(a_suffix)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1397 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1398 | # We don't care about installed static libraries, since the |
| 1399 | # libraries have already been linked into the module at that point. |
| 1400 | # We do, however, care about the NOTICE files for any static |
Steve Block | d14d3b4 | 2012-03-01 11:34:41 +0000 | [diff] [blame] | 1401 | # libraries that we use. (see notice_files.mk) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1402 | installed_static_library_notice_file_targets := \ |
Colin Cross | 90353fe | 2014-02-04 14:53:25 -0800 | [diff] [blame] | 1403 | $(foreach lib,$(my_static_libraries) $(my_whole_static_libraries), \ |
Jaewoong Jung | e8cb195 | 2018-11-08 16:53:02 -0800 | [diff] [blame] | 1404 | NOTICE-$(if $(LOCAL_IS_HOST_MODULE),HOST$(if $(my_host_cross),_CROSS,),TARGET)-STATIC_LIBRARIES-$(lib)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1405 | |
Colin Cross | 579668b | 2018-08-14 13:13:47 -0700 | [diff] [blame] | 1406 | $(notice_target): | $(installed_static_library_notice_file_targets) |
| 1407 | $(LOCAL_INSTALLED_MODULE): | $(notice_target) |
| 1408 | |
Doug Kwan | 9a8ecf9 | 2011-05-10 21:50:58 -0700 | [diff] [blame] | 1409 | # Default is -fno-rtti. |
Doug Kwan | e3c3c6d | 2011-06-07 10:55:48 -0700 | [diff] [blame] | 1410 | ifeq ($(strip $(LOCAL_RTTI_FLAG)),) |
| 1411 | LOCAL_RTTI_FLAG := -fno-rtti |
| 1412 | endif |
Doug Kwan | 9a8ecf9 | 2011-05-10 21:50:58 -0700 | [diff] [blame] | 1413 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1414 | ########################################################### |
| 1415 | # Rule-specific variable definitions |
| 1416 | ########################################################### |
Logan Chien | e6f6543 | 2013-12-10 19:07:41 +0800 | [diff] [blame] | 1417 | |
Chih-Hung Hsieh | 9aa69a6 | 2014-09-04 17:15:47 -0700 | [diff] [blame] | 1418 | my_cflags += $(LOCAL_CLANG_CFLAGS) |
Stephen Hines | 1568029 | 2014-11-26 00:53:46 -0800 | [diff] [blame] | 1419 | my_conlyflags += $(LOCAL_CLANG_CONLYFLAGS) |
Dan Albert | d2fa96d | 2014-11-28 14:00:12 -0800 | [diff] [blame] | 1420 | my_cppflags += $(LOCAL_CLANG_CPPFLAGS) |
Chih-Hung Hsieh | 9aa69a6 | 2014-09-04 17:15:47 -0700 | [diff] [blame] | 1421 | my_asflags += $(LOCAL_CLANG_ASFLAGS) |
| 1422 | my_ldflags += $(LOCAL_CLANG_LDFLAGS) |
Chih-Hung Hsieh | 619fdb8 | 2014-09-26 17:13:48 -0700 | [diff] [blame] | 1423 | my_cflags += $(LOCAL_CLANG_CFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CLANG_CFLAGS_$(my_32_64_bit_suffix)) |
Stephen Hines | 1568029 | 2014-11-26 00:53:46 -0800 | [diff] [blame] | 1424 | my_conlyflags += $(LOCAL_CLANG_CONLYFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CLANG_CONLYFLAGS_$(my_32_64_bit_suffix)) |
Chih-Hung Hsieh | 619fdb8 | 2014-09-26 17:13:48 -0700 | [diff] [blame] | 1425 | my_cppflags += $(LOCAL_CLANG_CPPFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CLANG_CPPFLAGS_$(my_32_64_bit_suffix)) |
| 1426 | my_ldflags += $(LOCAL_CLANG_LDFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CLANG_LDFLAGS_$(my_32_64_bit_suffix)) |
| 1427 | my_asflags += $(LOCAL_CLANG_ASFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CLANG_ASFLAGS_$(my_32_64_bit_suffix)) |
Dan Willemsen | 02268f0 | 2016-05-19 14:39:25 -0700 | [diff] [blame] | 1428 | my_cflags := $(call convert-to-clang-flags,$(my_cflags)) |
| 1429 | my_cppflags := $(call convert-to-clang-flags,$(my_cppflags)) |
| 1430 | my_asflags := $(call convert-to-clang-flags,$(my_asflags)) |
| 1431 | my_ldflags := $(call convert-to-clang-flags,$(my_ldflags)) |
Logan Chien | e6f6543 | 2013-12-10 19:07:41 +0800 | [diff] [blame] | 1432 | |
Ying Wang | 45d0143 | 2014-10-28 14:50:59 -0700 | [diff] [blame] | 1433 | ifeq ($(my_fdo_build), true) |
| 1434 | my_cflags := $(patsubst -Os,-O2,$(my_cflags)) |
| 1435 | fdo_incompatible_flags := -fno-early-inlining -finline-limit=% |
| 1436 | my_cflags := $(filter-out $(fdo_incompatible_flags),$(my_cflags)) |
Dehao Chen | 295a6d2 | 2014-09-19 10:18:12 -0700 | [diff] [blame] | 1437 | endif |
| 1438 | |
Dan Albert | df3fd1d | 2015-08-12 14:54:16 -0700 | [diff] [blame] | 1439 | # No one should ever use this flag. On GCC it's mere presence will disable all |
| 1440 | # warnings, even those that are specified after it (contrary to typical warning |
| 1441 | # flag behavior). This circumvents CFLAGS_NO_OVERRIDE from forcibly enabling the |
| 1442 | # warnings that are *always* bugs. |
| 1443 | my_illegal_flags := -w |
| 1444 | my_cflags := $(filter-out $(my_illegal_flags),$(my_cflags)) |
| 1445 | my_cppflags := $(filter-out $(my_illegal_flags),$(my_cppflags)) |
| 1446 | my_conlyflags := $(filter-out $(my_illegal_flags),$(my_conlyflags)) |
| 1447 | |
Dan Albert | 5ae31dd | 2016-01-29 16:51:51 -0800 | [diff] [blame] | 1448 | # We can enforce some rules more strictly in the code we own. my_strict |
| 1449 | # indicates if this is code that we can be stricter with. If we have rules that |
| 1450 | # we want to apply to *our* code (but maybe can't for vendor/device specific |
| 1451 | # things), we could extend this to be a ternary value. |
| 1452 | my_strict := true |
| 1453 | ifneq ($(filter external/%,$(LOCAL_PATH)),) |
| 1454 | my_strict := false |
| 1455 | endif |
| 1456 | |
| 1457 | # Can be used to make some annotations stricter for code we can fix (such as |
| 1458 | # when we mark functions as deprecated). |
| 1459 | ifeq ($(my_strict),true) |
| 1460 | my_cflags += -DANDROID_STRICT |
| 1461 | endif |
| 1462 | |
Chih-Hung Hsieh | 1876acd | 2017-11-06 10:47:24 -0800 | [diff] [blame] | 1463 | # Check if -Werror or -Wno-error is used in C compiler flags. |
Colin Cross | 8fb525d | 2018-09-06 16:25:22 -0700 | [diff] [blame] | 1464 | # Header libraries do not need cflags. |
| 1465 | ifneq (HEADER_LIBRARIES,$(LOCAL_MODULE_CLASS)) |
| 1466 | # Prebuilt modules do not need cflags. |
| 1467 | ifeq (,$(LOCAL_PREBUILT_MODULE_FILE)) |
| 1468 | my_all_cflags := $(my_cflags) $(my_cppflags) $(my_cflags_no_override) |
| 1469 | # Issue warning if -Wno-error is used. |
| 1470 | ifneq (,$(filter -Wno-error,$(my_all_cflags))) |
| 1471 | $(eval MODULES_USING_WNO_ERROR := $(MODULES_USING_WNO_ERROR) $(LOCAL_MODULE_MAKEFILE):$(LOCAL_MODULE)) |
| 1472 | else |
| 1473 | # Issue warning if -Werror is not used. Add it. |
| 1474 | ifeq (,$(filter -Werror,$(my_all_cflags))) |
| 1475 | # Add -Wall -Werror unless the project is in the WARNING_ALLOWED project list. |
| 1476 | ifeq (,$(strip $(call find_warning_allowed_projects,$(LOCAL_PATH)))) |
| 1477 | my_cflags := -Wall -Werror $(my_cflags) |
| 1478 | else |
| 1479 | $(eval MODULES_ADDED_WALL := $(MODULES_ADDED_WALL) $(LOCAL_MODULE_MAKEFILE):$(LOCAL_MODULE)) |
| 1480 | my_cflags := -Wall $(my_cflags) |
Chih-Hung Hsieh | 1876acd | 2017-11-06 10:47:24 -0800 | [diff] [blame] | 1481 | endif |
| 1482 | endif |
| 1483 | endif |
Chih-Hung Hsieh | bab0488 | 2016-10-11 15:38:39 -0700 | [diff] [blame] | 1484 | endif |
| 1485 | endif |
| 1486 | |
Chih-Hung Hsieh | a9a55c7 | 2016-03-31 16:30:23 -0700 | [diff] [blame] | 1487 | # Disable clang-tidy if it is not found. |
| 1488 | ifeq ($(PATH_TO_CLANG_TIDY),) |
| 1489 | my_tidy_enabled := false |
| 1490 | else |
| 1491 | # If LOCAL_TIDY is not defined, use global WITH_TIDY |
| 1492 | my_tidy_enabled := $(LOCAL_TIDY) |
| 1493 | ifeq ($(my_tidy_enabled),) |
| 1494 | my_tidy_enabled := $(WITH_TIDY) |
| 1495 | endif |
| 1496 | endif |
| 1497 | |
| 1498 | # my_tidy_checks is empty if clang-tidy is disabled. |
| 1499 | my_tidy_checks := |
| 1500 | my_tidy_flags := |
| 1501 | ifneq (,$(filter 1 true,$(my_tidy_enabled))) |
Dan Willemsen | f063839 | 2018-09-04 22:25:22 -0700 | [diff] [blame] | 1502 | tidy_only: $(cpp_objects) $(c_objects) $(gen_c_objects) $(gen_cpp_objects) |
| 1503 | # Set up global default checks |
| 1504 | my_tidy_checks := $(WITH_TIDY_CHECKS) |
| 1505 | ifeq ($(my_tidy_checks),) |
| 1506 | my_tidy_checks := $(call default_global_tidy_checks,$(LOCAL_PATH)) |
| 1507 | endif |
| 1508 | # Append local clang-tidy checks. |
| 1509 | ifneq ($(LOCAL_TIDY_CHECKS),) |
| 1510 | my_tidy_checks := $(my_tidy_checks),$(LOCAL_TIDY_CHECKS) |
| 1511 | endif |
Chih-Hung Hsieh | 1d9f04f | 2018-09-21 10:30:31 -0700 | [diff] [blame] | 1512 | my_tidy_flags := $(strip $(WITH_TIDY_FLAGS) $(LOCAL_TIDY_FLAGS)) |
Dan Willemsen | f063839 | 2018-09-04 22:25:22 -0700 | [diff] [blame] | 1513 | # If tidy flags are not specified, default to check all header files. |
| 1514 | ifeq ($(my_tidy_flags),) |
| 1515 | my_tidy_flags := $(call default_tidy_header_filter,$(LOCAL_PATH)) |
| 1516 | endif |
| 1517 | # If clang-tidy is not enabled globally, add the -quiet flag. |
| 1518 | ifeq (,$(filter 1 true,$(WITH_TIDY))) |
| 1519 | my_tidy_flags += -quiet -extra-arg-before=-fno-caret-diagnostics |
| 1520 | endif |
George Burgess IV | 5ab07d4 | 2017-05-03 18:10:47 -0700 | [diff] [blame] | 1521 | |
Dan Willemsen | f063839 | 2018-09-04 22:25:22 -0700 | [diff] [blame] | 1522 | ifneq ($(my_tidy_checks),) |
| 1523 | # We might be using the static analyzer through clang-tidy. |
| 1524 | # https://bugs.llvm.org/show_bug.cgi?id=32914 |
| 1525 | my_tidy_flags += -extra-arg-before=-D__clang_analyzer__ |
George Burgess IV | 432899a | 2018-05-14 15:46:43 -0700 | [diff] [blame] | 1526 | |
Dan Willemsen | f063839 | 2018-09-04 22:25:22 -0700 | [diff] [blame] | 1527 | # A recent change in clang-tidy (r328258) enabled destructor inlining, |
| 1528 | # which appears to cause a number of false positives. Until that's |
| 1529 | # resolved, this turns off the effects of r328258. |
| 1530 | # https://bugs.llvm.org/show_bug.cgi?id=37459 |
| 1531 | my_tidy_flags += -extra-arg-before=-Xclang |
| 1532 | my_tidy_flags += -extra-arg-before=-analyzer-config |
| 1533 | my_tidy_flags += -extra-arg-before=-Xclang |
| 1534 | my_tidy_flags += -extra-arg-before=c++-temp-dtor-inlining=false |
Chih-Hung Hsieh | a9a55c7 | 2016-03-31 16:30:23 -0700 | [diff] [blame] | 1535 | endif |
| 1536 | endif |
| 1537 | |
Chih-Hung Hsieh | ba64625 | 2016-08-16 16:27:30 -0700 | [diff] [blame] | 1538 | my_tidy_checks := $(subst $(space),,$(my_tidy_checks)) |
| 1539 | |
Chih-Hung Hsieh | be5dd20 | 2018-08-26 20:37:49 -0700 | [diff] [blame] | 1540 | # Add dependency of clang-tidy and clang-tidy.sh |
| 1541 | ifneq ($(my_tidy_checks),) |
George Burgess IV | 09e5d9b | 2019-04-04 16:21:53 -0700 | [diff] [blame] | 1542 | $(cpp_objects): $(intermediates)/%.o: $(PATH_TO_CLANG_TIDY) |
| 1543 | $(c_objects): $(intermediates)/%.o: $(PATH_TO_CLANG_TIDY) |
| 1544 | $(gen_cpp_objects): $(intermediates)/%.o: $(PATH_TO_CLANG_TIDY) |
| 1545 | $(gen_c_objects): $(intermediates)/%.o: $(PATH_TO_CLANG_TIDY) |
Chih-Hung Hsieh | be5dd20 | 2018-08-26 20:37:49 -0700 | [diff] [blame] | 1546 | endif |
| 1547 | |
Dan Willemsen | 6731b49 | 2016-06-07 16:55:57 -0700 | [diff] [blame] | 1548 | # Move -l* entries from ldflags to ldlibs, and everything else to ldflags |
| 1549 | my_ldlib_flags := $(my_ldflags) $(my_ldlibs) |
| 1550 | my_ldlibs := $(filter -l%,$(my_ldlib_flags)) |
| 1551 | my_ldflags := $(filter-out -l%,$(my_ldlib_flags)) |
| 1552 | |
| 1553 | # One last verification check for ldlibs |
Dan Willemsen | 6731b49 | 2016-06-07 16:55:57 -0700 | [diff] [blame] | 1554 | my_allowed_ldlibs := |
Dan Willemsen | 4dbb354 | 2017-09-26 00:14:01 -0700 | [diff] [blame] | 1555 | ifndef LOCAL_IS_HOST_MODULE |
| 1556 | ifneq ($(LOCAL_SDK_VERSION),) |
| 1557 | my_allowed_ldlibs := $(addprefix -l,$(NDK_PREBUILT_SHARED_LIBRARIES)) |
| 1558 | endif |
| 1559 | else |
| 1560 | my_allowed_ldlibs := $($(my_prefix)AVAILABLE_LIBRARIES) |
Dan Willemsen | 6731b49 | 2016-06-07 16:55:57 -0700 | [diff] [blame] | 1561 | endif |
| 1562 | |
| 1563 | my_bad_ldlibs := $(filter-out $(my_allowed_ldlibs),$(my_ldlibs)) |
| 1564 | ifneq ($(my_bad_ldlibs),) |
| 1565 | $(error $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): Bad LOCAL_LDLIBS entries: $(my_bad_ldlibs)) |
| 1566 | endif |
Dan Willemsen | 6731b49 | 2016-06-07 16:55:57 -0700 | [diff] [blame] | 1567 | |
Dan Willemsen | c9aa6fc | 2016-09-13 10:44:44 -0700 | [diff] [blame] | 1568 | # my_cxx_ldlibs may contain linker flags need to wrap certain libraries |
| 1569 | # (start-group/end-group), so append after the check above. |
| 1570 | my_ldlibs += $(my_cxx_ldlibs) |
| 1571 | |
Dan Willemsen | e24da82 | 2019-01-10 13:10:17 -0800 | [diff] [blame] | 1572 | ########################################################### |
| 1573 | ## Define PRIVATE_ variables from global vars |
| 1574 | ########################################################### |
| 1575 | ifndef LOCAL_IS_HOST_MODULE |
| 1576 | ifdef LOCAL_USE_VNDK |
| 1577 | my_target_global_c_includes := \ |
| 1578 | $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_INCLUDES) |
| 1579 | my_target_global_c_system_includes := \ |
| 1580 | $(TARGET_OUT_HEADERS) \ |
| 1581 | $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_SYSTEM_INCLUDES) |
| 1582 | else ifdef LOCAL_SDK_VERSION |
| 1583 | my_target_global_c_includes := |
| 1584 | my_target_global_c_system_includes := $(my_ndk_stl_include_path) $(my_ndk_sysroot_include) |
| 1585 | else ifdef BOARD_VNDK_VERSION |
| 1586 | my_target_global_c_includes := $(SRC_HEADERS) \ |
| 1587 | $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_INCLUDES) \ |
| 1588 | $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES) |
| 1589 | my_target_global_c_system_includes := $(SRC_SYSTEM_HEADERS) \ |
| 1590 | $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_SYSTEM_INCLUDES) \ |
| 1591 | $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_SYSTEM_INCLUDES) |
| 1592 | else |
| 1593 | my_target_global_c_includes := $(SRC_HEADERS) \ |
| 1594 | $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_INCLUDES) \ |
| 1595 | $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES) |
| 1596 | my_target_global_c_system_includes := $(SRC_SYSTEM_HEADERS) $(TARGET_OUT_HEADERS) \ |
| 1597 | $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_SYSTEM_INCLUDES) \ |
| 1598 | $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_SYSTEM_INCLUDES) |
| 1599 | endif |
| 1600 | |
| 1601 | my_target_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CFLAGS) |
| 1602 | my_target_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CONLYFLAGS) $(my_c_std_conlyflags) |
| 1603 | my_target_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CPPFLAGS) $(my_cpp_std_cppflags) |
| 1604 | ifeq ($(my_use_clang_lld),true) |
| 1605 | my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_LLDFLAGS) |
| 1606 | include $(BUILD_SYSTEM)/pack_dyn_relocs_setup.mk |
Pirama Arumuga Nainar | bf2af95 | 2019-07-30 22:32:20 -0700 | [diff] [blame] | 1607 | ifeq ($(my_pack_module_relocations),true) |
| 1608 | my_target_global_ldflags += -Wl,--pack-dyn-relocs=android+relr -Wl,--use-android-relr-tags |
| 1609 | else |
Dan Willemsen | e24da82 | 2019-01-10 13:10:17 -0800 | [diff] [blame] | 1610 | my_target_global_ldflags += -Wl,--pack-dyn-relocs=none |
| 1611 | endif |
| 1612 | else |
| 1613 | my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_LDFLAGS) |
| 1614 | endif # my_use_clang_lld |
| 1615 | |
Peter Collingbourne | e3606ae | 2019-07-25 17:43:04 -0700 | [diff] [blame] | 1616 | my_target_triple := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)TRIPLE) |
| 1617 | ifndef LOCAL_IS_HOST_MODULE |
| 1618 | my_target_triple_flag := -target $(my_target_triple)$(my_api_level) |
| 1619 | else |
| 1620 | my_target_triple_flag := -target $(my_target_triple) |
| 1621 | endif |
| 1622 | my_asflags += $(my_target_triple_flag) |
| 1623 | my_cflags += $(my_target_triple_flag) |
| 1624 | my_ldflags += $(my_target_triple_flag) |
| 1625 | |
Dan Willemsen | e24da82 | 2019-01-10 13:10:17 -0800 | [diff] [blame] | 1626 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_GLOBAL_C_INCLUDES := $(my_target_global_c_includes) |
| 1627 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_GLOBAL_C_SYSTEM_INCLUDES := $(my_target_global_c_system_includes) |
| 1628 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CFLAGS := $(my_target_global_cflags) |
| 1629 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CONLYFLAGS := $(my_target_global_conlyflags) |
| 1630 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CPPFLAGS := $(my_target_global_cppflags) |
| 1631 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(my_target_global_ldflags) |
| 1632 | |
| 1633 | else # LOCAL_IS_HOST_MODULE |
| 1634 | |
| 1635 | my_host_global_c_includes := $(SRC_HEADERS) \ |
| 1636 | $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES) |
| 1637 | my_host_global_c_system_includes := $(SRC_SYSTEM_HEADERS) \ |
| 1638 | $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_SYSTEM_INCLUDES) |
| 1639 | |
| 1640 | my_host_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CFLAGS) |
| 1641 | my_host_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CONLYFLAGS) $(my_c_std_conlyflags) |
| 1642 | my_host_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CPPFLAGS) $(my_cpp_std_cppflags) |
| 1643 | ifeq ($(my_use_clang_lld),true) |
| 1644 | my_host_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_LLDFLAGS) |
| 1645 | else |
| 1646 | my_host_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_LDFLAGS) |
| 1647 | endif # my_use_clang_lld |
| 1648 | |
| 1649 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_GLOBAL_C_INCLUDES := $(my_host_global_c_includes) |
| 1650 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_GLOBAL_C_SYSTEM_INCLUDES := $(my_host_global_c_system_includes) |
| 1651 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_CFLAGS := $(my_host_global_cflags) |
| 1652 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_CONLYFLAGS := $(my_host_global_conlyflags) |
| 1653 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_CPPFLAGS := $(my_host_global_cppflags) |
| 1654 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_LDFLAGS := $(my_host_global_ldflags) |
| 1655 | endif # LOCAL_IS_HOST_MODULE |
| 1656 | |
| 1657 | # To enable coverage for a given module, set LOCAL_NATIVE_COVERAGE=true and |
| 1658 | # build with NATIVE_COVERAGE=true in your enviornment. |
| 1659 | ifeq ($(NATIVE_COVERAGE),true) |
| 1660 | ifeq ($(my_native_coverage),true) |
| 1661 | # Note that clang coverage doesn't play nicely with acov out of the box. |
| 1662 | # Clang apparently generates .gcno files that aren't compatible with |
| 1663 | # gcov-4.8. This can be solved by installing gcc-4.6 and invoking lcov |
| 1664 | # with `--gcov-tool /usr/bin/gcov-4.6`. |
| 1665 | # |
| 1666 | # http://stackoverflow.com/questions/17758126/clang-code-coverage-invalid-output |
| 1667 | my_cflags += --coverage -O0 |
| 1668 | my_ldflags += --coverage |
| 1669 | endif |
| 1670 | |
| 1671 | my_coverage_lib := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)LIBPROFILE_RT) |
| 1672 | |
| 1673 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_COVERAGE_LIB := $(my_coverage_lib) |
| 1674 | $(LOCAL_INTERMEDIATE_TARGETS): $(my_coverage_lib) |
| 1675 | endif |
| 1676 | |
Dan Willemsen | 18ffd58 | 2019-07-31 10:31:20 -0700 | [diff] [blame] | 1677 | #################################################### |
| 1678 | ## Import includes |
| 1679 | #################################################### |
| 1680 | imported_includes := $(strip \ |
| 1681 | $(if $(LOCAL_USE_VNDK),\ |
| 1682 | $(call intermediates-dir-for,HEADER_LIBRARIES,device_kernel_headers,$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))) \ |
| 1683 | $(foreach l, $(installed_shared_library_module_names), \ |
| 1684 | $(call intermediates-dir-for,SHARED_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))) \ |
| 1685 | $(foreach l, $(my_static_libraries) $(my_whole_static_libraries), \ |
| 1686 | $(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))) \ |
| 1687 | $(foreach l, $(my_header_libraries), \ |
| 1688 | $(call intermediates-dir-for,HEADER_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross)))) |
| 1689 | |
| 1690 | $(foreach dep,$(imported_includes),\ |
| 1691 | $(eval EXPORTS.$$(dep).USERS := $$(EXPORTS.$$(dep).USERS) $$(all_objects))) |
| 1692 | |
Dan Willemsen | e24da82 | 2019-01-10 13:10:17 -0800 | [diff] [blame] | 1693 | ########################################################### |
| 1694 | ## Define PRIVATE_ variables used by multiple module types |
| 1695 | ########################################################### |
| 1696 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_NO_DEFAULT_COMPILER_FLAGS := \ |
| 1697 | $(strip $(LOCAL_NO_DEFAULT_COMPILER_FLAGS)) |
| 1698 | |
| 1699 | ifeq ($(strip $(WITH_STATIC_ANALYZER)),) |
| 1700 | LOCAL_NO_STATIC_ANALYZER := true |
| 1701 | endif |
| 1702 | |
| 1703 | ifneq ($(strip $(LOCAL_IS_HOST_MODULE)),) |
| 1704 | my_syntax_arch := host |
| 1705 | else |
| 1706 | my_syntax_arch := $($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH) |
| 1707 | endif |
| 1708 | |
| 1709 | ifeq ($(strip $(my_cc)),) |
| 1710 | my_cc := $(my_cc_wrapper) $(CLANG) |
| 1711 | endif |
| 1712 | |
| 1713 | SYNTAX_TOOLS_PREFIX := \ |
| 1714 | $(LLVM_PREBUILTS_BASE)/$(BUILD_OS)-x86/$(LLVM_PREBUILTS_VERSION)/libexec |
| 1715 | |
| 1716 | ifneq ($(LOCAL_NO_STATIC_ANALYZER),true) |
| 1717 | my_cc := CCC_CC=$(CLANG) CLANG=$(CLANG) \ |
| 1718 | $(SYNTAX_TOOLS_PREFIX)/ccc-analyzer |
| 1719 | endif |
| 1720 | |
| 1721 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CC := $(my_cc) |
| 1722 | |
| 1723 | ifeq ($(strip $(my_cxx)),) |
| 1724 | my_cxx := $(my_cxx_wrapper) $(CLANG_CXX) |
| 1725 | endif |
| 1726 | |
Ramy Medhat | e5839f9 | 2019-08-06 15:54:48 -0400 | [diff] [blame] | 1727 | ifeq ($(strip $(my_cxx_link)),) |
| 1728 | my_cxx_link := $(CLANG_CXX) |
| 1729 | endif |
| 1730 | |
Dan Willemsen | e24da82 | 2019-01-10 13:10:17 -0800 | [diff] [blame] | 1731 | ifneq ($(LOCAL_NO_STATIC_ANALYZER),true) |
| 1732 | my_cxx := CCC_CXX=$(CLANG_CXX) CLANG_CXX=$(CLANG_CXX) \ |
| 1733 | $(SYNTAX_TOOLS_PREFIX)/c++-analyzer |
Ramy Medhat | e5839f9 | 2019-08-06 15:54:48 -0400 | [diff] [blame] | 1734 | my_cxx_link := CCC_CXX=$(CLANG_CXX) CLANG_CXX=$(CLANG_CXX) \ |
| 1735 | $(SYNTAX_TOOLS_PREFIX)/c++-analyzer |
Dan Willemsen | e24da82 | 2019-01-10 13:10:17 -0800 | [diff] [blame] | 1736 | endif |
| 1737 | |
| 1738 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LINKER := $(my_linker) |
| 1739 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CXX := $(my_cxx) |
Ramy Medhat | e5839f9 | 2019-08-06 15:54:48 -0400 | [diff] [blame] | 1740 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CXX_LINK := $(my_cxx_link) |
Dan Willemsen | e24da82 | 2019-01-10 13:10:17 -0800 | [diff] [blame] | 1741 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1742 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_YACCFLAGS := $(LOCAL_YACCFLAGS) |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 1743 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASFLAGS := $(my_asflags) |
Stephen Hines | 1568029 | 2014-11-26 00:53:46 -0800 | [diff] [blame] | 1744 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CONLYFLAGS := $(my_conlyflags) |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 1745 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CFLAGS := $(my_cflags) |
| 1746 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CPPFLAGS := $(my_cppflags) |
Dan Albert | d160041 | 2015-06-10 16:33:43 -0700 | [diff] [blame] | 1747 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CFLAGS_NO_OVERRIDE := $(my_cflags_no_override) |
| 1748 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CPPFLAGS_NO_OVERRIDE := $(my_cppflags_no_override) |
Doug Kwan | 9a8ecf9 | 2011-05-10 21:50:58 -0700 | [diff] [blame] | 1749 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RTTI_FLAG := $(LOCAL_RTTI_FLAG) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1750 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEBUG_CFLAGS := $(debug_cflags) |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 1751 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_C_INCLUDES := $(my_c_includes) |
Dan Willemsen | 18ffd58 | 2019-07-31 10:31:20 -0700 | [diff] [blame] | 1752 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_IMPORTED_INCLUDES := $(imported_includes) |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 1753 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDFLAGS := $(my_ldflags) |
Dan Albert | b05f2ca | 2014-09-12 14:46:57 -0700 | [diff] [blame] | 1754 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDLIBS := $(my_ldlibs) |
Chih-Hung Hsieh | a9a55c7 | 2016-03-31 16:30:23 -0700 | [diff] [blame] | 1755 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TIDY_CHECKS := $(my_tidy_checks) |
| 1756 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TIDY_FLAGS := $(my_tidy_flags) |
Evgenii Stepanov | e1b96f3 | 2017-01-23 16:57:38 -0800 | [diff] [blame] | 1757 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ARFLAGS := $(my_arflags) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1758 | |
| 1759 | # this is really the way to get the files onto the command line instead |
| 1760 | # of using $^, because then LOCAL_ADDITIONAL_DEPENDENCIES doesn't work |
| 1761 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_SHARED_LIBRARIES := $(built_shared_libraries) |
| 1762 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_STATIC_LIBRARIES := $(built_static_libraries) |
| 1763 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_WHOLE_STATIC_LIBRARIES := $(built_whole_libraries) |
Ying Wang | 4aaa1a1 | 2016-03-22 18:23:13 -0700 | [diff] [blame] | 1764 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_OBJECTS := $(strip $(all_objects)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1765 | |
| 1766 | ########################################################### |
| 1767 | # Define library dependencies. |
| 1768 | ########################################################### |
| 1769 | # all_libraries is used for the dependencies on LOCAL_BUILT_MODULE. |
| 1770 | all_libraries := \ |
Ying Wang | c01f2dc | 2015-12-15 10:00:19 -0800 | [diff] [blame] | 1771 | $(built_shared_library_deps) \ |
Shinichiro Hamaji | 0e7587a | 2015-10-09 14:36:04 +0900 | [diff] [blame] | 1772 | $(my_system_shared_libraries_fullpath) \ |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1773 | $(built_static_libraries) \ |
| 1774 | $(built_whole_libraries) |
| 1775 | |
Ying Wang | 5f07480 | 2011-11-08 09:31:21 -0800 | [diff] [blame] | 1776 | ########################################################### |
| 1777 | # Export includes |
| 1778 | ########################################################### |
Dan Willemsen | 18ffd58 | 2019-07-31 10:31:20 -0700 | [diff] [blame] | 1779 | |
Christopher Wiley | ff1c3f2 | 2016-04-11 12:40:36 -0700 | [diff] [blame] | 1780 | # Headers exported by whole static libraries are also exported by this library. |
Dan Willemsen | a7808ac | 2016-03-04 12:40:25 -0800 | [diff] [blame] | 1781 | export_include_deps := $(strip \ |
| 1782 | $(foreach l,$(my_whole_static_libraries), \ |
Dan Willemsen | 18ffd58 | 2019-07-31 10:31:20 -0700 | [diff] [blame] | 1783 | $(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross)))) |
Christopher Wiley | ff1c3f2 | 2016-04-11 12:40:36 -0700 | [diff] [blame] | 1784 | # Re-export requested headers from shared libraries. |
| 1785 | export_include_deps += $(strip \ |
| 1786 | $(foreach l,$(LOCAL_EXPORT_SHARED_LIBRARY_HEADERS), \ |
Dan Willemsen | 18ffd58 | 2019-07-31 10:31:20 -0700 | [diff] [blame] | 1787 | $(call intermediates-dir-for,SHARED_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross)))) |
Christopher Wiley | ff1c3f2 | 2016-04-11 12:40:36 -0700 | [diff] [blame] | 1788 | # Re-export requested headers from static libraries. |
| 1789 | export_include_deps += $(strip \ |
| 1790 | $(foreach l,$(LOCAL_EXPORT_STATIC_LIBRARY_HEADERS), \ |
Dan Willemsen | 18ffd58 | 2019-07-31 10:31:20 -0700 | [diff] [blame] | 1791 | $(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross)))) |
Dan Willemsen | 8dae49c | 2017-02-15 15:48:11 -0800 | [diff] [blame] | 1792 | # Re-export requested headers from header libraries. |
| 1793 | export_include_deps += $(strip \ |
| 1794 | $(foreach l,$(LOCAL_EXPORT_HEADER_LIBRARY_HEADERS), \ |
Dan Willemsen | 18ffd58 | 2019-07-31 10:31:20 -0700 | [diff] [blame] | 1795 | $(call intermediates-dir-for,HEADER_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross)))) |
Colin Cross | 6b9bddd | 2015-11-30 17:33:26 -0800 | [diff] [blame] | 1796 | |
Dan Willemsen | 18ffd58 | 2019-07-31 10:31:20 -0700 | [diff] [blame] | 1797 | ifneq ($(strip $(my_export_c_include_dirs)$(export_include_deps)),) |
| 1798 | EXPORTS_LIST := $(EXPORTS_LIST) $(intermediates) |
| 1799 | EXPORTS.$(intermediates).FLAGS := $(foreach d,$(my_export_c_include_dirs),-I $(d)) |
| 1800 | EXPORTS.$(intermediates).REEXPORT := $(export_include_deps) |
| 1801 | EXPORTS.$(intermediates).DEPS := $(my_export_c_include_deps) $(my_generated_sources) $(LOCAL_EXPORT_C_INCLUDE_DEPS) |
| 1802 | endif |
Dan Willemsen | fc92fb2 | 2016-08-26 13:27:13 -0700 | [diff] [blame] | 1803 | |
Dan Willemsen | 0be6907 | 2016-12-13 18:28:33 -0800 | [diff] [blame] | 1804 | ifneq (,$(filter-out $(LOCAL_PATH)/%,$(my_export_c_include_dirs))) |
| 1805 | my_soong_problems += non_local__export_c_include_dirs |
| 1806 | endif |
| 1807 | |
Dan Willemsen | fc92fb2 | 2016-08-26 13:27:13 -0700 | [diff] [blame] | 1808 | SOONG_CONV.$(LOCAL_MODULE).PROBLEMS := \ |
| 1809 | $(SOONG_CONV.$(LOCAL_MODULE).PROBLEMS) $(my_soong_problems) |
| 1810 | SOONG_CONV.$(LOCAL_MODULE).DEPS := \ |
| 1811 | $(SOONG_CONV.$(LOCAL_MODULE).DEPS) \ |
Dan Willemsen | 0bf506f | 2017-04-25 15:42:14 -0700 | [diff] [blame] | 1812 | $(filter-out $($(LOCAL_2ND_ARCH_VAR_PREFIX)UBSAN_RUNTIME_LIBRARY),\ |
| 1813 | $(my_static_libraries) \ |
| 1814 | $(my_whole_static_libraries) \ |
| 1815 | $(my_shared_libraries) \ |
| 1816 | $(my_system_shared_libraries)) |
Colin Cross | 3277ba3 | 2017-12-06 14:37:06 -0800 | [diff] [blame] | 1817 | SOONG_CONV.$(LOCAL_MODULE).TYPE := native |
Dan Willemsen | fc92fb2 | 2016-08-26 13:27:13 -0700 | [diff] [blame] | 1818 | SOONG_CONV := $(SOONG_CONV) $(LOCAL_MODULE) |
Ryan Campbell | 81c9d29 | 2016-09-12 13:56:50 -0700 | [diff] [blame] | 1819 | |
| 1820 | ########################################################### |
| 1821 | # Coverage packaging. |
| 1822 | ########################################################### |
| 1823 | ifeq ($(my_native_coverage),true) |
Ryan Campbell | 5a6ea36 | 2017-02-28 16:20:23 -0800 | [diff] [blame] | 1824 | my_gcno_objects := \ |
| 1825 | $(cpp_objects) \ |
| 1826 | $(gen_cpp_objects) \ |
| 1827 | $(c_objects) \ |
| 1828 | $(gen_c_objects) \ |
| 1829 | $(objc_objects) \ |
| 1830 | $(objcpp_objects) |
| 1831 | |
| 1832 | LOCAL_GCNO_FILES := $(patsubst %.o,%.gcno,$(my_gcno_objects)) |
| 1833 | $(foreach f,$(my_gcno_objects),$(eval $(call gcno-touch-rule,$(f),$(f:.o=.gcno)))) |
Ryan Campbell | 81c9d29 | 2016-09-12 13:56:50 -0700 | [diff] [blame] | 1834 | endif |