binary.mk revision 31927f76a39bbb334cd384850b98366f4a634d40
1########################################################### 2## Standard rules for building binary object files from 3## asm/c/cpp/yacc/lex/etc source files. 4## 5## The list of object files is exported in $(all_objects). 6########################################################### 7 8####################################### 9include $(BUILD_SYSTEM)/base_rules.mk 10####################################### 11 12################################################## 13# Compute the dependency of the shared libraries 14################################################## 15# On the target, we compile with -nostdlib, so we must add in the 16# default system shared libraries, unless they have requested not 17# to by supplying a LOCAL_SYSTEM_SHARED_LIBRARIES value. One would 18# supply that, for example, when building libc itself. 19ifdef LOCAL_IS_HOST_MODULE 20 ifeq ($(LOCAL_SYSTEM_SHARED_LIBRARIES),none) 21 my_system_shared_libraries := 22 else 23 my_system_shared_libraries := $(LOCAL_SYSTEM_SHARED_LIBRARIES) 24 endif 25else 26 ifeq ($(LOCAL_SYSTEM_SHARED_LIBRARIES),none) 27 my_system_shared_libraries := libc libm 28 else 29 my_system_shared_libraries := $(LOCAL_SYSTEM_SHARED_LIBRARIES) 30 endif 31endif 32 33# The following LOCAL_ variables will be modified in this file. 34# Because the same LOCAL_ variables may be used to define modules for both 1st arch and 2nd arch, 35# we can't modify them in place. 36my_src_files := $(LOCAL_SRC_FILES) 37my_static_libraries := $(LOCAL_STATIC_LIBRARIES) 38my_whole_static_libraries := $(LOCAL_WHOLE_STATIC_LIBRARIES) 39my_shared_libraries := $(LOCAL_SHARED_LIBRARIES) 40my_cflags := $(LOCAL_CFLAGS) 41my_conlyflags := $(LOCAL_CONLYFLAGS) 42my_cppflags := $(LOCAL_CPPFLAGS) 43my_cflags_no_override := $(GLOBAL_CFLAGS_NO_OVERRIDE) 44my_cppflags_no_override := $(GLOBAL_CPPFLAGS_NO_OVERRIDE) 45my_ldflags := $(LOCAL_LDFLAGS) 46my_ldlibs := $(LOCAL_LDLIBS) 47my_asflags := $(LOCAL_ASFLAGS) 48my_cc := $(LOCAL_CC) 49my_cc_wrapper := $(CC_WRAPPER) 50my_cxx := $(LOCAL_CXX) 51my_cxx_wrapper := $(CXX_WRAPPER) 52my_c_includes := $(LOCAL_C_INCLUDES) 53my_generated_sources := $(LOCAL_GENERATED_SOURCES) 54my_native_coverage := $(LOCAL_NATIVE_COVERAGE) 55my_additional_dependencies := $(LOCAL_MODULE_MAKEFILE) $(LOCAL_ADDITIONAL_DEPENDENCIES) 56my_export_c_include_dirs := $(LOCAL_EXPORT_C_INCLUDE_DIRS) 57 58ifdef LOCAL_IS_HOST_MODULE 59my_allow_undefined_symbols := true 60else 61my_allow_undefined_symbols := $(strip $(LOCAL_ALLOW_UNDEFINED_SYMBOLS)) 62endif 63 64my_ndk_sysroot := 65my_ndk_sysroot_include := 66my_ndk_sysroot_lib := 67ifdef LOCAL_SDK_VERSION 68 ifdef LOCAL_NDK_VERSION 69 $(error $(LOCAL_PATH): LOCAL_NDK_VERSION is now retired.) 70 endif 71 ifdef LOCAL_IS_HOST_MODULE 72 $(error $(LOCAL_PATH): LOCAL_SDK_VERSION cannot be used in host module) 73 endif 74 my_ndk_source_root := $(HISTORICAL_NDK_VERSIONS_ROOT)/current/sources 75 my_ndk_sysroot := $(HISTORICAL_NDK_VERSIONS_ROOT)/current/platforms/android-$(LOCAL_SDK_VERSION)/arch-$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH) 76 my_ndk_sysroot_include := $(my_ndk_sysroot)/usr/include 77 ifeq (x86_64,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) 78 my_ndk_sysroot_lib := $(my_ndk_sysroot)/usr/lib64 79 else ifeq (mips32r6,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH_VARIANT)) 80 my_ndk_sysroot_lib := $(my_ndk_sysroot)/usr/libr6 81 else 82 my_ndk_sysroot_lib := $(my_ndk_sysroot)/usr/lib 83 endif 84 85 # The bionic linker now has support for packed relocations and gnu style 86 # hashes (which are much faster!), but shipping to older devices requires 87 # the old style hash and disabling packed relocations. 88 #ifeq ($(shell expr $(LOCAL_SDK_VERSION) >= FIRST_SUPPORTED_VERSION),0) 89 my_ldflags += -Wl,--hash-style=sysv 90 LOCAL_PACK_MODULE_RELOCATIONS := false 91 #endif 92 93 # Set up the NDK stl variant. Starting from NDK-r5 the c++ stl resides in a separate location. 94 # See ndk/docs/CPLUSPLUS-SUPPORT.html 95 my_ndk_stl_include_path := 96 my_ndk_stl_shared_lib_fullpath := 97 my_ndk_stl_shared_lib := 98 my_ndk_stl_static_lib := 99 my_ndk_stl_cppflags := 100 my_cpu_variant := $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)CPU_ABI) 101 ifeq (mips32r6,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH_VARIANT)) 102 my_cpu_variant := mips32r6 103 endif 104 LOCAL_NDK_STL_VARIANT := $(strip $(LOCAL_NDK_STL_VARIANT)) 105 ifeq (,$(LOCAL_NDK_STL_VARIANT)) 106 LOCAL_NDK_STL_VARIANT := system 107 endif 108 ifneq (1,$(words $(filter system stlport_static stlport_shared c++_static c++_shared gnustl_static, $(LOCAL_NDK_STL_VARIANT)))) 109 $(error $(LOCAL_PATH): Unknown LOCAL_NDK_STL_VARIANT $(LOCAL_NDK_STL_VARIANT)) 110 endif 111 ifeq (system,$(LOCAL_NDK_STL_VARIANT)) 112 my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/system/include 113 # for "system" variant, the shared library exists in the system library and -lstdc++ is added by default. 114 else # LOCAL_NDK_STL_VARIANT is not system 115 ifneq (,$(filter stlport_%, $(LOCAL_NDK_STL_VARIANT))) 116 my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/stlport/stlport 117 ifeq (stlport_static,$(LOCAL_NDK_STL_VARIANT)) 118 my_ndk_stl_static_lib := $(my_ndk_source_root)/cxx-stl/stlport/libs/$(my_cpu_variant)/libstlport_static.a 119 else 120 my_ndk_stl_shared_lib_fullpath := $(my_ndk_source_root)/cxx-stl/stlport/libs/$(my_cpu_variant)/libstlport_shared.so 121 my_ndk_stl_shared_lib := -lstlport_shared 122 endif 123 else # LOCAL_NDK_STL_VARIANT is not stlport_* either 124 ifneq (,$(filter c++_%, $(LOCAL_NDK_STL_VARIANT))) 125 my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/llvm-libc++/libcxx/include \ 126 $(my_ndk_source_root)/cxx-stl/llvm-libc++/gabi++/include \ 127 $(my_ndk_source_root)/android/support/include 128 ifeq (c++_static,$(LOCAL_NDK_STL_VARIANT)) 129 my_ndk_stl_static_lib := $(my_ndk_source_root)/cxx-stl/llvm-libc++/libs/$(my_cpu_variant)/libc++_static.a 130 else 131 my_ndk_stl_shared_lib_fullpath := $(my_ndk_source_root)/cxx-stl/llvm-libc++/libs/$(my_cpu_variant)/libc++_shared.so 132 my_ndk_stl_shared_lib := -lc++_shared 133 endif 134 my_ndk_stl_cppflags := -std=c++11 135 else 136 # LOCAL_NDK_STL_VARIANT is gnustl_static 137 my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/$($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_NDK_GCC_VERSION)/libs/$(my_cpu_variant)/include \ 138 $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/$($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_NDK_GCC_VERSION)/include 139 my_ndk_stl_static_lib := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/$($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_NDK_GCC_VERSION)/libs/$(my_cpu_variant)/libgnustl_static.a 140 endif 141 endif 142 endif 143endif 144 145# MinGW spits out warnings about -fPIC even for -fpie?!) being ignored because 146# all code is position independent, and then those warnings get promoted to 147# errors. 148ifneq ($($(my_prefix)OS),windows) 149ifeq ($(LOCAL_MODULE_CLASS),EXECUTABLES) 150my_cflags += -fpie 151else 152my_cflags += -fPIC 153endif 154endif 155 156ifdef LOCAL_IS_HOST_MODULE 157my_src_files += $(LOCAL_SRC_FILES_$($(my_prefix)OS)) $(LOCAL_SRC_FILES_$($(my_prefix)OS)_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) 158my_static_libraries += $(LOCAL_STATIC_LIBRARIES_$($(my_prefix)OS)) 159my_shared_libraries += $(LOCAL_SHARED_LIBRARIES_$($(my_prefix)OS)) 160my_cflags += $(LOCAL_CFLAGS_$($(my_prefix)OS)) 161my_cppflags += $(LOCAL_CPPFLAGS_$($(my_prefix)OS)) 162my_ldflags += $(LOCAL_LDFLAGS_$($(my_prefix)OS)) 163my_ldlibs += $(LOCAL_LDLIBS_$($(my_prefix)OS)) 164my_asflags += $(LOCAL_ASFLAGS_$($(my_prefix)OS)) 165my_c_includes += $(LOCAL_C_INCLUDES_$($(my_prefix)OS)) 166my_generated_sources += $(LOCAL_GENERATED_SOURCES_$($(my_prefix)OS)) 167endif 168 169my_src_files += $(LOCAL_SRC_FILES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_SRC_FILES_$(my_32_64_bit_suffix)) 170my_shared_libraries += $(LOCAL_SHARED_LIBRARIES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_SHARED_LIBRARIES_$(my_32_64_bit_suffix)) 171my_cflags += $(LOCAL_CFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CFLAGS_$(my_32_64_bit_suffix)) 172my_cppflags += $(LOCAL_CPPFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CPPFLAGS_$(my_32_64_bit_suffix)) 173my_ldflags += $(LOCAL_LDFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_LDFLAGS_$(my_32_64_bit_suffix)) 174my_asflags += $(LOCAL_ASFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_ASFLAGS_$(my_32_64_bit_suffix)) 175my_c_includes += $(LOCAL_C_INCLUDES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_C_INCLUDES_$(my_32_64_bit_suffix)) 176my_generated_sources += $(LOCAL_GENERATED_SOURCES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_GENERATED_SOURCES_$(my_32_64_bit_suffix)) 177 178my_clang := $(strip $(LOCAL_CLANG)) 179ifdef LOCAL_CLANG_$(my_32_64_bit_suffix) 180my_clang := $(strip $(LOCAL_CLANG_$(my_32_64_bit_suffix))) 181endif 182ifdef LOCAL_CLANG_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH) 183my_clang := $(strip $(LOCAL_CLANG_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))) 184endif 185 186# clang is enabled by default for host builds 187# enable it unless we've specifically disabled clang above 188ifdef LOCAL_IS_HOST_MODULE 189 ifneq ($($(my_prefix)OS),windows) 190 ifeq ($(my_clang),) 191 my_clang := true 192 endif 193 endif 194# Add option to make clang the default for device build 195else ifeq ($(USE_CLANG_PLATFORM_BUILD),true) 196 ifeq ($(my_clang),) 197 my_clang := true 198 endif 199endif 200 201my_cpp_std_version := -std=gnu++14 202ifdef LOCAL_SDK_VERSION 203 # The NDK handles this itself. 204 my_cpp_std_version := 205endif 206 207ifdef LOCAL_IS_HOST_MODULE 208 ifneq ($(my_clang),true) 209 # The host GCC doesn't support C++14 (and is deprecated, so likely 210 # never will). Build these modules with C++11. 211 my_cpp_std_version := -std=gnu++11 212 endif 213endif 214 215my_cppflags := $(my_cpp_std_version) $(my_cppflags) 216 217 218# arch-specific static libraries go first so that generic ones can depend on them 219my_static_libraries := $(LOCAL_STATIC_LIBRARIES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_STATIC_LIBRARIES_$(my_32_64_bit_suffix)) $(my_static_libraries) 220my_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) 221 222include $(BUILD_SYSTEM)/cxx_stl_setup.mk 223 224# Add static HAL libraries 225ifdef LOCAL_HAL_STATIC_LIBRARIES 226$(foreach lib, $(LOCAL_HAL_STATIC_LIBRARIES), \ 227 $(eval b_lib := $(filter $(lib).%,$(BOARD_HAL_STATIC_LIBRARIES)))\ 228 $(if $(b_lib), $(eval my_static_libraries += $(b_lib)),\ 229 $(eval my_static_libraries += $(lib).default))) 230b_lib := 231endif 232 233my_linker := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LINKER) 234 235include $(BUILD_SYSTEM)/config_sanitizers.mk 236 237# Add in libcompiler_rt for all regular device builds 238ifeq (,$(LOCAL_SDK_VERSION)$(WITHOUT_LIBCOMPILER_RT)) 239 my_static_libraries += $(COMPILER_RT_CONFIG_EXTRA_STATIC_LIBRARIES) 240endif 241 242#################################################### 243## Add FDO flags if FDO is turned on and supported 244## Please note that we will do option filtering during FDO build. 245## i.e. Os->O2, remove -fno-early-inline and -finline-limit. 246################################################################## 247my_fdo_build := 248ifneq ($(filter true always, $(LOCAL_FDO_SUPPORT)),) 249 ifeq ($(BUILD_FDO_INSTRUMENT),true) 250 my_cflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_FDO_INSTRUMENT_CFLAGS) 251 my_ldflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_FDO_INSTRUMENT_LDFLAGS) 252 my_fdo_build := true 253 else ifneq ($(filter true,$(BUILD_FDO_OPTIMIZE))$(filter always,$(LOCAL_FDO_SUPPORT)),) 254 my_cflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_FDO_OPTIMIZE_CFLAGS) 255 my_fdo_build := true 256 endif 257 # Disable ccache (or other compiler wrapper). 258 my_cc_wrapper := 259 my_cxx_wrapper := 260endif 261 262########################################################### 263## Explicitly declare assembly-only __ASSEMBLY__ macro for 264## assembly source 265########################################################### 266my_asflags += -D__ASSEMBLY__ 267 268 269########################################################### 270## Define PRIVATE_ variables from global vars 271########################################################### 272ifndef LOCAL_IS_HOST_MODULE 273ifdef LOCAL_SDK_VERSION 274my_target_project_includes := 275my_target_c_includes := $(my_ndk_stl_include_path) $(my_ndk_sysroot_include) 276my_target_global_cppflags := $(my_ndk_stl_cppflags) 277else 278my_target_project_includes := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_PROJECT_INCLUDES) 279my_target_c_includes := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_C_INCLUDES) 280my_target_global_cppflags := 281endif # LOCAL_SDK_VERSION 282 283ifeq ($(my_clang),true) 284my_target_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_TARGET_GLOBAL_CFLAGS) 285my_target_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_TARGET_GLOBAL_CONLYFLAGS) 286my_target_global_cppflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_TARGET_GLOBAL_CPPFLAGS) 287my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_TARGET_GLOBAL_LDFLAGS) 288else 289my_target_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_CFLAGS) 290my_target_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_CONLYFLAGS) 291my_target_global_cppflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_CPPFLAGS) 292my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LDFLAGS) 293endif # my_clang 294 295$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_PROJECT_INCLUDES := $(my_target_project_includes) 296$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_C_INCLUDES := $(my_target_c_includes) 297$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CFLAGS := $(my_target_global_cflags) 298$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CONLYFLAGS := $(my_target_global_conlyflags) 299$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CPPFLAGS := $(my_target_global_cppflags) 300$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(my_target_global_ldflags) 301 302else # LOCAL_IS_HOST_MODULE 303 304ifeq ($(my_clang),true) 305my_host_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CFLAGS) 306my_host_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CONLYFLAGS) 307my_host_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CPPFLAGS) 308my_host_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_LDFLAGS) 309my_host_c_includes := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES) 310else 311my_host_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_CFLAGS) 312my_host_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_CONLYFLAGS) 313my_host_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_CPPFLAGS) 314my_host_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_LDFLAGS) 315my_host_c_includes := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES) 316endif # my_clang 317 318$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_C_INCLUDES := $(my_host_c_includes) 319$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_CFLAGS := $(my_host_global_cflags) 320$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_CONLYFLAGS := $(my_host_global_conlyflags) 321$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_CPPFLAGS := $(my_host_global_cppflags) 322$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_LDFLAGS := $(my_host_global_ldflags) 323endif # LOCAL_IS_HOST_MODULE 324 325# To enable coverage for a given module, set LOCAL_NATIVE_COVERAGE=true and 326# build with NATIVE_COVERAGE=true in your enviornment. Note that the build 327# system is not sensitive to changes to NATIVE_COVERAGE, so you should do a 328# clean build of your module after toggling it. 329ifeq ($(NATIVE_COVERAGE),true) 330 ifeq ($(my_native_coverage),true) 331 # Note that clang coverage doesn't play nicely with acov out of the box. 332 # Clang apparently generates .gcno files that aren't compatible with 333 # gcov-4.8. This can be solved by installing gcc-4.6 and invoking lcov 334 # with `--gcov-tool /usr/bin/gcov-4.6`. 335 # 336 # http://stackoverflow.com/questions/17758126/clang-code-coverage-invalid-output 337 my_cflags += --coverage -O0 338 my_ldflags += --coverage 339 endif 340else 341 my_native_coverage := false 342endif 343 344########################################################### 345## Define PRIVATE_ variables used by multiple module types 346########################################################### 347$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_NO_DEFAULT_COMPILER_FLAGS := \ 348 $(strip $(LOCAL_NO_DEFAULT_COMPILER_FLAGS)) 349 350ifeq ($(strip $(WITH_SYNTAX_CHECK)),) 351 LOCAL_NO_SYNTAX_CHECK := true 352endif 353 354ifeq ($(strip $(WITH_STATIC_ANALYZER)),) 355 LOCAL_NO_STATIC_ANALYZER := true 356endif 357 358ifneq ($(strip $(LOCAL_IS_HOST_MODULE)),) 359 my_syntax_arch := host 360else 361 my_syntax_arch := $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH) 362endif 363 364ifeq ($(strip $(my_cc)),) 365 ifeq ($(my_clang),true) 366 my_cc := $(CLANG) 367 else 368 my_cc := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)CC) 369 endif 370 my_cc := $(my_cc_wrapper) $(my_cc) 371endif 372ifneq ($(LOCAL_NO_STATIC_ANALYZER),true) 373 my_cc := $(SYNTAX_TOOLS_PREFIX)/ccc-analyzer $(my_syntax_arch) "$(my_cc)" 374else 375ifneq ($(LOCAL_NO_SYNTAX_CHECK),true) 376 my_cc := $(SYNTAX_TOOLS_PREFIX)/ccc-syntax $(my_syntax_arch) "$(my_cc)" 377endif 378endif 379$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CC := $(my_cc) 380 381ifeq ($(strip $(my_cxx)),) 382 ifeq ($(my_clang),true) 383 my_cxx := $(CLANG_CXX) 384 else 385 my_cxx := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)CXX) 386 endif 387 my_cxx := $(my_cxx_wrapper) $(my_cxx) 388endif 389ifneq ($(LOCAL_NO_STATIC_ANALYZER),true) 390 my_cxx := $(SYNTAX_TOOLS_PREFIX)/cxx-analyzer $(my_syntax_arch) "$(my_cxx)" 391else 392ifneq ($(LOCAL_NO_SYNTAX_CHECK),true) 393 my_cxx := $(SYNTAX_TOOLS_PREFIX)/cxx-syntax $(my_syntax_arch) "$(my_cxx)" 394endif 395endif 396$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LINKER := $(my_linker) 397$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CXX := $(my_cxx) 398$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CLANG := $(my_clang) 399 400# TODO: support a mix of standard extensions so that this isn't necessary 401LOCAL_CPP_EXTENSION := $(strip $(LOCAL_CPP_EXTENSION)) 402ifeq ($(LOCAL_CPP_EXTENSION),) 403 LOCAL_CPP_EXTENSION := .cpp 404endif 405$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CPP_EXTENSION := $(LOCAL_CPP_EXTENSION) 406 407# Certain modules like libdl have to have symbols resolved at runtime and blow 408# up if --no-undefined is passed to the linker. 409ifeq ($(strip $(LOCAL_NO_DEFAULT_COMPILER_FLAGS)),) 410ifeq ($(my_allow_undefined_symbols),) 411 my_ldflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)NO_UNDEFINED_LDFLAGS) 412endif 413endif 414 415# Target modules shouldn't re-export libgcc.a because we don't want other 416# binaries importing them when they should be getting their own copy of the 417# builtins. 418# 419# Unfortunately --exclude-libs always overrides all other attempts to make a 420# symbol visible, and libc needs to make sure some of these symbols are 421# available for binary compatibility, so libc needs a way to disable this. 422ifneq ($(strip $(LOCAL_NO_EXCLUDE_LIBS)),true) 423 my_ldflags += -Wl,--exclude-libs,libgcc.a 424endif 425 426ifeq (true,$(LOCAL_GROUP_STATIC_LIBRARIES)) 427$(LOCAL_BUILT_MODULE): PRIVATE_GROUP_STATIC_LIBRARIES := true 428else 429$(LOCAL_BUILT_MODULE): PRIVATE_GROUP_STATIC_LIBRARIES := 430endif 431 432########################################################### 433## Define arm-vs-thumb-mode flags. 434########################################################### 435LOCAL_ARM_MODE := $(strip $(LOCAL_ARM_MODE)) 436ifeq ($($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH),arm) 437arm_objects_mode := $(if $(LOCAL_ARM_MODE),$(LOCAL_ARM_MODE),arm) 438normal_objects_mode := $(if $(LOCAL_ARM_MODE),$(LOCAL_ARM_MODE),thumb) 439 440# Read the values from something like TARGET_arm_CFLAGS or 441# TARGET_thumb_CFLAGS. HOST_(arm|thumb)_CFLAGS values aren't 442# actually used (although they are usually empty). 443arm_objects_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)$(arm_objects_mode)_CFLAGS) 444normal_objects_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)$(normal_objects_mode)_CFLAGS) 445ifeq ($(my_clang),true) 446arm_objects_cflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(arm_objects_cflags)) 447normal_objects_cflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(normal_objects_cflags)) 448endif 449 450else 451arm_objects_mode := 452normal_objects_mode := 453arm_objects_cflags := 454normal_objects_cflags := 455endif 456 457########################################################### 458## Define per-module debugging flags. Users can turn on 459## debugging for a particular module by setting DEBUG_MODULE_ModuleName 460## to a non-empty value in their environment or buildspec.mk, 461## and setting HOST_/TARGET_CUSTOM_DEBUG_CFLAGS to the 462## debug flags that they want to use. 463########################################################### 464ifdef DEBUG_MODULE_$(strip $(LOCAL_MODULE)) 465 debug_cflags := $($(my_prefix)CUSTOM_DEBUG_CFLAGS) 466else 467 debug_cflags := 468endif 469 470#################################################### 471## Compile RenderScript with reflected C++ 472#################################################### 473 474renderscript_sources := $(filter %.rs %.fs,$(my_src_files)) 475 476ifneq (,$(renderscript_sources)) 477 478renderscript_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(renderscript_sources)) 479RenderScript_file_stamp := $(intermediates)/RenderScriptCPP.stamp 480renderscript_intermediate := $(intermediates)/renderscript 481 482renderscript_target_api := 483 484ifneq (,$(LOCAL_RENDERSCRIPT_TARGET_API)) 485renderscript_target_api := $(LOCAL_RENDERSCRIPT_TARGET_API) 486else 487ifneq (,$(LOCAL_SDK_VERSION)) 488# Set target-api for LOCAL_SDK_VERSIONs other than current. 489ifneq (,$(filter-out current system_current, $(LOCAL_SDK_VERSION))) 490renderscript_target_api := $(LOCAL_SDK_VERSION) 491endif 492endif # LOCAL_SDK_VERSION is set 493endif # LOCAL_RENDERSCRIPT_TARGET_API is set 494 495 496ifeq ($(LOCAL_RENDERSCRIPT_CC),) 497LOCAL_RENDERSCRIPT_CC := $(LLVM_RS_CC) 498endif 499 500# Turn on all warnings and warnings as errors for RS compiles. 501# This can be disabled with LOCAL_RENDERSCRIPT_FLAGS := -Wno-error 502renderscript_flags := -Wall -Werror 503renderscript_flags += $(LOCAL_RENDERSCRIPT_FLAGS) 504# -m32 or -m64 505renderscript_flags += -m$(my_32_64_bit_suffix) 506 507renderscript_includes := \ 508 $(TOPDIR)external/clang/lib/Headers \ 509 $(TOPDIR)frameworks/rs/scriptc \ 510 $(LOCAL_RENDERSCRIPT_INCLUDES) 511 512ifneq ($(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE),) 513renderscript_includes := $(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE) 514endif 515 516bc_dep_files := $(addprefix $(renderscript_intermediate)/, \ 517 $(patsubst %.fs,%.d, $(patsubst %.rs,%.d, $(notdir $(renderscript_sources))))) 518 519$(RenderScript_file_stamp): PRIVATE_RS_INCLUDES := $(renderscript_includes) 520$(RenderScript_file_stamp): PRIVATE_RS_CC := $(LOCAL_RENDERSCRIPT_CC) 521$(RenderScript_file_stamp): PRIVATE_RS_FLAGS := $(renderscript_flags) 522$(RenderScript_file_stamp): PRIVATE_RS_SOURCE_FILES := $(renderscript_sources_fullpath) 523$(RenderScript_file_stamp): PRIVATE_RS_OUTPUT_DIR := $(renderscript_intermediate) 524$(RenderScript_file_stamp): PRIVATE_RS_TARGET_API := $(renderscript_target_api) 525$(RenderScript_file_stamp): PRIVATE_DEP_FILES := $(bc_dep_files) 526$(RenderScript_file_stamp): $(renderscript_sources_fullpath) $(LOCAL_RENDERSCRIPT_CC) 527 $(transform-renderscripts-to-cpp-and-bc) 528 529# include the dependency files (.d/.P) generated by llvm-rs-cc. 530-include $(bc_dep_files:%.d=%.P) 531 532LOCAL_INTERMEDIATE_TARGETS += $(RenderScript_file_stamp) 533 534rs_generated_cpps := $(addprefix \ 535 $(renderscript_intermediate)/ScriptC_,$(patsubst %.fs,%.cpp, $(patsubst %.rs,%.cpp, \ 536 $(notdir $(renderscript_sources))))) 537 538# This is just a dummy rule to make sure gmake doesn't skip updating the dependents. 539$(rs_generated_cpps) : $(RenderScript_file_stamp) 540 @echo "Updated RS generated cpp file $@." 541 542my_c_includes += $(renderscript_intermediate) 543my_generated_sources += $(rs_generated_cpps) 544 545endif 546 547 548########################################################### 549## Stuff source generated from one-off tools 550########################################################### 551$(my_generated_sources): PRIVATE_MODULE := $(my_register_name) 552 553my_gen_sources_copy := $(patsubst $(generated_sources_dir)/%,$(intermediates)/%,$(filter $(generated_sources_dir)/%,$(my_generated_sources))) 554 555$(my_gen_sources_copy): $(intermediates)/% : $(generated_sources_dir)/% | $(ACP) 556 @echo "Copy: $@" 557 $(copy-file-to-target) 558 559my_generated_sources := $(patsubst $(generated_sources_dir)/%,$(intermediates)/%,$(my_generated_sources)) 560 561ALL_GENERATED_SOURCES += $(my_generated_sources) 562 563########################################################### 564## Compile the .proto files to .cc (or .c) and then to .o 565########################################################### 566proto_sources := $(filter %.proto,$(my_src_files)) 567proto_generated_objects := 568proto_generated_headers := 569ifneq ($(proto_sources),) 570proto_generated_sources_dir := $(generated_sources_dir)/proto 571proto_generated_obj_dir := $(intermediates)/proto 572 573ifneq (,$(filter nanopb-c nanopb-c-enable_malloc, $(LOCAL_PROTOC_OPTIMIZE_TYPE))) 574my_proto_source_suffix := .c 575my_proto_c_includes := external/nanopb-c 576my_protoc_flags := --nanopb_out=$(proto_generated_sources_dir) \ 577 --plugin=external/nanopb-c/generator/protoc-gen-nanopb 578else 579my_proto_source_suffix := .cc 580my_proto_c_includes := external/protobuf/src 581my_cflags += -DGOOGLE_PROTOBUF_NO_RTTI 582my_protoc_flags := --cpp_out=$(proto_generated_sources_dir) 583endif 584my_proto_c_includes += $(proto_generated_sources_dir) 585 586proto_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(proto_sources)) 587proto_generated_sources := $(addprefix $(proto_generated_sources_dir)/, \ 588 $(patsubst %.proto,%.pb$(my_proto_source_suffix),$(proto_sources_fullpath))) 589proto_generated_headers := $(patsubst %.pb$(my_proto_source_suffix),%.pb.h, $(proto_generated_sources)) 590proto_generated_objects := $(addprefix $(proto_generated_obj_dir)/, \ 591 $(patsubst %.proto,%.pb.o,$(proto_sources_fullpath))) 592 593# Ensure the transform-proto-to-cc rule is only defined once in multilib build. 594ifndef $(my_prefix)_$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_proto_defined 595$(proto_generated_sources): PRIVATE_PROTO_INCLUDES := $(TOP) 596$(proto_generated_sources): PRIVATE_PROTOC_FLAGS := $(LOCAL_PROTOC_FLAGS) $(my_protoc_flags) 597$(proto_generated_sources): $(proto_generated_sources_dir)/%.pb$(my_proto_source_suffix): %.proto $(PROTOC) 598 $(transform-proto-to-cc) 599 600# This is just a dummy rule to make sure gmake doesn't skip updating the dependents. 601$(proto_generated_headers): $(proto_generated_sources_dir)/%.pb.h: $(proto_generated_sources_dir)/%.pb$(my_proto_source_suffix) 602 @echo "Updated header file $@." 603 604$(my_prefix)_$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_proto_defined := true 605endif # transform-proto-to-cc rule included only once 606 607$(proto_generated_objects): PRIVATE_ARM_MODE := $(normal_objects_mode) 608$(proto_generated_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags) 609$(proto_generated_objects): $(proto_generated_obj_dir)/%.o: $(proto_generated_sources_dir)/%$(my_proto_source_suffix) $(proto_generated_headers) 610ifeq ($(my_proto_source_suffix),.c) 611 $(transform-$(PRIVATE_HOST)c-to-o) 612else 613 $(transform-$(PRIVATE_HOST)cpp-to-o) 614endif 615-include $(proto_generated_objects:%.o=%.P) 616 617my_c_includes += $(my_proto_c_includes) 618# Auto-export the generated proto source dir. 619my_export_c_include_dirs += $(my_proto_c_includes) 620 621ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nanopb-c-enable_malloc) 622 my_static_libraries += libprotobuf-c-nano-enable_malloc 623else ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nanopb-c) 624 my_static_libraries += libprotobuf-c-nano 625else ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),full) 626 ifdef LOCAL_SDK_VERSION 627 my_static_libraries += libprotobuf-cpp-full-ndk 628 else 629 my_shared_libraries += libprotobuf-cpp-full 630 endif 631else 632 ifdef LOCAL_SDK_VERSION 633 my_static_libraries += libprotobuf-cpp-lite-ndk 634 else 635 my_shared_libraries += libprotobuf-cpp-lite 636 endif 637endif 638endif # $(proto_sources) non-empty 639 640########################################################### 641## Compile the .dbus-xml files to c++ headers 642########################################################### 643dbus_definitions := $(filter %.dbus-xml,$(my_src_files)) 644dbus_generated_headers := 645ifneq ($(dbus_definitions),) 646 647dbus_definition_paths := $(addprefix $(LOCAL_PATH)/,$(dbus_definitions)) 648dbus_service_config := $(filter %dbus-service-config.json,$(my_src_files)) 649dbus_service_config_path := $(addprefix $(LOCAL_PATH)/,$(dbus_service_config)) 650 651dbus_gen_dir := $(generated_sources_dir)/dbus_bindings 652 653ifdef LOCAL_DBUS_PROXY_PREFIX 654dbus_header_dir := $(dbus_gen_dir)/include/$(LOCAL_DBUS_PROXY_PREFIX) 655dbus_headers := dbus-proxies.h 656else 657dbus_header_dir := $(dbus_gen_dir) 658dbus_headers := $(patsubst %.dbus-xml,%.h,$(dbus_definitions)) 659endif 660dbus_generated_headers := $(addprefix $(dbus_header_dir)/,$(dbus_headers)) 661 662# Ensure that we only define build rules once in multilib builds. 663ifndef $(my_prefix)_$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_dbus_bindings_defined 664$(my_prefix)_$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_dbus_bindings_defined := true 665 666$(dbus_generated_headers): PRIVATE_MODULE := $(LOCAL_MODULE) 667$(dbus_generated_headers): PRIVATE_DBUS_SERVICE_CONFIG := $(dbus_service_config_path) 668$(dbus_generated_headers) : $(dbus_service_config_path) $(DBUS_GENERATOR) 669ifdef LOCAL_DBUS_PROXY_PREFIX 670$(dbus_generated_headers) : $(dbus_definition_paths) 671 $(generate-dbus-proxies) 672 673# Auto-export the generated dbus proxy directory. 674my_export_c_include_dirs += $(dbus_gen_dir)/include 675my_c_includes += $(dbus_gen_dir)/include 676else 677$(dbus_generated_headers) : $(dbus_header_dir)/%.h : $(LOCAL_PATH)/%.dbus-xml 678 $(generate-dbus-adaptors) 679 680my_export_c_include_dirs += $(dbus_header_dir) 681my_c_includes += $(dbus_header_dir) 682endif # $(LOCAL_DBUS_PROXY_PREFIX) 683endif # $(my_prefix)_$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_dbus_bindings_defined 684 685my_generated_sources += $(dbus_generated_headers) 686 687endif # $(dbus_definitions) non-empty 688 689 690########################################################### 691## YACC: Compile .y and .yy files to .cpp and the to .o. 692########################################################### 693 694y_yacc_sources := $(filter %.y,$(my_src_files)) 695y_yacc_cpps := $(addprefix \ 696 $(intermediates)/,$(y_yacc_sources:.y=$(LOCAL_CPP_EXTENSION))) 697 698yy_yacc_sources := $(filter %.yy,$(my_src_files)) 699yy_yacc_cpps := $(addprefix \ 700 $(intermediates)/,$(yy_yacc_sources:.yy=$(LOCAL_CPP_EXTENSION))) 701 702yacc_cpps := $(y_yacc_cpps) $(yy_yacc_cpps) 703yacc_headers := $(yacc_cpps:$(LOCAL_CPP_EXTENSION)=.h) 704yacc_objects := $(yacc_cpps:$(LOCAL_CPP_EXTENSION)=.o) 705 706ifneq ($(strip $(y_yacc_cpps)),) 707$(y_yacc_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \ 708 $(TOPDIR)$(LOCAL_PATH)/%.y \ 709 $(lex_cpps) $(my_additional_dependencies) 710 $(call transform-y-to-cpp,$(PRIVATE_CPP_EXTENSION)) 711$(yacc_headers): $(intermediates)/%.h: $(intermediates)/%$(LOCAL_CPP_EXTENSION) 712endif 713 714ifneq ($(strip $(yy_yacc_cpps)),) 715$(yy_yacc_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \ 716 $(TOPDIR)$(LOCAL_PATH)/%.yy \ 717 $(lex_cpps) $(my_additional_dependencies) 718 $(call transform-y-to-cpp,$(PRIVATE_CPP_EXTENSION)) 719$(yacc_headers): $(intermediates)/%.h: $(intermediates)/%$(LOCAL_CPP_EXTENSION) 720endif 721 722ifneq ($(strip $(yacc_cpps)),) 723$(yacc_objects): PRIVATE_ARM_MODE := $(normal_objects_mode) 724$(yacc_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags) 725$(yacc_objects): $(intermediates)/%.o: $(intermediates)/%$(LOCAL_CPP_EXTENSION) 726 $(transform-$(PRIVATE_HOST)cpp-to-o) 727endif 728 729########################################################### 730## LEX: Compile .l and .ll files to .cpp and then to .o. 731########################################################### 732 733l_lex_sources := $(filter %.l,$(my_src_files)) 734l_lex_cpps := $(addprefix \ 735 $(intermediates)/,$(l_lex_sources:.l=$(LOCAL_CPP_EXTENSION))) 736 737ll_lex_sources := $(filter %.ll,$(my_src_files)) 738ll_lex_cpps := $(addprefix \ 739 $(intermediates)/,$(ll_lex_sources:.ll=$(LOCAL_CPP_EXTENSION))) 740 741lex_cpps := $(l_lex_cpps) $(ll_lex_cpps) 742lex_objects := $(lex_cpps:$(LOCAL_CPP_EXTENSION)=.o) 743 744ifneq ($(strip $(l_lex_cpps)),) 745$(l_lex_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \ 746 $(TOPDIR)$(LOCAL_PATH)/%.l 747 $(transform-l-to-cpp) 748endif 749 750ifneq ($(strip $(ll_lex_cpps)),) 751$(ll_lex_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \ 752 $(TOPDIR)$(LOCAL_PATH)/%.ll 753 $(transform-l-to-cpp) 754endif 755 756ifneq ($(strip $(lex_cpps)),) 757$(lex_objects): PRIVATE_ARM_MODE := $(normal_objects_mode) 758$(lex_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags) 759$(lex_objects): $(intermediates)/%.o: \ 760 $(intermediates)/%$(LOCAL_CPP_EXTENSION) \ 761 $(my_additional_dependencies) \ 762 $(yacc_headers) 763 $(transform-$(PRIVATE_HOST)cpp-to-o) 764endif 765 766########################################################### 767## C++: Compile .cpp files to .o. 768########################################################### 769 770# we also do this on host modules, even though 771# it's not really arm, because there are files that are shared. 772cpp_arm_sources := $(patsubst %$(LOCAL_CPP_EXTENSION).arm,%$(LOCAL_CPP_EXTENSION),$(filter %$(LOCAL_CPP_EXTENSION).arm,$(my_src_files))) 773dotdot_arm_sources := $(filter ../%,$(cpp_arm_sources)) 774cpp_arm_sources := $(filter-out ../%,$(cpp_arm_sources)) 775cpp_arm_objects := $(addprefix $(intermediates)/,$(cpp_arm_sources:$(LOCAL_CPP_EXTENSION)=.o)) 776 777# For source files starting with ../, we remove all the ../ in the object file path, 778# to avoid object file escaping the intermediate directory. 779dotdot_arm_objects := 780$(foreach s,$(dotdot_arm_sources),\ 781 $(eval $(call compile-dotdot-cpp-file,$(s),\ 782 $(yacc_cpps) $(proto_generated_headers) $(my_additional_dependencies),\ 783 dotdot_arm_objects))) 784 785dotdot_sources := $(filter ../%$(LOCAL_CPP_EXTENSION),$(my_src_files)) 786dotdot_objects := 787$(foreach s,$(dotdot_sources),\ 788 $(eval $(call compile-dotdot-cpp-file,$(s),\ 789 $(yacc_cpps) $(proto_generated_headers) $(my_additional_dependencies),\ 790 dotdot_objects))) 791 792cpp_normal_sources := $(filter-out ../%,$(filter %$(LOCAL_CPP_EXTENSION),$(my_src_files))) 793cpp_normal_objects := $(addprefix $(intermediates)/,$(cpp_normal_sources:$(LOCAL_CPP_EXTENSION)=.o)) 794 795$(dotdot_arm_objects) $(cpp_arm_objects): PRIVATE_ARM_MODE := $(arm_objects_mode) 796$(dotdot_arm_objects) $(cpp_arm_objects): PRIVATE_ARM_CFLAGS := $(arm_objects_cflags) 797$(dotdot_objects) $(cpp_normal_objects): PRIVATE_ARM_MODE := $(normal_objects_mode) 798$(dotdot_objects) $(cpp_normal_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags) 799 800cpp_objects := $(cpp_arm_objects) $(cpp_normal_objects) 801 802ifneq ($(strip $(cpp_objects)),) 803$(cpp_objects): $(intermediates)/%.o: \ 804 $(TOPDIR)$(LOCAL_PATH)/%$(LOCAL_CPP_EXTENSION) \ 805 $(yacc_cpps) $(proto_generated_headers) \ 806 $(my_additional_dependencies) 807 $(transform-$(PRIVATE_HOST)cpp-to-o) 808-include $(cpp_objects:%.o=%.P) 809endif 810 811cpp_objects += $(dotdot_arm_objects) $(dotdot_objects) 812 813########################################################### 814## C++: Compile generated .cpp files to .o. 815########################################################### 816 817gen_cpp_sources := $(filter %$(LOCAL_CPP_EXTENSION),$(my_generated_sources)) 818gen_cpp_objects := $(gen_cpp_sources:%$(LOCAL_CPP_EXTENSION)=%.o) 819 820ifneq ($(strip $(gen_cpp_objects)),) 821# Compile all generated files as thumb. 822# TODO: support compiling certain generated files as arm. 823$(gen_cpp_objects): PRIVATE_ARM_MODE := $(normal_objects_mode) 824$(gen_cpp_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags) 825$(gen_cpp_objects): $(intermediates)/%.o: \ 826 $(intermediates)/%$(LOCAL_CPP_EXTENSION) $(yacc_cpps) \ 827 $(proto_generated_headers) \ 828 $(my_additional_dependencies) 829 $(transform-$(PRIVATE_HOST)cpp-to-o) 830-include $(gen_cpp_objects:%.o=%.P) 831endif 832 833########################################################### 834## S: Compile generated .S and .s files to .o. 835########################################################### 836 837gen_S_sources := $(filter %.S,$(my_generated_sources)) 838gen_S_objects := $(gen_S_sources:%.S=%.o) 839 840ifneq ($(strip $(gen_S_sources)),) 841$(gen_S_objects): $(intermediates)/%.o: $(intermediates)/%.S \ 842 $(my_additional_dependencies) 843 $(transform-$(PRIVATE_HOST)s-to-o) 844-include $(gen_S_objects:%.o=%.P) 845endif 846 847gen_s_sources := $(filter %.s,$(my_generated_sources)) 848gen_s_objects := $(gen_s_sources:%.s=%.o) 849 850ifneq ($(strip $(gen_s_objects)),) 851$(gen_s_objects): $(intermediates)/%.o: $(intermediates)/%.s \ 852 $(my_additional_dependencies) 853 $(transform-$(PRIVATE_HOST)s-to-o-no-deps) 854-include $(gen_s_objects:%.o=%.P) 855endif 856 857gen_asm_objects := $(gen_S_objects) $(gen_s_objects) 858 859########################################################### 860## o: Include generated .o files in output. 861########################################################### 862 863gen_o_objects := $(filter %.o,$(my_generated_sources)) 864 865########################################################### 866## C: Compile .c files to .o. 867########################################################### 868 869c_arm_sources := $(patsubst %.c.arm,%.c,$(filter %.c.arm,$(my_src_files))) 870dotdot_arm_sources := $(filter ../%,$(c_arm_sources)) 871c_arm_sources := $(filter-out ../%,$(c_arm_sources)) 872c_arm_objects := $(addprefix $(intermediates)/,$(c_arm_sources:.c=.o)) 873 874# For source files starting with ../, we remove all the ../ in the object file path, 875# to avoid object file escaping the intermediate directory. 876dotdot_arm_objects := 877$(foreach s,$(dotdot_arm_sources),\ 878 $(eval $(call compile-dotdot-c-file,$(s),\ 879 $(yacc_cpps) $(proto_generated_headers) $(my_additional_dependencies),\ 880 dotdot_arm_objects))) 881 882dotdot_sources := $(filter ../%.c, $(my_src_files)) 883dotdot_objects := 884$(foreach s, $(dotdot_sources),\ 885 $(eval $(call compile-dotdot-c-file,$(s),\ 886 $(yacc_cpps) $(proto_generated_headers) $(my_additional_dependencies),\ 887 dotdot_objects))) 888 889c_normal_sources := $(filter-out ../%,$(filter %.c,$(my_src_files))) 890c_normal_objects := $(addprefix $(intermediates)/,$(c_normal_sources:.c=.o)) 891 892$(dotdot_arm_objects) $(c_arm_objects): PRIVATE_ARM_MODE := $(arm_objects_mode) 893$(dotdot_arm_objects) $(c_arm_objects): PRIVATE_ARM_CFLAGS := $(arm_objects_cflags) 894$(dotdot_objects) $(c_normal_objects): PRIVATE_ARM_MODE := $(normal_objects_mode) 895$(dotdot_objects) $(c_normal_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags) 896 897c_objects := $(c_arm_objects) $(c_normal_objects) 898 899ifneq ($(strip $(c_objects)),) 900$(c_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.c $(yacc_cpps) $(proto_generated_headers) \ 901 $(my_additional_dependencies) 902 $(transform-$(PRIVATE_HOST)c-to-o) 903-include $(c_objects:%.o=%.P) 904endif 905 906c_objects += $(dotdot_arm_objects) $(dotdot_objects) 907 908########################################################### 909## C: Compile generated .c files to .o. 910########################################################### 911 912gen_c_sources := $(filter %.c,$(my_generated_sources)) 913gen_c_objects := $(gen_c_sources:%.c=%.o) 914 915ifneq ($(strip $(gen_c_objects)),) 916# Compile all generated files as thumb. 917# TODO: support compiling certain generated files as arm. 918$(gen_c_objects): PRIVATE_ARM_MODE := $(normal_objects_mode) 919$(gen_c_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags) 920$(gen_c_objects): $(intermediates)/%.o: $(intermediates)/%.c $(yacc_cpps) $(proto_generated_headers) \ 921 $(my_additional_dependencies) 922 $(transform-$(PRIVATE_HOST)c-to-o) 923-include $(gen_c_objects:%.o=%.P) 924endif 925 926########################################################### 927## ObjC: Compile .m files to .o 928########################################################### 929 930objc_sources := $(filter %.m,$(my_src_files)) 931objc_objects := $(addprefix $(intermediates)/,$(objc_sources:.m=.o)) 932 933ifneq ($(strip $(objc_objects)),) 934$(objc_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.m $(yacc_cpps) $(proto_generated_headers) \ 935 $(my_additional_dependencies) 936 $(transform-$(PRIVATE_HOST)m-to-o) 937-include $(objc_objects:%.o=%.P) 938endif 939 940########################################################### 941## ObjC++: Compile .mm files to .o 942########################################################### 943 944objcpp_sources := $(filter %.mm,$(my_src_files)) 945objcpp_objects := $(addprefix $(intermediates)/,$(objcpp_sources:.mm=.o)) 946 947ifneq ($(strip $(objcpp_objects)),) 948$(objcpp_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.mm $(yacc_cpps) $(proto_generated_headers) \ 949 $(my_additional_dependencies) 950 $(transform-$(PRIVATE_HOST)mm-to-o) 951-include $(objcpp_objects:%.o=%.P) 952endif 953 954########################################################### 955## AS: Compile .S files to .o. 956########################################################### 957 958asm_sources_S := $(filter %.S,$(my_src_files)) 959dotdot_sources := $(filter ../%,$(asm_sources_S)) 960asm_sources_S := $(filter-out ../%,$(asm_sources_S)) 961asm_objects_S := $(addprefix $(intermediates)/,$(asm_sources_S:.S=.o)) 962 963dotdot_objects_S := 964$(foreach s,$(dotdot_sources),\ 965 $(eval $(call compile-dotdot-s-file,$(s),\ 966 $(my_additional_dependencies),\ 967 dotdot_objects_S))) 968 969ifneq ($(strip $(asm_objects_S)),) 970$(asm_objects_S): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.S \ 971 $(my_additional_dependencies) 972 $(transform-$(PRIVATE_HOST)s-to-o) 973-include $(asm_objects_S:%.o=%.P) 974endif 975 976asm_sources_s := $(filter %.s,$(my_src_files)) 977dotdot_sources := $(filter ../%,$(asm_sources_s)) 978asm_sources_s := $(filter-out ../%,$(asm_sources_s)) 979asm_objects_s := $(addprefix $(intermediates)/,$(asm_sources_s:.s=.o)) 980 981dotdot_objects_s := 982$(foreach s,$(dotdot_sources),\ 983 $(eval $(call compile-dotdot-s-file-no-deps,$(s),\ 984 $(my_additional_dependencies),\ 985 dotdot_objects_s))) 986 987ifneq ($(strip $(asm_objects_s)),) 988$(asm_objects_s): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.s \ 989 $(my_additional_dependencies) 990 $(transform-$(PRIVATE_HOST)s-to-o-no-deps) 991endif 992 993asm_objects := $(dotdot_objects_S) $(dotdot_objects_s) $(asm_objects_S) $(asm_objects_s) 994 995 996# .asm for x86/x86_64 needs to be compiled with yasm. 997asm_sources_asm := $(filter %.asm,$(my_src_files)) 998ifneq ($(strip $(asm_sources_asm)),) 999asm_objects_asm := $(addprefix $(intermediates)/,$(asm_sources_asm:.asm=.o)) 1000$(asm_objects_asm): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.asm \ 1001 $(my_additional_dependencies) 1002 $(transform-asm-to-o) 1003 1004asm_objects += $(asm_objects_asm) 1005endif 1006 1007 1008########################################################## 1009## Set up installed module dependency 1010## We cannot compute the full path of the LOCAL_SHARED_LIBRARIES for 1011## they may cusomize their install path with LOCAL_MODULE_PATH 1012########################################################## 1013# Get the list of INSTALLED libraries as module names. 1014ifdef LOCAL_SDK_VERSION 1015 installed_shared_library_module_names := \ 1016 $(my_shared_libraries) 1017else 1018 installed_shared_library_module_names := \ 1019 $(my_shared_libraries) $(my_system_shared_libraries) 1020endif 1021 1022# The real dependency will be added after all Android.mks are loaded and the install paths 1023# of the shared libraries are determined. 1024ifdef LOCAL_INSTALLED_MODULE 1025ifdef installed_shared_library_module_names 1026$(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)DEPENDENCIES_ON_SHARED_LIBRARIES += \ 1027 $(my_register_name):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(sort $(installed_shared_library_module_names))) 1028endif 1029endif 1030 1031 1032#################################################### 1033## Import includes 1034#################################################### 1035import_includes := $(intermediates)/import_includes 1036import_includes_deps := $(strip \ 1037 $(foreach l, $(installed_shared_library_module_names), \ 1038 $(call intermediates-dir-for,SHARED_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/export_includes) \ 1039 $(foreach l, $(my_static_libraries) $(my_whole_static_libraries), \ 1040 $(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/export_includes)) 1041$(import_includes): PRIVATE_IMPORT_EXPORT_INCLUDES := $(import_includes_deps) 1042$(import_includes) : $(LOCAL_MODULE_MAKEFILE) $(import_includes_deps) 1043 @echo Import includes file: $@ 1044 $(hide) mkdir -p $(dir $@) && rm -f $@ 1045ifdef import_includes_deps 1046 $(hide) for f in $(PRIVATE_IMPORT_EXPORT_INCLUDES); do \ 1047 cat $$f >> $@; \ 1048 done 1049else 1050 $(hide) touch $@ 1051endif 1052 1053########################################################### 1054## Common object handling. 1055########################################################### 1056 1057# some rules depend on asm_objects being first. If your code depends on 1058# being first, it's reasonable to require it to be assembly 1059normal_objects := \ 1060 $(asm_objects) \ 1061 $(cpp_objects) \ 1062 $(gen_cpp_objects) \ 1063 $(gen_asm_objects) \ 1064 $(c_objects) \ 1065 $(gen_c_objects) \ 1066 $(objc_objects) \ 1067 $(objcpp_objects) \ 1068 $(yacc_objects) \ 1069 $(lex_objects) \ 1070 $(proto_generated_objects) \ 1071 $(addprefix $(TOPDIR)$(LOCAL_PATH)/,$(LOCAL_PREBUILT_OBJ_FILES)) 1072 1073all_objects := $(normal_objects) $(gen_o_objects) 1074 1075my_c_includes += $(TOPDIR)$(LOCAL_PATH) $(intermediates) $(generated_sources_dir) 1076 1077ifndef LOCAL_SDK_VERSION 1078 my_c_includes += $(JNI_H_INCLUDE) 1079endif 1080 1081# all_objects includes gen_o_objects which were part of LOCAL_GENERATED_SOURCES; 1082# use normal_objects here to avoid creating circular dependencies. This assumes 1083# that custom build rules which generate .o files don't consume other generated 1084# sources as input (or if they do they take care of that dependency themselves). 1085$(normal_objects) : | $(my_generated_sources) 1086$(all_objects) : | $(import_includes) 1087ALL_C_CPP_ETC_OBJECTS += $(all_objects) 1088 1089 1090########################################################### 1091# Standard library handling. 1092########################################################### 1093 1094########################################################### 1095# The list of libraries that this module will link against are in 1096# these variables. Each is a list of bare module names like "libc libm". 1097# 1098# LOCAL_SHARED_LIBRARIES 1099# LOCAL_STATIC_LIBRARIES 1100# LOCAL_WHOLE_STATIC_LIBRARIES 1101# 1102# We need to convert the bare names into the dependencies that 1103# we'll use for LOCAL_BUILT_MODULE and LOCAL_INSTALLED_MODULE. 1104# LOCAL_BUILT_MODULE should depend on the BUILT versions of the 1105# libraries, so that simply building this module doesn't force 1106# an install of a library. Similarly, LOCAL_INSTALLED_MODULE 1107# should depend on the INSTALLED versions of the libraries so 1108# that they get installed when this module does. 1109########################################################### 1110# NOTE: 1111# WHOLE_STATIC_LIBRARIES are libraries that are pulled into the 1112# module without leaving anything out, which is useful for turning 1113# a collection of .a files into a .so file. Linking against a 1114# normal STATIC_LIBRARY will only pull in code/symbols that are 1115# referenced by the module. (see gcc/ld's --whole-archive option) 1116########################################################### 1117 1118# Get the list of BUILT libraries, which are under 1119# various intermediates directories. 1120so_suffix := $($(my_prefix)SHLIB_SUFFIX) 1121a_suffix := $($(my_prefix)STATIC_LIB_SUFFIX) 1122 1123ifdef LOCAL_SDK_VERSION 1124built_shared_libraries := \ 1125 $(addprefix $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \ 1126 $(addsuffix $(so_suffix), \ 1127 $(my_shared_libraries))) 1128 1129# Add the NDK libraries to the built module dependency 1130my_system_shared_libraries_fullpath := \ 1131 $(my_ndk_stl_shared_lib_fullpath) \ 1132 $(addprefix $(my_ndk_sysroot_lib)/, \ 1133 $(addsuffix $(so_suffix), $(my_system_shared_libraries))) 1134 1135built_shared_libraries += $(my_system_shared_libraries_fullpath) 1136else 1137built_shared_libraries := \ 1138 $(addprefix $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \ 1139 $(addsuffix $(so_suffix), \ 1140 $(installed_shared_library_module_names))) 1141endif 1142 1143built_static_libraries := \ 1144 $(foreach lib,$(my_static_libraries), \ 1145 $(call intermediates-dir-for, \ 1146 STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/$(lib)$(a_suffix)) 1147 1148ifdef LOCAL_SDK_VERSION 1149built_static_libraries += $(my_ndk_stl_static_lib) 1150endif 1151 1152built_whole_libraries := \ 1153 $(foreach lib,$(my_whole_static_libraries), \ 1154 $(call intermediates-dir-for, \ 1155 STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/$(lib)$(a_suffix)) 1156 1157# We don't care about installed static libraries, since the 1158# libraries have already been linked into the module at that point. 1159# We do, however, care about the NOTICE files for any static 1160# libraries that we use. (see notice_files.mk) 1161 1162installed_static_library_notice_file_targets := \ 1163 $(foreach lib,$(my_static_libraries) $(my_whole_static_libraries), \ 1164 NOTICE-$(if $(LOCAL_IS_HOST_MODULE),HOST,TARGET)-STATIC_LIBRARIES-$(lib)) 1165 1166# Default is -fno-rtti. 1167ifeq ($(strip $(LOCAL_RTTI_FLAG)),) 1168LOCAL_RTTI_FLAG := -fno-rtti 1169endif 1170 1171########################################################### 1172# Rule-specific variable definitions 1173########################################################### 1174 1175ifeq ($(my_clang),true) 1176my_cflags += $(LOCAL_CLANG_CFLAGS) 1177my_conlyflags += $(LOCAL_CLANG_CONLYFLAGS) 1178my_cppflags += $(LOCAL_CLANG_CPPFLAGS) 1179my_cflags_no_override += $(GLOBAL_CLANG_CFLAGS_NO_OVERRIDE) 1180my_cppflags_no_override += $(GLOBAL_CLANG_CPPFLAGS_NO_OVERRIDE) 1181my_asflags += $(LOCAL_CLANG_ASFLAGS) 1182my_ldflags += $(LOCAL_CLANG_LDFLAGS) 1183my_cflags += $(LOCAL_CLANG_CFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CLANG_CFLAGS_$(my_32_64_bit_suffix)) 1184my_conlyflags += $(LOCAL_CLANG_CONLYFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CLANG_CONLYFLAGS_$(my_32_64_bit_suffix)) 1185my_cppflags += $(LOCAL_CLANG_CPPFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CLANG_CPPFLAGS_$(my_32_64_bit_suffix)) 1186my_ldflags += $(LOCAL_CLANG_LDFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CLANG_LDFLAGS_$(my_32_64_bit_suffix)) 1187my_asflags += $(LOCAL_CLANG_ASFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CLANG_ASFLAGS_$(my_32_64_bit_suffix)) 1188my_cflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(my_cflags)) 1189my_cppflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(my_cppflags)) 1190my_asflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(my_asflags)) 1191my_ldflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(my_ldflags)) 1192endif 1193 1194ifeq ($(my_fdo_build), true) 1195 my_cflags := $(patsubst -Os,-O2,$(my_cflags)) 1196 fdo_incompatible_flags := -fno-early-inlining -finline-limit=% 1197 my_cflags := $(filter-out $(fdo_incompatible_flags),$(my_cflags)) 1198endif 1199 1200# No one should ever use this flag. On GCC it's mere presence will disable all 1201# warnings, even those that are specified after it (contrary to typical warning 1202# flag behavior). This circumvents CFLAGS_NO_OVERRIDE from forcibly enabling the 1203# warnings that are *always* bugs. 1204my_illegal_flags := -w 1205my_cflags := $(filter-out $(my_illegal_flags),$(my_cflags)) 1206my_cppflags := $(filter-out $(my_illegal_flags),$(my_cppflags)) 1207my_conlyflags := $(filter-out $(my_illegal_flags),$(my_conlyflags)) 1208 1209$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_YACCFLAGS := $(LOCAL_YACCFLAGS) 1210$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASFLAGS := $(my_asflags) 1211$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CONLYFLAGS := $(my_conlyflags) 1212$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CFLAGS := $(my_cflags) 1213$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CPPFLAGS := $(my_cppflags) 1214$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CFLAGS_NO_OVERRIDE := $(my_cflags_no_override) 1215$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CPPFLAGS_NO_OVERRIDE := $(my_cppflags_no_override) 1216$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RTTI_FLAG := $(LOCAL_RTTI_FLAG) 1217$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEBUG_CFLAGS := $(debug_cflags) 1218$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_C_INCLUDES := $(my_c_includes) 1219$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_IMPORT_INCLUDES := $(import_includes) 1220$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDFLAGS := $(my_ldflags) 1221$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDLIBS := $(my_ldlibs) 1222 1223# this is really the way to get the files onto the command line instead 1224# of using $^, because then LOCAL_ADDITIONAL_DEPENDENCIES doesn't work 1225$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_SHARED_LIBRARIES := $(built_shared_libraries) 1226$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_STATIC_LIBRARIES := $(built_static_libraries) 1227$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_WHOLE_STATIC_LIBRARIES := $(built_whole_libraries) 1228$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_OBJECTS := $(all_objects) 1229 1230########################################################### 1231# Define library dependencies. 1232########################################################### 1233# all_libraries is used for the dependencies on LOCAL_BUILT_MODULE. 1234all_libraries := \ 1235 $(built_shared_libraries) \ 1236 $(built_static_libraries) \ 1237 $(built_whole_libraries) 1238 1239# Also depend on the notice files for any static libraries that 1240# are linked into this module. This will force them to be installed 1241# when this module is. 1242$(LOCAL_INSTALLED_MODULE): | $(installed_static_library_notice_file_targets) 1243 1244########################################################### 1245# Export includes 1246########################################################### 1247export_includes := $(intermediates)/export_includes 1248$(export_includes): PRIVATE_EXPORT_C_INCLUDE_DIRS := $(my_export_c_include_dirs) 1249# Make sure .pb.h are already generated before any dependent source files get compiled. 1250$(export_includes) : $(LOCAL_MODULE_MAKEFILE) $(proto_generated_headers) $(dbus_generated_headers) 1251 @echo Export includes file: $< -- $@ 1252 $(hide) mkdir -p $(dir $@) && rm -f $@ 1253ifdef my_export_c_include_dirs 1254 $(hide) for d in $(PRIVATE_EXPORT_C_INCLUDE_DIRS); do \ 1255 echo "-I $$d" >> $@; \ 1256 done 1257else 1258 $(hide) touch $@ 1259endif 1260 1261# Make sure export_includes gets generated when you are running mm/mmm 1262$(LOCAL_BUILT_MODULE) : | $(export_includes) 1263