| 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 | 
|  | 3 | ## asm/c/cpp/yacc/lex source files. | 
|  | 4 | ## | 
|  | 5 | ## The list of object files is exported in $(all_objects). | 
|  | 6 | ########################################################### | 
|  | 7 |  | 
| Ying Wang | 1a08100 | 2010-07-13 14:55:47 -0700 | [diff] [blame] | 8 | my_ndk_version_root := | 
| Ying Wang | 54fdb47 | 2012-08-14 10:13:16 -0700 | [diff] [blame] | 9 | ifdef LOCAL_SDK_VERSION | 
| Ying Wang | 27d51bf | 2012-08-14 11:08:03 -0700 | [diff] [blame] | 10 | ifdef LOCAL_NDK_VERSION | 
|  | 11 | $(error $(LOCAL_PATH): LOCAL_NDK_VERSION is now retired.) | 
|  | 12 | endif | 
| Ying Wang | 1a08100 | 2010-07-13 14:55:47 -0700 | [diff] [blame] | 13 | ifdef LOCAL_IS_HOST_MODULE | 
| Ian Rogers | 76a6dc3 | 2012-10-01 16:36:23 -0700 | [diff] [blame] | 14 | $(error $(LOCAL_PATH): LOCAL_SDK_VERSION cannot be used in host module) | 
| Ying Wang | 1a08100 | 2010-07-13 14:55:47 -0700 | [diff] [blame] | 15 | endif | 
| Ying Wang | 54fdb47 | 2012-08-14 10:13:16 -0700 | [diff] [blame] | 16 | my_ndk_source_root := $(HISTORICAL_NDK_VERSIONS_ROOT)/current/sources | 
|  | 17 | my_ndk_version_root := $(HISTORICAL_NDK_VERSIONS_ROOT)/current/platforms/android-$(LOCAL_SDK_VERSION)/arch-$(TARGET_ARCH) | 
| Ying Wang | cce4c97 | 2011-03-03 18:53:53 -0800 | [diff] [blame] | 18 |  | 
|  | 19 | # Set up the NDK stl variant. Starting from NDK-r5 the c++ stl resides in a separate location. | 
|  | 20 | # See ndk/docs/CPLUSPLUS-SUPPORT.html | 
|  | 21 | my_ndk_stl_include_path := | 
|  | 22 | my_ndk_stl_shared_lib_fullpath := | 
|  | 23 | my_ndk_stl_shared_lib := | 
|  | 24 | my_ndk_stl_static_lib := | 
|  | 25 | ifeq (,$(LOCAL_NDK_STL_VARIANT)) | 
|  | 26 | LOCAL_NDK_STL_VARIANT := system | 
|  | 27 | endif | 
|  | 28 | ifneq (1,$(words $(filter system stlport_static stlport_shared gnustl_static, $(LOCAL_NDK_STL_VARIANT)))) | 
| Ying Wang | 54fdb47 | 2012-08-14 10:13:16 -0700 | [diff] [blame] | 29 | $(error $(LOCAL_PATH): Unknown LOCAL_NDK_STL_VARIANT $(LOCAL_NDK_STL_VARIANT)) | 
| Ying Wang | cce4c97 | 2011-03-03 18:53:53 -0800 | [diff] [blame] | 30 | endif | 
|  | 31 | ifeq (system,$(LOCAL_NDK_STL_VARIANT)) | 
|  | 32 | my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/system/include | 
|  | 33 | # for "system" variant, the shared library exists in the system library and -lstdc++ is added by default. | 
|  | 34 | else # LOCAL_NDK_STL_VARIANT is not system | 
|  | 35 | ifneq (,$(filter stlport_%, $(LOCAL_NDK_STL_VARIANT))) | 
|  | 36 | my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/stlport/stlport | 
|  | 37 | ifeq (stlport_static,$(LOCAL_NDK_STL_VARIANT)) | 
|  | 38 | my_ndk_stl_static_lib := $(my_ndk_source_root)/cxx-stl/stlport/libs/$(TARGET_CPU_ABI)/libstlport_static.a | 
|  | 39 | else | 
|  | 40 | my_ndk_stl_shared_lib_fullpath := $(my_ndk_source_root)/cxx-stl/stlport/libs/$(TARGET_CPU_ABI)/libstlport_shared.so | 
|  | 41 | my_ndk_stl_shared_lib := -lstlport_shared | 
|  | 42 | endif | 
|  | 43 | else | 
|  | 44 | # LOCAL_NDK_STL_VARIANT is gnustl_static | 
| Ying Wang | d9020c2 | 2011-09-07 14:31:47 -0700 | [diff] [blame] | 45 | my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/libs/$(TARGET_CPU_ABI)/include \ | 
|  | 46 | $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/include | 
| Ying Wang | 54fdb47 | 2012-08-14 10:13:16 -0700 | [diff] [blame] | 47 | my_ndk_stl_static_lib := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/libs/$(TARGET_CPU_ABI)/libgnustl_static.a | 
| Ying Wang | cce4c97 | 2011-03-03 18:53:53 -0800 | [diff] [blame] | 48 | endif | 
|  | 49 | endif | 
| Ying Wang | 1a08100 | 2010-07-13 14:55:47 -0700 | [diff] [blame] | 50 | endif | 
|  | 51 |  | 
| Ying Wang | 704c0c9 | 2011-09-15 13:50:52 -0700 | [diff] [blame] | 52 | ################################################## | 
|  | 53 | # Compute the dependency of the shared libraries | 
|  | 54 | ################################################## | 
|  | 55 | # On the target, we compile with -nostdlib, so we must add in the | 
|  | 56 | # default system shared libraries, unless they have requested not | 
|  | 57 | # to by supplying a LOCAL_SYSTEM_SHARED_LIBRARIES value.  One would | 
|  | 58 | # supply that, for example, when building libc itself. | 
|  | 59 | ifdef LOCAL_IS_HOST_MODULE | 
|  | 60 | ifeq ($(LOCAL_SYSTEM_SHARED_LIBRARIES),none) | 
|  | 61 | LOCAL_SYSTEM_SHARED_LIBRARIES := | 
|  | 62 | endif | 
|  | 63 | else | 
|  | 64 | ifeq ($(LOCAL_SYSTEM_SHARED_LIBRARIES),none) | 
|  | 65 | LOCAL_SYSTEM_SHARED_LIBRARIES := $(TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES) | 
|  | 66 | endif | 
|  | 67 | endif | 
|  | 68 |  | 
|  | 69 | # Logging used to be part of libcutils (target) and libutils (sim); | 
|  | 70 | # hack modules that use those other libs to also include liblog. | 
|  | 71 | # All of this complexity is to make sure that liblog only appears | 
|  | 72 | # once, and appears just before libcutils or libutils on the link | 
|  | 73 | # line. | 
|  | 74 | # TODO: remove this hack and change all modules to use liblog | 
|  | 75 | # when necessary. | 
|  | 76 | define insert-liblog | 
|  | 77 | $(if $(filter liblog,$(1)),$(1), \ | 
|  | 78 | $(if $(filter libcutils,$(1)), \ | 
|  | 79 | $(patsubst libcutils,liblog libcutils,$(1)) \ | 
|  | 80 | , \ | 
|  | 81 | $(patsubst libutils,liblog libutils,$(1)) \ | 
|  | 82 | ) \ | 
|  | 83 | ) | 
|  | 84 | endef | 
|  | 85 | ifneq (,$(filter libcutils libutils,$(LOCAL_SHARED_LIBRARIES))) | 
|  | 86 | LOCAL_SHARED_LIBRARIES := $(call insert-liblog,$(LOCAL_SHARED_LIBRARIES)) | 
|  | 87 | endif | 
|  | 88 | ifneq (,$(filter libcutils libutils,$(LOCAL_STATIC_LIBRARIES))) | 
|  | 89 | LOCAL_STATIC_LIBRARIES := $(call insert-liblog,$(LOCAL_STATIC_LIBRARIES)) | 
|  | 90 | endif | 
|  | 91 | ifneq (,$(filter libcutils libutils,$(LOCAL_WHOLE_STATIC_LIBRARIES))) | 
|  | 92 | LOCAL_WHOLE_STATIC_LIBRARIES := $(call insert-liblog,$(LOCAL_WHOLE_STATIC_LIBRARIES)) | 
|  | 93 | endif | 
|  | 94 |  | 
| Ying Wang | 54fdb47 | 2012-08-14 10:13:16 -0700 | [diff] [blame] | 95 | ifdef LOCAL_SDK_VERSION | 
| Ying Wang | 704c0c9 | 2011-09-15 13:50:52 -0700 | [diff] [blame] | 96 | # Get the list of INSTALLED libraries as module names. | 
| Ian Rogers | 76a6dc3 | 2012-10-01 16:36:23 -0700 | [diff] [blame] | 97 | # We cannot compute the full path of the LOCAL_SHARED_LIBRARIES for | 
| Ying Wang | 704c0c9 | 2011-09-15 13:50:52 -0700 | [diff] [blame] | 98 | # they may cusomize their install path with LOCAL_MODULE_PATH | 
|  | 99 | installed_shared_library_module_names := \ | 
|  | 100 | $(LOCAL_SHARED_LIBRARIES) | 
|  | 101 | else | 
|  | 102 | installed_shared_library_module_names := \ | 
|  | 103 | $(LOCAL_SYSTEM_SHARED_LIBRARIES) $(LOCAL_SHARED_LIBRARIES) | 
|  | 104 | endif | 
|  | 105 | # The real dependency will be added after all Android.mks are loaded and the install paths | 
|  | 106 | # of the shared libraries are determined. | 
|  | 107 | LOCAL_REQUIRED_MODULES += $(installed_shared_library_module_names) | 
|  | 108 |  | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 109 | ####################################### | 
|  | 110 | include $(BUILD_SYSTEM)/base_rules.mk | 
|  | 111 | ####################################### | 
| Evgeniy Stepanov | 6cc9c06 | 2012-03-30 12:15:12 +0400 | [diff] [blame] | 112 |  | 
|  | 113 | ifeq ($(strip $(LOCAL_ADDRESS_SANITIZER)),true) | 
|  | 114 | LOCAL_CLANG := true | 
|  | 115 | LOCAL_CFLAGS += $(ADDRESS_SANITIZER_CONFIG_EXTRA_CFLAGS) | 
|  | 116 | LOCAL_LDFLAGS += $(ADDRESS_SANITIZER_CONFIG_EXTRA_LDFLAGS) | 
|  | 117 | LOCAL_SHARED_LIBRARIES += $(ADDRESS_SANITIZER_CONFIG_EXTRA_SHARED_LIBRARIES) | 
|  | 118 | LOCAL_STATIC_LIBRARIES += $(ADDRESS_SANITIZER_CONFIG_EXTRA_STATIC_LIBRARIES) | 
|  | 119 | endif | 
|  | 120 |  | 
| Stephen Hines | bec4a4b | 2012-06-26 16:38:21 -0700 | [diff] [blame] | 121 | # Add in libcompiler-rt for all regular device builds | 
| Mike Lockwood | daf5e22 | 2012-10-18 10:17:47 -0700 | [diff] [blame] | 122 | ifeq (,$(LOCAL_SDK_VERSION)$(LOCAL_IS_HOST_MODULE)$(WITHOUT_LIBCOMPILER_RT)) | 
| Stephen Hines | c72f396 | 2012-06-11 14:53:34 -0700 | [diff] [blame] | 123 | LOCAL_STATIC_LIBRARIES += $(COMPILER_RT_CONFIG_EXTRA_STATIC_LIBRARIES) | 
|  | 124 | endif | 
|  | 125 |  | 
| Ying Wang | dfbe79b | 2012-03-22 11:26:22 -0700 | [diff] [blame] | 126 | my_compiler_dependencies := | 
| Evgeniy Stepanov | b71e2df | 2012-03-20 18:00:16 +0400 | [diff] [blame] | 127 | ifeq ($(strip $(LOCAL_CLANG)),true) | 
|  | 128 | LOCAL_CFLAGS += $(CLANG_CONFIG_EXTRA_CFLAGS) | 
|  | 129 | LOCAL_LDFLAGS += $(CLANG_CONFIG_EXTRA_LDFLAGS) | 
| Ying Wang | dfbe79b | 2012-03-22 11:26:22 -0700 | [diff] [blame] | 130 | my_compiler_dependencies := $(CLANG) $(CLANG_CXX) | 
| Evgeniy Stepanov | b71e2df | 2012-03-20 18:00:16 +0400 | [diff] [blame] | 131 | endif | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 132 |  | 
| Jing Yu | 2dcc806 | 2009-09-21 16:31:50 -0700 | [diff] [blame] | 133 | #################################################### | 
|  | 134 | ## Add FDO flags if FDO is turned on and supported | 
|  | 135 | #################################################### | 
|  | 136 | ifeq ($(strip $(LOCAL_NO_FDO_SUPPORT)),) | 
|  | 137 | LOCAL_CFLAGS += $(TARGET_FDO_CFLAGS) | 
|  | 138 | LOCAL_CPPFLAGS += $(TARGET_FDO_CFLAGS) | 
|  | 139 | LOCAL_LDFLAGS += $(TARGET_FDO_CFLAGS) | 
|  | 140 | endif | 
|  | 141 |  | 
| Kito Cheng | 70dc3e1 | 2012-06-15 15:15:50 +0800 | [diff] [blame] | 142 | #################################################### | 
|  | 143 | ## Add profiling flags if aprof is turned on | 
|  | 144 | #################################################### | 
|  | 145 | ifeq ($(strip $(LOCAL_ENABLE_APROF)),true) | 
|  | 146 | # -ffunction-sections and -fomit-frame-pointer are conflict with -pg | 
|  | 147 | LOCAL_CFLAGS += -fno-omit-frame-pointer -fno-function-sections -pg | 
|  | 148 | LOCAL_CPPFLAGS += -fno-omit-frame-pointer -fno-function-sections -pg | 
|  | 149 | endif | 
|  | 150 |  | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 151 | ########################################################### | 
| Jim Huang | 20d1ba6 | 2010-10-14 16:15:56 +0800 | [diff] [blame] | 152 | ## Explicitly declare assembly-only __ASSEMBLY__ macro for | 
|  | 153 | ## assembly source | 
|  | 154 | ########################################################### | 
|  | 155 | LOCAL_ASFLAGS += -D__ASSEMBLY__ | 
|  | 156 |  | 
|  | 157 | ########################################################### | 
| Ying Wang | 1a08100 | 2010-07-13 14:55:47 -0700 | [diff] [blame] | 158 | ## Define PRIVATE_ variables from global vars | 
|  | 159 | ########################################################### | 
| Ying Wang | 54fdb47 | 2012-08-14 10:13:16 -0700 | [diff] [blame] | 160 | ifdef LOCAL_SDK_VERSION | 
| Ying Wang | 1a08100 | 2010-07-13 14:55:47 -0700 | [diff] [blame] | 161 | my_target_project_includes := | 
| Evgeniy Stepanov | a7095e9 | 2012-03-30 12:18:52 +0400 | [diff] [blame] | 162 | my_target_c_includes := $(my_ndk_stl_include_path) $(my_ndk_version_root)/usr/include | 
| Ying Wang | da4bf42 | 2012-08-16 16:45:01 -0700 | [diff] [blame] | 163 |  | 
|  | 164 | # filter out including of AndroidConfig.h in system/core. | 
|  | 165 | TARGET_GLOBAL_CFLAGS_NO_ANDCONF ?= $(subst $(TARGET_ANDROID_CONFIG_CFLAGS),,\ | 
|  | 166 | $(TARGET_GLOBAL_CFLAGS)) | 
|  | 167 | my_target_global_cflags := $(TARGET_GLOBAL_CFLAGS_NO_ANDCONF) | 
| Ying Wang | 1a08100 | 2010-07-13 14:55:47 -0700 | [diff] [blame] | 168 | else | 
|  | 169 | my_target_project_includes := $(TARGET_PROJECT_INCLUDES) | 
| Evgeniy Stepanov | a7095e9 | 2012-03-30 12:18:52 +0400 | [diff] [blame] | 170 | my_target_c_includes := $(TARGET_C_INCLUDES) | 
| Evgeniy Stepanov | a7095e9 | 2012-03-30 12:18:52 +0400 | [diff] [blame] | 171 | ifeq ($(strip $(LOCAL_CLANG)),true) | 
| Ying Wang | da4bf42 | 2012-08-16 16:45:01 -0700 | [diff] [blame] | 172 | my_target_c_includes += $(CLANG_CONFIG_EXTRA_TARGET_C_INCLUDES) | 
|  | 173 | my_target_global_cflags := $(TARGET_GLOBAL_CLANG_FLAGS) | 
|  | 174 | else | 
|  | 175 | my_target_global_cflags := $(TARGET_GLOBAL_CFLAGS) | 
|  | 176 | endif # LOCAL_CLANG | 
|  | 177 | endif # LOCAL_SDK_VERSION | 
|  | 178 |  | 
| Ying Wang | 1a08100 | 2010-07-13 14:55:47 -0700 | [diff] [blame] | 179 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_PROJECT_INCLUDES := $(my_target_project_includes) | 
| Evgeniy Stepanov | a7095e9 | 2012-03-30 12:18:52 +0400 | [diff] [blame] | 180 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_C_INCLUDES := $(my_target_c_includes) | 
| Ying Wang | 1a08100 | 2010-07-13 14:55:47 -0700 | [diff] [blame] | 181 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CFLAGS := $(my_target_global_cflags) | 
| Ying Wang | da4bf42 | 2012-08-16 16:45:01 -0700 | [diff] [blame] | 182 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CPPFLAGS := $(TARGET_GLOBAL_CPPFLAGS) | 
| Ying Wang | 1a08100 | 2010-07-13 14:55:47 -0700 | [diff] [blame] | 183 |  | 
|  | 184 | ########################################################### | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 185 | ## Define PRIVATE_ variables used by multiple module types | 
|  | 186 | ########################################################### | 
|  | 187 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_NO_DEFAULT_COMPILER_FLAGS := \ | 
| Ying Wang | dfbe79b | 2012-03-22 11:26:22 -0700 | [diff] [blame] | 188 | $(strip $(LOCAL_NO_DEFAULT_COMPILER_FLAGS)) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 189 |  | 
|  | 190 | ifeq ($(strip $(LOCAL_CC)),) | 
| Evgeniy Stepanov | b71e2df | 2012-03-20 18:00:16 +0400 | [diff] [blame] | 191 | ifeq ($(strip $(LOCAL_CLANG)),true) | 
|  | 192 | LOCAL_CC := $(CLANG) | 
|  | 193 | else | 
|  | 194 | LOCAL_CC := $($(my_prefix)CC) | 
|  | 195 | endif | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 196 | endif | 
|  | 197 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CC := $(LOCAL_CC) | 
|  | 198 |  | 
|  | 199 | ifeq ($(strip $(LOCAL_CXX)),) | 
| Evgeniy Stepanov | b71e2df | 2012-03-20 18:00:16 +0400 | [diff] [blame] | 200 | ifeq ($(strip $(LOCAL_CLANG)),true) | 
|  | 201 | LOCAL_CXX := $(CLANG_CXX) | 
|  | 202 | else | 
|  | 203 | LOCAL_CXX := $($(my_prefix)CXX) | 
|  | 204 | endif | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 205 | endif | 
|  | 206 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CXX := $(LOCAL_CXX) | 
|  | 207 |  | 
|  | 208 | # TODO: support a mix of standard extensions so that this isn't necessary | 
|  | 209 | LOCAL_CPP_EXTENSION := $(strip $(LOCAL_CPP_EXTENSION)) | 
|  | 210 | ifeq ($(LOCAL_CPP_EXTENSION),) | 
|  | 211 | LOCAL_CPP_EXTENSION := .cpp | 
|  | 212 | endif | 
|  | 213 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CPP_EXTENSION := $(LOCAL_CPP_EXTENSION) | 
|  | 214 |  | 
|  | 215 | # Certain modules like libdl have to have symbols resolved at runtime and blow | 
|  | 216 | # up if --no-undefined is passed to the linker. | 
|  | 217 | ifeq ($(strip $(LOCAL_NO_DEFAULT_COMPILER_FLAGS)),) | 
|  | 218 | ifeq ($(strip $(LOCAL_ALLOW_UNDEFINED_SYMBOLS)),) | 
|  | 219 | LOCAL_LDFLAGS := $(LOCAL_LDFLAGS) $($(my_prefix)NO_UNDEFINED_LDFLAGS) | 
|  | 220 | endif | 
|  | 221 | endif | 
|  | 222 |  | 
| Ying Wang | fcdabd4 | 2011-04-25 14:22:41 -0700 | [diff] [blame] | 223 | ifeq (true,$(LOCAL_GROUP_STATIC_LIBRARIES)) | 
|  | 224 | $(LOCAL_BUILT_MODULE): PRIVATE_GROUP_STATIC_LIBRARIES := true | 
|  | 225 | else | 
|  | 226 | $(LOCAL_BUILT_MODULE): PRIVATE_GROUP_STATIC_LIBRARIES := | 
|  | 227 | endif | 
|  | 228 |  | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 229 | ########################################################### | 
|  | 230 | ## Define arm-vs-thumb-mode flags. | 
|  | 231 | ########################################################### | 
|  | 232 | LOCAL_ARM_MODE := $(strip $(LOCAL_ARM_MODE)) | 
| Chih-Wei Huang | 0d09e58 | 2010-07-09 10:07:52 +0800 | [diff] [blame] | 233 | ifeq ($(TARGET_ARCH),arm) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 234 | arm_objects_mode := $(if $(LOCAL_ARM_MODE),$(LOCAL_ARM_MODE),arm) | 
|  | 235 | normal_objects_mode := $(if $(LOCAL_ARM_MODE),$(LOCAL_ARM_MODE),thumb) | 
|  | 236 |  | 
| Dave Bort | 9528248 | 2009-04-23 18:44:55 -0700 | [diff] [blame] | 237 | # Read the values from something like TARGET_arm_CFLAGS or | 
|  | 238 | # TARGET_thumb_CFLAGS.  HOST_(arm|thumb)_CFLAGS values aren't | 
|  | 239 | # actually used (although they are usually empty). | 
| Evgeniy Stepanov | f50f4c5 | 2012-04-05 11:44:37 +0400 | [diff] [blame] | 240 | ifeq ($(strip $(LOCAL_CLANG)),true) | 
|  | 241 | arm_objects_cflags := $($(my_prefix)$(arm_objects_mode)_CLANG_CFLAGS) | 
|  | 242 | normal_objects_cflags := $($(my_prefix)$(normal_objects_mode)_CLANG_CFLAGS) | 
|  | 243 | else | 
| Dave Bort | 9528248 | 2009-04-23 18:44:55 -0700 | [diff] [blame] | 244 | arm_objects_cflags := $($(my_prefix)$(arm_objects_mode)_CFLAGS) | 
|  | 245 | normal_objects_cflags := $($(my_prefix)$(normal_objects_mode)_CFLAGS) | 
| Evgeniy Stepanov | f50f4c5 | 2012-04-05 11:44:37 +0400 | [diff] [blame] | 246 | endif | 
|  | 247 |  | 
| Chih-Wei Huang | 0d09e58 | 2010-07-09 10:07:52 +0800 | [diff] [blame] | 248 | else | 
|  | 249 | arm_objects_mode := | 
|  | 250 | normal_objects_mode := | 
|  | 251 | arm_objects_cflags := | 
|  | 252 | normal_objects_cflags := | 
|  | 253 | endif | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 254 |  | 
|  | 255 | ########################################################### | 
|  | 256 | ## Define per-module debugging flags.  Users can turn on | 
|  | 257 | ## debugging for a particular module by setting DEBUG_MODULE_ModuleName | 
|  | 258 | ## to a non-empty value in their environment or buildspec.mk, | 
|  | 259 | ## and setting HOST_/TARGET_CUSTOM_DEBUG_CFLAGS to the | 
|  | 260 | ## debug flags that they want to use. | 
|  | 261 | ########################################################### | 
|  | 262 | ifdef DEBUG_MODULE_$(strip $(LOCAL_MODULE)) | 
|  | 263 | debug_cflags := $($(my_prefix)CUSTOM_DEBUG_CFLAGS) | 
|  | 264 | else | 
|  | 265 | debug_cflags := | 
|  | 266 | endif | 
|  | 267 |  | 
|  | 268 | ########################################################### | 
|  | 269 | ## Stuff source generated from one-off tools | 
|  | 270 | ########################################################### | 
|  | 271 | $(LOCAL_GENERATED_SOURCES): PRIVATE_MODULE := $(LOCAL_MODULE) | 
|  | 272 |  | 
|  | 273 | ALL_GENERATED_SOURCES += $(LOCAL_GENERATED_SOURCES) | 
|  | 274 |  | 
|  | 275 |  | 
|  | 276 | ########################################################### | 
| Ying Wang | a5fc87a | 2010-11-02 18:43:16 -0700 | [diff] [blame] | 277 | ## Compile the .proto files to .cc and then to .o | 
|  | 278 | ########################################################### | 
|  | 279 | proto_sources := $(filter %.proto,$(LOCAL_SRC_FILES)) | 
|  | 280 | proto_generated_objects := | 
|  | 281 | proto_generated_headers := | 
|  | 282 | ifneq ($(proto_sources),) | 
|  | 283 | proto_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(proto_sources)) | 
|  | 284 | proto_generated_cc_sources_dir := $(intermediates)/proto | 
|  | 285 | proto_generated_cc_sources := $(addprefix $(proto_generated_cc_sources_dir)/, \ | 
| Ying Wang | dfbe79b | 2012-03-22 11:26:22 -0700 | [diff] [blame] | 286 | $(patsubst %.proto,%.pb.cc,$(proto_sources_fullpath))) | 
| Ying Wang | a5fc87a | 2010-11-02 18:43:16 -0700 | [diff] [blame] | 287 | proto_generated_objects := $(patsubst %.cc,%.o, $(proto_generated_cc_sources)) | 
|  | 288 |  | 
|  | 289 | $(proto_generated_cc_sources): PRIVATE_PROTO_INCLUDES := $(TOP) | 
|  | 290 | $(proto_generated_cc_sources): PRIVATE_PROTO_CC_OUTPUT_DIR := $(proto_generated_cc_sources_dir) | 
| Ying Wang | 33c0d95 | 2010-11-05 11:30:58 -0700 | [diff] [blame] | 291 | $(proto_generated_cc_sources): PRIVATE_PROTOC_FLAGS := $(LOCAL_PROTOC_FLAGS) | 
| Ying Wang | a5fc87a | 2010-11-02 18:43:16 -0700 | [diff] [blame] | 292 | $(proto_generated_cc_sources): $(proto_generated_cc_sources_dir)/%.pb.cc: %.proto $(PROTOC) | 
|  | 293 | $(transform-proto-to-cc) | 
|  | 294 |  | 
|  | 295 | proto_generated_headers := $(patsubst %.pb.cc,%.pb.h, $(proto_generated_cc_sources)) | 
|  | 296 | $(proto_generated_headers): $(proto_generated_cc_sources_dir)/%.pb.h: $(proto_generated_cc_sources_dir)/%.pb.cc | 
|  | 297 |  | 
| Ying Wang | 022a7b3 | 2012-06-13 11:38:10 -0700 | [diff] [blame] | 298 | $(proto_generated_objects): PRIVATE_ARM_MODE := $(normal_objects_mode) | 
|  | 299 | $(proto_generated_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags) | 
| Narayan Kamath | 2109487 | 2012-04-02 18:19:31 +0100 | [diff] [blame] | 300 | $(proto_generated_objects): $(proto_generated_cc_sources_dir)/%.o: $(proto_generated_cc_sources_dir)/%.cc $(proto_generated_headers) | 
| Ying Wang | a5fc87a | 2010-11-02 18:43:16 -0700 | [diff] [blame] | 301 | $(transform-$(PRIVATE_HOST)cpp-to-o) | 
|  | 302 | -include $(proto_generated_objects:%.o=%.P) | 
|  | 303 |  | 
|  | 304 | LOCAL_C_INCLUDES += external/protobuf/src $(proto_generated_cc_sources_dir) | 
|  | 305 | LOCAL_CFLAGS += -DGOOGLE_PROTOBUF_NO_RTTI | 
|  | 306 | ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),full) | 
|  | 307 | LOCAL_STATIC_LIBRARIES += libprotobuf-cpp-2.3.0-full | 
|  | 308 | else | 
|  | 309 | LOCAL_STATIC_LIBRARIES += libprotobuf-cpp-2.3.0-lite | 
|  | 310 | endif | 
|  | 311 | endif | 
|  | 312 |  | 
|  | 313 |  | 
|  | 314 | ########################################################### | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 315 | ## YACC: Compile .y files to .cpp and the to .o. | 
|  | 316 | ########################################################### | 
|  | 317 |  | 
|  | 318 | yacc_sources := $(filter %.y,$(LOCAL_SRC_FILES)) | 
|  | 319 | yacc_cpps := $(addprefix \ | 
| Ying Wang | dfbe79b | 2012-03-22 11:26:22 -0700 | [diff] [blame] | 320 | $(intermediates)/,$(yacc_sources:.y=$(LOCAL_CPP_EXTENSION))) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 321 | yacc_headers := $(yacc_cpps:$(LOCAL_CPP_EXTENSION)=.h) | 
|  | 322 | yacc_objects := $(yacc_cpps:$(LOCAL_CPP_EXTENSION)=.o) | 
|  | 323 |  | 
|  | 324 | ifneq ($(strip $(yacc_cpps)),) | 
|  | 325 | $(yacc_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \ | 
| Ying Wang | dfbe79b | 2012-03-22 11:26:22 -0700 | [diff] [blame] | 326 | $(TOPDIR)$(LOCAL_PATH)/%.y \ | 
|  | 327 | $(lex_cpps) $(LOCAL_ADDITIONAL_DEPENDENCIES) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 328 | $(call transform-y-to-cpp,$(PRIVATE_CPP_EXTENSION)) | 
|  | 329 | $(yacc_headers): $(intermediates)/%.h: $(intermediates)/%$(LOCAL_CPP_EXTENSION) | 
|  | 330 |  | 
|  | 331 | $(yacc_objects): PRIVATE_ARM_MODE := $(normal_objects_mode) | 
|  | 332 | $(yacc_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags) | 
|  | 333 | $(yacc_objects): $(intermediates)/%.o: $(intermediates)/%$(LOCAL_CPP_EXTENSION) | 
|  | 334 | $(transform-$(PRIVATE_HOST)cpp-to-o) | 
|  | 335 | endif | 
|  | 336 |  | 
|  | 337 | ########################################################### | 
|  | 338 | ## LEX: Compile .l files to .cpp and then to .o. | 
|  | 339 | ########################################################### | 
|  | 340 |  | 
|  | 341 | lex_sources := $(filter %.l,$(LOCAL_SRC_FILES)) | 
|  | 342 | lex_cpps := $(addprefix \ | 
| Ying Wang | dfbe79b | 2012-03-22 11:26:22 -0700 | [diff] [blame] | 343 | $(intermediates)/,$(lex_sources:.l=$(LOCAL_CPP_EXTENSION))) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 344 | lex_objects := $(lex_cpps:$(LOCAL_CPP_EXTENSION)=.o) | 
|  | 345 |  | 
|  | 346 | ifneq ($(strip $(lex_cpps)),) | 
|  | 347 | $(lex_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \ | 
| Ying Wang | dfbe79b | 2012-03-22 11:26:22 -0700 | [diff] [blame] | 348 | $(TOPDIR)$(LOCAL_PATH)/%.l | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 349 | $(transform-l-to-cpp) | 
|  | 350 |  | 
|  | 351 | $(lex_objects): PRIVATE_ARM_MODE := $(normal_objects_mode) | 
|  | 352 | $(lex_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags) | 
|  | 353 | $(lex_objects): $(intermediates)/%.o: \ | 
| Ying Wang | dfbe79b | 2012-03-22 11:26:22 -0700 | [diff] [blame] | 354 | $(intermediates)/%$(LOCAL_CPP_EXTENSION) \ | 
|  | 355 | $(LOCAL_ADDITIONAL_DEPENDENCIES) \ | 
|  | 356 | $(yacc_headers) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 357 | $(transform-$(PRIVATE_HOST)cpp-to-o) | 
|  | 358 | endif | 
|  | 359 |  | 
|  | 360 | ########################################################### | 
|  | 361 | ## C++: Compile .cpp files to .o. | 
|  | 362 | ########################################################### | 
|  | 363 |  | 
| Jeff Brown | e33ba4c | 2011-07-11 22:11:46 -0700 | [diff] [blame] | 364 | # we also do this on host modules, even though | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 365 | # it's not really arm, because there are files that are shared. | 
|  | 366 | cpp_arm_sources    := $(patsubst %$(LOCAL_CPP_EXTENSION).arm,%$(LOCAL_CPP_EXTENSION),$(filter %$(LOCAL_CPP_EXTENSION).arm,$(LOCAL_SRC_FILES))) | 
|  | 367 | cpp_arm_objects    := $(addprefix $(intermediates)/,$(cpp_arm_sources:$(LOCAL_CPP_EXTENSION)=.o)) | 
|  | 368 |  | 
|  | 369 | cpp_normal_sources := $(filter %$(LOCAL_CPP_EXTENSION),$(LOCAL_SRC_FILES)) | 
|  | 370 | cpp_normal_objects := $(addprefix $(intermediates)/,$(cpp_normal_sources:$(LOCAL_CPP_EXTENSION)=.o)) | 
|  | 371 |  | 
|  | 372 | $(cpp_arm_objects):    PRIVATE_ARM_MODE := $(arm_objects_mode) | 
|  | 373 | $(cpp_arm_objects):    PRIVATE_ARM_CFLAGS := $(arm_objects_cflags) | 
|  | 374 | $(cpp_normal_objects): PRIVATE_ARM_MODE := $(normal_objects_mode) | 
|  | 375 | $(cpp_normal_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags) | 
|  | 376 |  | 
|  | 377 | cpp_objects        := $(cpp_arm_objects) $(cpp_normal_objects) | 
|  | 378 |  | 
|  | 379 | ifneq ($(strip $(cpp_objects)),) | 
|  | 380 | $(cpp_objects): $(intermediates)/%.o: \ | 
| Ying Wang | dfbe79b | 2012-03-22 11:26:22 -0700 | [diff] [blame] | 381 | $(TOPDIR)$(LOCAL_PATH)/%$(LOCAL_CPP_EXTENSION) \ | 
|  | 382 | $(yacc_cpps) $(proto_generated_headers) $(my_compiler_dependencies) \ | 
| Evgeniy Stepanov | b71e2df | 2012-03-20 18:00:16 +0400 | [diff] [blame] | 383 | $(LOCAL_ADDITIONAL_DEPENDENCIES) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 384 | $(transform-$(PRIVATE_HOST)cpp-to-o) | 
|  | 385 | -include $(cpp_objects:%.o=%.P) | 
|  | 386 | endif | 
|  | 387 |  | 
|  | 388 | ########################################################### | 
|  | 389 | ## C++: Compile generated .cpp files to .o. | 
|  | 390 | ########################################################### | 
|  | 391 |  | 
|  | 392 | gen_cpp_sources := $(filter %$(LOCAL_CPP_EXTENSION),$(LOCAL_GENERATED_SOURCES)) | 
|  | 393 | gen_cpp_objects := $(gen_cpp_sources:%$(LOCAL_CPP_EXTENSION)=%.o) | 
|  | 394 |  | 
|  | 395 | ifneq ($(strip $(gen_cpp_objects)),) | 
|  | 396 | # Compile all generated files as thumb. | 
|  | 397 | # TODO: support compiling certain generated files as arm. | 
|  | 398 | $(gen_cpp_objects): PRIVATE_ARM_MODE := $(normal_objects_mode) | 
|  | 399 | $(gen_cpp_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags) | 
| Evgeniy Stepanov | b71e2df | 2012-03-20 18:00:16 +0400 | [diff] [blame] | 400 | $(gen_cpp_objects): $(intermediates)/%.o: \ | 
|  | 401 | $(intermediates)/%$(LOCAL_CPP_EXTENSION) $(yacc_cpps) \ | 
| Ying Wang | dfbe79b | 2012-03-22 11:26:22 -0700 | [diff] [blame] | 402 | $(proto_generated_headers)  $(my_compiler_dependencies) \ | 
| Evgeniy Stepanov | b71e2df | 2012-03-20 18:00:16 +0400 | [diff] [blame] | 403 | $(LOCAL_ADDITIONAL_DEPENDENCIES) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 404 | $(transform-$(PRIVATE_HOST)cpp-to-o) | 
|  | 405 | -include $(gen_cpp_objects:%.o=%.P) | 
|  | 406 | endif | 
|  | 407 |  | 
|  | 408 | ########################################################### | 
|  | 409 | ## S: Compile generated .S and .s files to .o. | 
|  | 410 | ########################################################### | 
|  | 411 |  | 
|  | 412 | gen_S_sources := $(filter %.S,$(LOCAL_GENERATED_SOURCES)) | 
|  | 413 | gen_S_objects := $(gen_S_sources:%.S=%.o) | 
|  | 414 |  | 
|  | 415 | ifneq ($(strip $(gen_S_sources)),) | 
| Evgeniy Stepanov | b71e2df | 2012-03-20 18:00:16 +0400 | [diff] [blame] | 416 | $(gen_S_objects): $(intermediates)/%.o: $(intermediates)/%.S \ | 
| Ying Wang | dfbe79b | 2012-03-22 11:26:22 -0700 | [diff] [blame] | 417 | $(my_compiler_dependencies) $(LOCAL_ADDITIONAL_DEPENDENCIES) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 418 | $(transform-$(PRIVATE_HOST)s-to-o) | 
|  | 419 | -include $(gen_S_objects:%.o=%.P) | 
|  | 420 | endif | 
|  | 421 |  | 
|  | 422 | gen_s_sources := $(filter %.s,$(LOCAL_GENERATED_SOURCES)) | 
|  | 423 | gen_s_objects := $(gen_s_sources:%.s=%.o) | 
|  | 424 |  | 
|  | 425 | ifneq ($(strip $(gen_s_objects)),) | 
| Evgeniy Stepanov | b71e2df | 2012-03-20 18:00:16 +0400 | [diff] [blame] | 426 | $(gen_s_objects): $(intermediates)/%.o: $(intermediates)/%.s \ | 
| Ying Wang | dfbe79b | 2012-03-22 11:26:22 -0700 | [diff] [blame] | 427 | $(my_compiler_dependencies) $(LOCAL_ADDITIONAL_DEPENDENCIES) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 428 | $(transform-$(PRIVATE_HOST)s-to-o-no-deps) | 
|  | 429 | -include $(gen_s_objects:%.o=%.P) | 
|  | 430 | endif | 
|  | 431 |  | 
|  | 432 | gen_asm_objects := $(gen_S_objects) $(gen_s_objects) | 
|  | 433 |  | 
|  | 434 | ########################################################### | 
|  | 435 | ## C: Compile .c files to .o. | 
|  | 436 | ########################################################### | 
|  | 437 |  | 
|  | 438 | c_arm_sources    := $(patsubst %.c.arm,%.c,$(filter %.c.arm,$(LOCAL_SRC_FILES))) | 
|  | 439 | c_arm_objects    := $(addprefix $(intermediates)/,$(c_arm_sources:.c=.o)) | 
|  | 440 |  | 
|  | 441 | c_normal_sources := $(filter %.c,$(LOCAL_SRC_FILES)) | 
|  | 442 | c_normal_objects := $(addprefix $(intermediates)/,$(c_normal_sources:.c=.o)) | 
|  | 443 |  | 
|  | 444 | $(c_arm_objects):    PRIVATE_ARM_MODE := $(arm_objects_mode) | 
|  | 445 | $(c_arm_objects):    PRIVATE_ARM_CFLAGS := $(arm_objects_cflags) | 
|  | 446 | $(c_normal_objects): PRIVATE_ARM_MODE := $(normal_objects_mode) | 
|  | 447 | $(c_normal_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags) | 
|  | 448 |  | 
|  | 449 | c_objects        := $(c_arm_objects) $(c_normal_objects) | 
|  | 450 |  | 
|  | 451 | ifneq ($(strip $(c_objects)),) | 
| Evgeniy Stepanov | b71e2df | 2012-03-20 18:00:16 +0400 | [diff] [blame] | 452 | $(c_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.c $(yacc_cpps) $(proto_generated_headers) \ | 
| Ying Wang | dfbe79b | 2012-03-22 11:26:22 -0700 | [diff] [blame] | 453 | $(my_compiler_dependencies) $(LOCAL_ADDITIONAL_DEPENDENCIES) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 454 | $(transform-$(PRIVATE_HOST)c-to-o) | 
|  | 455 | -include $(c_objects:%.o=%.P) | 
|  | 456 | endif | 
|  | 457 |  | 
|  | 458 | ########################################################### | 
| Jack Palevich | e7b3e2c | 2009-05-04 14:32:44 -0700 | [diff] [blame] | 459 | ## C: Compile generated .c files to .o. | 
|  | 460 | ########################################################### | 
|  | 461 |  | 
|  | 462 | gen_c_sources := $(filter %.c,$(LOCAL_GENERATED_SOURCES)) | 
|  | 463 | gen_c_objects := $(gen_c_sources:%.c=%.o) | 
|  | 464 |  | 
|  | 465 | ifneq ($(strip $(gen_c_objects)),) | 
|  | 466 | # Compile all generated files as thumb. | 
|  | 467 | # TODO: support compiling certain generated files as arm. | 
|  | 468 | $(gen_c_objects): PRIVATE_ARM_MODE := $(normal_objects_mode) | 
|  | 469 | $(gen_c_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags) | 
| Evgeniy Stepanov | b71e2df | 2012-03-20 18:00:16 +0400 | [diff] [blame] | 470 | $(gen_c_objects): $(intermediates)/%.o: $(intermediates)/%.c $(yacc_cpps) $(proto_generated_headers) \ | 
| Ying Wang | dfbe79b | 2012-03-22 11:26:22 -0700 | [diff] [blame] | 471 | $(my_compiler_dependencies) $(LOCAL_ADDITIONAL_DEPENDENCIES) | 
| Jack Palevich | e7b3e2c | 2009-05-04 14:32:44 -0700 | [diff] [blame] | 472 | $(transform-$(PRIVATE_HOST)c-to-o) | 
|  | 473 | -include $(gen_c_objects:%.o=%.P) | 
|  | 474 | endif | 
|  | 475 |  | 
|  | 476 | ########################################################### | 
| David 'Digit' Turner | 5dbb529 | 2009-05-14 16:00:09 +0200 | [diff] [blame] | 477 | ## ObjC: Compile .m files to .o | 
|  | 478 | ########################################################### | 
|  | 479 |  | 
|  | 480 | objc_sources := $(filter %.m,$(LOCAL_SRC_FILES)) | 
|  | 481 | objc_objects := $(addprefix $(intermediates)/,$(objc_sources:.m=.o)) | 
|  | 482 |  | 
|  | 483 | ifneq ($(strip $(objc_objects)),) | 
| Evgeniy Stepanov | b71e2df | 2012-03-20 18:00:16 +0400 | [diff] [blame] | 484 | $(objc_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.m $(yacc_cpps) $(proto_generated_headers) \ | 
| Ying Wang | dfbe79b | 2012-03-22 11:26:22 -0700 | [diff] [blame] | 485 | $(my_compiler_dependencies) $(LOCAL_ADDITIONAL_DEPENDENCIES) | 
| David 'Digit' Turner | 5dbb529 | 2009-05-14 16:00:09 +0200 | [diff] [blame] | 486 | $(transform-$(PRIVATE_HOST)m-to-o) | 
|  | 487 | -include $(objc_objects:%.o=%.P) | 
|  | 488 | endif | 
|  | 489 |  | 
|  | 490 | ########################################################### | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 491 | ## AS: Compile .S files to .o. | 
|  | 492 | ########################################################### | 
|  | 493 |  | 
|  | 494 | asm_sources_S := $(filter %.S,$(LOCAL_SRC_FILES)) | 
|  | 495 | asm_objects_S := $(addprefix $(intermediates)/,$(asm_sources_S:.S=.o)) | 
|  | 496 |  | 
|  | 497 | ifneq ($(strip $(asm_objects_S)),) | 
| Evgeniy Stepanov | b71e2df | 2012-03-20 18:00:16 +0400 | [diff] [blame] | 498 | $(asm_objects_S): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.S \ | 
| Ying Wang | dfbe79b | 2012-03-22 11:26:22 -0700 | [diff] [blame] | 499 | $(my_compiler_dependencies) $(LOCAL_ADDITIONAL_DEPENDENCIES) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 500 | $(transform-$(PRIVATE_HOST)s-to-o) | 
|  | 501 | -include $(asm_objects_S:%.o=%.P) | 
|  | 502 | endif | 
|  | 503 |  | 
|  | 504 | asm_sources_s := $(filter %.s,$(LOCAL_SRC_FILES)) | 
|  | 505 | asm_objects_s := $(addprefix $(intermediates)/,$(asm_sources_s:.s=.o)) | 
|  | 506 |  | 
|  | 507 | ifneq ($(strip $(asm_objects_s)),) | 
| Evgeniy Stepanov | b71e2df | 2012-03-20 18:00:16 +0400 | [diff] [blame] | 508 | $(asm_objects_s): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.s \ | 
| Ying Wang | dfbe79b | 2012-03-22 11:26:22 -0700 | [diff] [blame] | 509 | $(my_compiler_dependencies) $(LOCAL_ADDITIONAL_DEPENDENCIES) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 510 | $(transform-$(PRIVATE_HOST)s-to-o-no-deps) | 
|  | 511 | -include $(asm_objects_s:%.o=%.P) | 
|  | 512 | endif | 
|  | 513 |  | 
|  | 514 | asm_objects := $(asm_objects_S) $(asm_objects_s) | 
|  | 515 |  | 
|  | 516 |  | 
| Ying Wang | 5f07480 | 2011-11-08 09:31:21 -0800 | [diff] [blame] | 517 | #################################################### | 
|  | 518 | ## Import includes | 
|  | 519 | #################################################### | 
|  | 520 | import_includes := $(intermediates)/import_includes | 
|  | 521 | import_includes_deps := $(strip \ | 
|  | 522 | $(foreach l, $(installed_shared_library_module_names), \ | 
|  | 523 | $(call intermediates-dir-for,SHARED_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE))/export_includes) \ | 
|  | 524 | $(foreach l, $(LOCAL_STATIC_LIBRARIES) $(LOCAL_WHOLE_STATIC_LIBRARIES), \ | 
|  | 525 | $(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE))/export_includes)) | 
|  | 526 | $(import_includes) : $(import_includes_deps) | 
|  | 527 | @echo Import includes file: $@ | 
|  | 528 | $(hide) mkdir -p $(dir $@) && rm -f $@ | 
|  | 529 | ifdef import_includes_deps | 
|  | 530 | $(hide) for f in $^; do \ | 
|  | 531 | cat $$f >> $@; \ | 
|  | 532 | done | 
|  | 533 | else | 
|  | 534 | $(hide) touch $@ | 
|  | 535 | endif | 
|  | 536 |  | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 537 | ########################################################### | 
|  | 538 | ## Common object handling. | 
|  | 539 | ########################################################### | 
|  | 540 |  | 
|  | 541 | # some rules depend on asm_objects being first.  If your code depends on | 
|  | 542 | # being first, it's reasonable to require it to be assembly | 
|  | 543 | all_objects := \ | 
| Ying Wang | dfbe79b | 2012-03-22 11:26:22 -0700 | [diff] [blame] | 544 | $(asm_objects) \ | 
|  | 545 | $(cpp_objects) \ | 
|  | 546 | $(gen_cpp_objects) \ | 
|  | 547 | $(gen_asm_objects) \ | 
|  | 548 | $(c_objects) \ | 
|  | 549 | $(gen_c_objects) \ | 
|  | 550 | $(objc_objects) \ | 
|  | 551 | $(yacc_objects) \ | 
|  | 552 | $(lex_objects) \ | 
|  | 553 | $(proto_generated_objects) \ | 
|  | 554 | $(addprefix $(TOPDIR)$(LOCAL_PATH)/,$(LOCAL_PREBUILT_OBJ_FILES)) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 555 |  | 
| Colin Cross | 9ad36ef | 2012-03-30 19:31:00 -0700 | [diff] [blame] | 556 | LOCAL_C_INCLUDES += $(TOPDIR)$(LOCAL_PATH) $(intermediates) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 557 |  | 
| Ying Wang | 54fdb47 | 2012-08-14 10:13:16 -0700 | [diff] [blame] | 558 | ifndef LOCAL_SDK_VERSION | 
| Ying Wang | bce4b75 | 2010-07-22 15:51:56 -0700 | [diff] [blame] | 559 | LOCAL_C_INCLUDES += $(JNI_H_INCLUDE) | 
|  | 560 | endif | 
|  | 561 |  | 
| Ying Wang | 5f07480 | 2011-11-08 09:31:21 -0800 | [diff] [blame] | 562 | $(all_objects) : | $(LOCAL_GENERATED_SOURCES) $(import_includes) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 563 | ALL_C_CPP_ETC_OBJECTS += $(all_objects) | 
|  | 564 |  | 
|  | 565 | ########################################################### | 
|  | 566 | ## Copy headers to the install tree | 
|  | 567 | ########################################################### | 
|  | 568 | include $(BUILD_COPY_HEADERS) | 
|  | 569 |  | 
|  | 570 | ########################################################### | 
|  | 571 | # Standard library handling. | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 572 | ########################################################### | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 573 |  | 
|  | 574 | ########################################################### | 
|  | 575 | # The list of libraries that this module will link against are in | 
|  | 576 | # these variables.  Each is a list of bare module names like "libc libm". | 
|  | 577 | # | 
|  | 578 | # LOCAL_SHARED_LIBRARIES | 
|  | 579 | # LOCAL_STATIC_LIBRARIES | 
|  | 580 | # LOCAL_WHOLE_STATIC_LIBRARIES | 
|  | 581 | # | 
|  | 582 | # We need to convert the bare names into the dependencies that | 
|  | 583 | # we'll use for LOCAL_BUILT_MODULE and LOCAL_INSTALLED_MODULE. | 
|  | 584 | # LOCAL_BUILT_MODULE should depend on the BUILT versions of the | 
|  | 585 | # libraries, so that simply building this module doesn't force | 
|  | 586 | # an install of a library.  Similarly, LOCAL_INSTALLED_MODULE | 
|  | 587 | # should depend on the INSTALLED versions of the libraries so | 
|  | 588 | # that they get installed when this module does. | 
|  | 589 | ########################################################### | 
|  | 590 | # NOTE: | 
|  | 591 | # WHOLE_STATIC_LIBRARIES are libraries that are pulled into the | 
|  | 592 | # module without leaving anything out, which is useful for turning | 
|  | 593 | # a collection of .a files into a .so file.  Linking against a | 
|  | 594 | # normal STATIC_LIBRARY will only pull in code/symbols that are | 
|  | 595 | # referenced by the module. (see gcc/ld's --whole-archive option) | 
|  | 596 | ########################################################### | 
|  | 597 |  | 
|  | 598 | # Get the list of BUILT libraries, which are under | 
|  | 599 | # various intermediates directories. | 
|  | 600 | so_suffix := $($(my_prefix)SHLIB_SUFFIX) | 
|  | 601 | a_suffix := $($(my_prefix)STATIC_LIB_SUFFIX) | 
|  | 602 |  | 
| Ying Wang | 54fdb47 | 2012-08-14 10:13:16 -0700 | [diff] [blame] | 603 | ifdef LOCAL_SDK_VERSION | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 604 | built_shared_libraries := \ | 
|  | 605 | $(addprefix $($(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \ | 
|  | 606 | $(addsuffix $(so_suffix), \ | 
|  | 607 | $(LOCAL_SHARED_LIBRARIES))) | 
|  | 608 |  | 
| Ying Wang | cce4c97 | 2011-03-03 18:53:53 -0800 | [diff] [blame] | 609 | my_system_shared_libraries_fullpath := \ | 
|  | 610 | $(my_ndk_stl_shared_lib_fullpath) \ | 
|  | 611 | $(addprefix $(my_ndk_version_root)/usr/lib/, \ | 
|  | 612 | $(addsuffix $(so_suffix), $(LOCAL_SYSTEM_SHARED_LIBRARIES))) | 
| Ying Wang | 1a08100 | 2010-07-13 14:55:47 -0700 | [diff] [blame] | 613 |  | 
|  | 614 | built_shared_libraries += $(my_system_shared_libraries_fullpath) | 
|  | 615 | LOCAL_SHARED_LIBRARIES += $(LOCAL_SYSTEM_SHARED_LIBRARIES) | 
|  | 616 | else | 
|  | 617 | LOCAL_SHARED_LIBRARIES += $(LOCAL_SYSTEM_SHARED_LIBRARIES) | 
|  | 618 | built_shared_libraries := \ | 
|  | 619 | $(addprefix $($(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \ | 
|  | 620 | $(addsuffix $(so_suffix), \ | 
|  | 621 | $(LOCAL_SHARED_LIBRARIES))) | 
| Ying Wang | 1a08100 | 2010-07-13 14:55:47 -0700 | [diff] [blame] | 622 | endif | 
|  | 623 |  | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 624 | built_static_libraries := \ | 
|  | 625 | $(foreach lib,$(LOCAL_STATIC_LIBRARIES), \ | 
|  | 626 | $(call intermediates-dir-for, \ | 
|  | 627 | STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE))/$(lib)$(a_suffix)) | 
|  | 628 |  | 
| Ying Wang | 54fdb47 | 2012-08-14 10:13:16 -0700 | [diff] [blame] | 629 | ifdef LOCAL_SDK_VERSION | 
| Ying Wang | cce4c97 | 2011-03-03 18:53:53 -0800 | [diff] [blame] | 630 | built_static_libraries += $(my_ndk_stl_static_lib) | 
|  | 631 | endif | 
|  | 632 |  | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 633 | built_whole_libraries := \ | 
|  | 634 | $(foreach lib,$(LOCAL_WHOLE_STATIC_LIBRARIES), \ | 
|  | 635 | $(call intermediates-dir-for, \ | 
|  | 636 | STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE))/$(lib)$(a_suffix)) | 
|  | 637 |  | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 638 | # We don't care about installed static libraries, since the | 
|  | 639 | # libraries have already been linked into the module at that point. | 
|  | 640 | # We do, however, care about the NOTICE files for any static | 
| Steve Block | d14d3b4 | 2012-03-01 11:34:41 +0000 | [diff] [blame] | 641 | # libraries that we use. (see notice_files.mk) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 642 |  | 
|  | 643 | installed_static_library_notice_file_targets := \ | 
|  | 644 | $(foreach lib,$(LOCAL_STATIC_LIBRARIES) $(LOCAL_WHOLE_STATIC_LIBRARIES), \ | 
|  | 645 | NOTICE-$(if $(LOCAL_IS_HOST_MODULE),HOST,TARGET)-STATIC_LIBRARIES-$(lib)) | 
|  | 646 |  | 
| Doug Kwan | 9a8ecf9 | 2011-05-10 21:50:58 -0700 | [diff] [blame] | 647 | # Default is -fno-rtti. | 
| Doug Kwan | e3c3c6d | 2011-06-07 10:55:48 -0700 | [diff] [blame] | 648 | ifeq ($(strip $(LOCAL_RTTI_FLAG)),) | 
|  | 649 | LOCAL_RTTI_FLAG := -fno-rtti | 
|  | 650 | endif | 
| Doug Kwan | 9a8ecf9 | 2011-05-10 21:50:58 -0700 | [diff] [blame] | 651 |  | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 652 | ########################################################### | 
|  | 653 | # Rule-specific variable definitions | 
|  | 654 | ########################################################### | 
|  | 655 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_YACCFLAGS := $(LOCAL_YACCFLAGS) | 
|  | 656 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASFLAGS := $(LOCAL_ASFLAGS) | 
|  | 657 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CFLAGS := $(LOCAL_CFLAGS) | 
|  | 658 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CPPFLAGS := $(LOCAL_CPPFLAGS) | 
| Doug Kwan | 9a8ecf9 | 2011-05-10 21:50:58 -0700 | [diff] [blame] | 659 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RTTI_FLAG := $(LOCAL_RTTI_FLAG) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 660 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEBUG_CFLAGS := $(debug_cflags) | 
|  | 661 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_C_INCLUDES := $(LOCAL_C_INCLUDES) | 
| Ying Wang | 5f07480 | 2011-11-08 09:31:21 -0800 | [diff] [blame] | 662 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_IMPORT_INCLUDES := $(import_includes) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 663 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDFLAGS := $(LOCAL_LDFLAGS) | 
|  | 664 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDLIBS := $(LOCAL_LDLIBS) | 
| Jeff Brown | 703e7c6 | 2011-02-04 20:15:00 -0800 | [diff] [blame] | 665 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_NO_CRT := $(LOCAL_NO_CRT) | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 666 |  | 
|  | 667 | # this is really the way to get the files onto the command line instead | 
|  | 668 | # of using $^, because then LOCAL_ADDITIONAL_DEPENDENCIES doesn't work | 
|  | 669 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_SHARED_LIBRARIES := $(built_shared_libraries) | 
|  | 670 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_STATIC_LIBRARIES := $(built_static_libraries) | 
|  | 671 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_WHOLE_STATIC_LIBRARIES := $(built_whole_libraries) | 
|  | 672 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_OBJECTS := $(all_objects) | 
|  | 673 |  | 
|  | 674 | ########################################################### | 
|  | 675 | # Define library dependencies. | 
|  | 676 | ########################################################### | 
|  | 677 | # all_libraries is used for the dependencies on LOCAL_BUILT_MODULE. | 
|  | 678 | all_libraries := \ | 
|  | 679 | $(built_shared_libraries) \ | 
|  | 680 | $(built_static_libraries) \ | 
|  | 681 | $(built_whole_libraries) | 
|  | 682 |  | 
| The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 683 | # Also depend on the notice files for any static libraries that | 
|  | 684 | # are linked into this module.  This will force them to be installed | 
|  | 685 | # when this module is. | 
|  | 686 | $(LOCAL_INSTALLED_MODULE): | $(installed_static_library_notice_file_targets) | 
| Ying Wang | 5f07480 | 2011-11-08 09:31:21 -0800 | [diff] [blame] | 687 |  | 
|  | 688 | ########################################################### | 
|  | 689 | # Export includes | 
|  | 690 | ########################################################### | 
|  | 691 | export_includes := $(intermediates)/export_includes | 
|  | 692 | $(export_includes): PRIVATE_EXPORT_C_INCLUDE_DIRS := $(LOCAL_EXPORT_C_INCLUDE_DIRS) | 
| Ying Wang | 68f1c77 | 2012-04-23 21:29:18 -0700 | [diff] [blame] | 693 | $(export_includes) : $(LOCAL_MODULE_MAKEFILE) | 
| Ying Wang | 5f07480 | 2011-11-08 09:31:21 -0800 | [diff] [blame] | 694 | @echo Export includes file: $< -- $@ | 
|  | 695 | $(hide) mkdir -p $(dir $@) && rm -f $@ | 
|  | 696 | ifdef LOCAL_EXPORT_C_INCLUDE_DIRS | 
|  | 697 | $(hide) for d in $(PRIVATE_EXPORT_C_INCLUDE_DIRS); do \ | 
|  | 698 | echo "-I $$d" >> $@; \ | 
|  | 699 | done | 
|  | 700 | else | 
|  | 701 | $(hide) touch $@ | 
|  | 702 | endif | 
| Ying Wang | 616e596 | 2012-04-18 17:35:55 -0700 | [diff] [blame] | 703 |  | 
|  | 704 | # Make sure export_includes gets generated when you are running mm/mmm | 
|  | 705 | $(LOCAL_BUILT_MODULE) : | $(export_includes) |