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