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 | 848020f | 2012-08-14 10:13:16 -0700 | [diff] [blame] | 9 | ifdef LOCAL_SDK_VERSION |
Ying Wang | fe1bfe7 | 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 | 848020f | 2012-08-14 10:13:16 -0700 | [diff] [blame] | 16 | my_ndk_source_root := $(HISTORICAL_NDK_VERSIONS_ROOT)/current/sources |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 17 | my_ndk_version_root := $(HISTORICAL_NDK_VERSIONS_ROOT)/current/platforms/android-$(LOCAL_SDK_VERSION)/arch-$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)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 | 848020f | 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)) |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 38 | my_ndk_stl_static_lib := $(my_ndk_source_root)/cxx-stl/stlport/libs/$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)CPU_ABI)/libstlport_static.a |
Ying Wang | cce4c97 | 2011-03-03 18:53:53 -0800 | [diff] [blame] | 39 | else |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 40 | my_ndk_stl_shared_lib_fullpath := $(my_ndk_source_root)/cxx-stl/stlport/libs/$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)CPU_ABI)/libstlport_shared.so |
Ying Wang | cce4c97 | 2011-03-03 18:53:53 -0800 | [diff] [blame] | 41 | my_ndk_stl_shared_lib := -lstlport_shared |
| 42 | endif |
| 43 | else |
| 44 | # LOCAL_NDK_STL_VARIANT is gnustl_static |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 45 | my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/libs/$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)CPU_ABI)/include \ |
Ying Wang | d9020c2 | 2011-09-07 14:31:47 -0700 | [diff] [blame] | 46 | $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/include |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 47 | my_ndk_stl_static_lib := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/libs/$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)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 | |
Ying Wang | 848020f | 2012-08-14 10:13:16 -0700 | [diff] [blame] | 69 | ifdef LOCAL_SDK_VERSION |
Ying Wang | 704c0c9 | 2011-09-15 13:50:52 -0700 | [diff] [blame] | 70 | # Get the list of INSTALLED libraries as module names. |
Ian Rogers | 76a6dc3 | 2012-10-01 16:36:23 -0700 | [diff] [blame] | 71 | # We cannot compute the full path of the LOCAL_SHARED_LIBRARIES for |
Ying Wang | 704c0c9 | 2011-09-15 13:50:52 -0700 | [diff] [blame] | 72 | # they may cusomize their install path with LOCAL_MODULE_PATH |
| 73 | installed_shared_library_module_names := \ |
| 74 | $(LOCAL_SHARED_LIBRARIES) |
| 75 | else |
| 76 | installed_shared_library_module_names := \ |
| 77 | $(LOCAL_SYSTEM_SHARED_LIBRARIES) $(LOCAL_SHARED_LIBRARIES) |
| 78 | endif |
Ying Wang | 9485a57 | 2013-02-22 14:32:30 -0800 | [diff] [blame] | 79 | installed_shared_library_module_names := $(sort $(installed_shared_library_module_names)) |
Ying Wang | 704c0c9 | 2011-09-15 13:50:52 -0700 | [diff] [blame] | 80 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 81 | ####################################### |
| 82 | include $(BUILD_SYSTEM)/base_rules.mk |
| 83 | ####################################### |
Evgeniy Stepanov | 6cc9c06 | 2012-03-30 12:15:12 +0400 | [diff] [blame] | 84 | |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 85 | # The following LOCAL_ variables will be modified in this file. |
| 86 | # Because the same LOCAL_ variables may be used to define modules for both 1st arch and 2nd arch, |
| 87 | # we can't modify them in place. |
Ying Wang | b8e0185 | 2014-01-23 15:09:04 -0800 | [diff] [blame] | 88 | my_src_files := $(LOCAL_SRC_FILES) $(LOCAL_SRC_FILES_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) |
Colin Cross | 90353fe | 2014-02-04 14:53:25 -0800 | [diff] [blame] | 89 | my_static_libraries := $(LOCAL_STATIC_LIBRARIES_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_STATIC_LIBRARIES) |
| 90 | my_whole_static_libraries := $(LOCAL_WHOLE_STATIC_LIBRARIES) $(LOCAL_WHOLE_STATIC_LIBRARIES_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) |
| 91 | my_shared_libraries := $(LOCAL_SHARED_LIBRARIES) $(LOCAL_SHARED_LIBRARIES_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) |
Colin Cross | 44a7526 | 2014-01-29 17:46:37 -0800 | [diff] [blame] | 92 | my_32_64_bit_suffix := $(if $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_IS_64_BIT),64,32) |
| 93 | my_cflags := $(LOCAL_CFLAGS) $(LOCAL_CFLAGS_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CFLAGS_$(my_32_64_bit_suffix)) |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 94 | my_cppflags := $(LOCAL_CPPFLAGS) |
Colin Cross | 44a7526 | 2014-01-29 17:46:37 -0800 | [diff] [blame] | 95 | my_ldflags := $(LOCAL_LDFLAGS) $(LOCAL_LDFLAGS_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_LDFLAGS_$(my_32_64_bit_suffix)) |
| 96 | my_asflags := $(LOCAL_ASFLAGS) $(LOCAL_ASFLAGS_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_ASFLAGS_$(my_32_64_bit_suffix)) |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 97 | my_cc := $(LOCAL_CC) |
| 98 | my_cxx := $(LOCAL_CXX) |
Colin Cross | 44a7526 | 2014-01-29 17:46:37 -0800 | [diff] [blame] | 99 | my_c_includes := $(LOCAL_C_INCLUDES) $(LOCAL_C_INCLUDES_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_C_INCLUDES_$(my_32_64_bit_suffix)) |
Colin Cross | 90353fe | 2014-02-04 14:53:25 -0800 | [diff] [blame] | 100 | my_generated_sources := $(LOCAL_GENERATED_SOURCES) $(LOCAL_GENERATED_SOURCES_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 101 | |
Colin Cross | 8f47fc3 | 2014-01-27 17:34:21 -0800 | [diff] [blame] | 102 | my_cflags := $(filter-out $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_UNSUPPORTED_CFLAGS),$(my_cflags)) |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 103 | |
Ying Wang | 9485a57 | 2013-02-22 14:32:30 -0800 | [diff] [blame] | 104 | # The real dependency will be added after all Android.mks are loaded and the install paths |
| 105 | # of the shared libraries are determined. |
| 106 | ifdef LOCAL_INSTALLED_MODULE |
| 107 | ifdef installed_shared_library_module_names |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 108 | $(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)DEPENDENCIES_ON_SHARED_LIBRARIES += \ |
| 109 | $(LOCAL_MODULE):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(installed_shared_library_module_names)) |
Ying Wang | 9485a57 | 2013-02-22 14:32:30 -0800 | [diff] [blame] | 110 | endif |
| 111 | endif |
| 112 | |
Ying Wang | 285045b | 2013-08-13 12:35:10 -0700 | [diff] [blame] | 113 | # Add static HAL libraries |
| 114 | ifdef LOCAL_HAL_STATIC_LIBRARIES |
| 115 | $(foreach lib, $(LOCAL_HAL_STATIC_LIBRARIES), \ |
| 116 | $(eval b_lib := $(filter $(lib).%,$(BOARD_HAL_STATIC_LIBRARIES)))\ |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 117 | $(if $(b_lib), $(eval my_static_libraries += $(b_lib)),\ |
| 118 | $(eval my_static_libraries += $(lib).default))) |
Ying Wang | 285045b | 2013-08-13 12:35:10 -0700 | [diff] [blame] | 119 | b_lib := |
| 120 | endif |
| 121 | |
Evgeniy Stepanov | 6cc9c06 | 2012-03-30 12:15:12 +0400 | [diff] [blame] | 122 | ifeq ($(strip $(LOCAL_ADDRESS_SANITIZER)),true) |
| 123 | LOCAL_CLANG := true |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 124 | my_cflags += $(ADDRESS_SANITIZER_CONFIG_EXTRA_CFLAGS) |
| 125 | my_ldflags += $(ADDRESS_SANITIZER_CONFIG_EXTRA_LDFLAGS) |
| 126 | my_shared_libraries += $(ADDRESS_SANITIZER_CONFIG_EXTRA_SHARED_LIBRARIES) |
| 127 | my_static_libraries += $(ADDRESS_SANITIZER_CONFIG_EXTRA_STATIC_LIBRARIES) |
Evgeniy Stepanov | 6cc9c06 | 2012-03-30 12:15:12 +0400 | [diff] [blame] | 128 | endif |
| 129 | |
Ying Wang | 1f98283 | 2014-02-06 18:08:44 -0800 | [diff] [blame^] | 130 | ifeq ($(strip $($(LOCAL_2ND_ARCH_VAR_PREFIX)WITHOUT_CLANG)),true) |
Mike Lockwood | 051a174 | 2013-06-14 10:52:50 -0700 | [diff] [blame] | 131 | LOCAL_CLANG := |
| 132 | endif |
| 133 | |
Shih-wei Liao | c8dfc16 | 2013-01-27 01:45:59 -0800 | [diff] [blame] | 134 | # Add in libcompiler_rt for all regular device builds |
Mike Lockwood | daf5e22 | 2012-10-18 10:17:47 -0700 | [diff] [blame] | 135 | ifeq (,$(LOCAL_SDK_VERSION)$(LOCAL_IS_HOST_MODULE)$(WITHOUT_LIBCOMPILER_RT)) |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 136 | my_static_libraries += $(COMPILER_RT_CONFIG_EXTRA_STATIC_LIBRARIES) |
Stephen Hines | c72f396 | 2012-06-11 14:53:34 -0700 | [diff] [blame] | 137 | endif |
| 138 | |
Ying Wang | dfbe79b | 2012-03-22 11:26:22 -0700 | [diff] [blame] | 139 | my_compiler_dependencies := |
Evgeniy Stepanov | b71e2df | 2012-03-20 18:00:16 +0400 | [diff] [blame] | 140 | ifeq ($(strip $(LOCAL_CLANG)),true) |
Ying Wang | dfbe79b | 2012-03-22 11:26:22 -0700 | [diff] [blame] | 141 | my_compiler_dependencies := $(CLANG) $(CLANG_CXX) |
Evgeniy Stepanov | b71e2df | 2012-03-20 18:00:16 +0400 | [diff] [blame] | 142 | endif |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 143 | |
Jing Yu | 2dcc806 | 2009-09-21 16:31:50 -0700 | [diff] [blame] | 144 | #################################################### |
| 145 | ## Add FDO flags if FDO is turned on and supported |
| 146 | #################################################### |
synergydev | 7c46742 | 2013-08-13 17:41:52 -0700 | [diff] [blame] | 147 | ifneq ($(strip $(LOCAL_FDO_SUPPORT)),) |
synergydev | 4a60576 | 2013-08-05 02:44:37 -0700 | [diff] [blame] | 148 | ifeq ($(strip $(LOCAL_IS_HOST_MODULE)),) |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 149 | my_cflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_FDO_CFLAGS) |
| 150 | my_cppflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_FDO_CFLAGS) |
| 151 | my_ldflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_FDO_CFLAGS) |
synergydev | 4a60576 | 2013-08-05 02:44:37 -0700 | [diff] [blame] | 152 | endif |
Jing Yu | 2dcc806 | 2009-09-21 16:31:50 -0700 | [diff] [blame] | 153 | endif |
| 154 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 155 | ########################################################### |
Jim Huang | 20d1ba6 | 2010-10-14 16:15:56 +0800 | [diff] [blame] | 156 | ## Explicitly declare assembly-only __ASSEMBLY__ macro for |
| 157 | ## assembly source |
| 158 | ########################################################### |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 159 | my_asflags += -D__ASSEMBLY__ |
Jim Huang | 20d1ba6 | 2010-10-14 16:15:56 +0800 | [diff] [blame] | 160 | |
| 161 | ########################################################### |
Ying Wang | 1a08100 | 2010-07-13 14:55:47 -0700 | [diff] [blame] | 162 | ## Define PRIVATE_ variables from global vars |
| 163 | ########################################################### |
Ying Wang | 7fff9a1 | 2014-01-09 14:39:41 -0800 | [diff] [blame] | 164 | ifndef LOCAL_IS_HOST_MODULE |
Ying Wang | 848020f | 2012-08-14 10:13:16 -0700 | [diff] [blame] | 165 | ifdef LOCAL_SDK_VERSION |
Ying Wang | 1a08100 | 2010-07-13 14:55:47 -0700 | [diff] [blame] | 166 | my_target_project_includes := |
Evgeniy Stepanov | a7095e9 | 2012-03-30 12:18:52 +0400 | [diff] [blame] | 167 | my_target_c_includes := $(my_ndk_stl_include_path) $(my_ndk_version_root)/usr/include |
Ying Wang | 1a08100 | 2010-07-13 14:55:47 -0700 | [diff] [blame] | 168 | else |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 169 | my_target_project_includes := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_PROJECT_INCLUDES) |
| 170 | my_target_c_includes := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_C_INCLUDES) |
Ying Wang | f4723fa | 2013-08-15 11:01:10 -0700 | [diff] [blame] | 171 | endif # LOCAL_SDK_VERSION |
| 172 | |
| 173 | ifeq ($(LOCAL_CLANG),true) |
Ying Wang | 1f98283 | 2014-02-06 18:08:44 -0800 | [diff] [blame^] | 174 | my_target_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_TARGET_GLOBAL_CFLAGS) |
| 175 | my_target_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_TARGET_GLOBAL_CPPFLAGS) |
| 176 | my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_TARGET_GLOBAL_LDFLAGS) |
Ying Wang | f4723fa | 2013-08-15 11:01:10 -0700 | [diff] [blame] | 177 | my_target_c_includes += $(CLANG_CONFIG_EXTRA_TARGET_C_INCLUDES) |
Ying Wang | da4bf42 | 2012-08-16 16:45:01 -0700 | [diff] [blame] | 178 | else |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 179 | my_target_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_CFLAGS) |
| 180 | my_target_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_CPPFLAGS) |
| 181 | my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LDFLAGS) |
Ying Wang | da4bf42 | 2012-08-16 16:45:01 -0700 | [diff] [blame] | 182 | endif # LOCAL_CLANG |
Ying Wang | da4bf42 | 2012-08-16 16:45:01 -0700 | [diff] [blame] | 183 | |
Ying Wang | 1a08100 | 2010-07-13 14:55:47 -0700 | [diff] [blame] | 184 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_PROJECT_INCLUDES := $(my_target_project_includes) |
Evgeniy Stepanov | a7095e9 | 2012-03-30 12:18:52 +0400 | [diff] [blame] | 185 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_C_INCLUDES := $(my_target_c_includes) |
Ying Wang | 1a08100 | 2010-07-13 14:55:47 -0700 | [diff] [blame] | 186 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CFLAGS := $(my_target_global_cflags) |
Logan Chien | e6f6543 | 2013-12-10 19:07:41 +0800 | [diff] [blame] | 187 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CPPFLAGS := $(my_target_global_cppflags) |
| 188 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(my_target_global_ldflags) |
| 189 | |
Ying Wang | 7fff9a1 | 2014-01-09 14:39:41 -0800 | [diff] [blame] | 190 | else # LOCAL_IS_HOST_MODULE |
| 191 | |
Logan Chien | e6f6543 | 2013-12-10 19:07:41 +0800 | [diff] [blame] | 192 | ifeq ($(LOCAL_CLANG),true) |
| 193 | my_host_global_cflags := $(CLANG_HOST_GLOBAL_CFLAGS) |
| 194 | my_host_global_cppflags := $(CLANG_HOST_GLOBAL_CPPFLAGS) |
| 195 | my_host_global_ldflags := $(CLANG_HOST_GLOBAL_LDFLAGS) |
| 196 | my_host_c_includes := $(HOST_C_INCLUDES) $(CLANG_CONFIG_EXTRA_HOST_C_INCLUDES) |
| 197 | else |
| 198 | my_host_global_cflags := $(HOST_GLOBAL_CFLAGS) |
| 199 | my_host_global_cppflags := $(HOST_GLOBAL_CPPFLAGS) |
| 200 | my_host_global_ldflags := $(HOST_GLOBAL_LDFLAGS) |
| 201 | my_host_c_includes := $(HOST_C_INCLUDES) |
| 202 | endif # LOCAL_CLANG |
| 203 | |
| 204 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_C_INCLUDES := $(my_host_c_includes) |
| 205 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_CFLAGS := $(my_host_global_cflags) |
| 206 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_CPPFLAGS := $(my_host_global_cppflags) |
| 207 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_LDFLAGS := $(my_host_global_ldflags) |
| 208 | endif # LOCAL_IS_HOST_MODULE |
Ying Wang | 1a08100 | 2010-07-13 14:55:47 -0700 | [diff] [blame] | 209 | |
| 210 | ########################################################### |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 211 | ## Define PRIVATE_ variables used by multiple module types |
| 212 | ########################################################### |
| 213 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_NO_DEFAULT_COMPILER_FLAGS := \ |
Ying Wang | dfbe79b | 2012-03-22 11:26:22 -0700 | [diff] [blame] | 214 | $(strip $(LOCAL_NO_DEFAULT_COMPILER_FLAGS)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 215 | |
Andrew Hsieh | 6cea59a | 2013-08-27 17:33:06 +0800 | [diff] [blame] | 216 | ifeq ($(strip $(WITH_SYNTAX_CHECK)),) |
| 217 | LOCAL_NO_SYNTAX_CHECK := true |
| 218 | endif |
| 219 | |
Andrew Hsieh | 906cb78 | 2013-09-10 17:37:14 +0800 | [diff] [blame] | 220 | ifeq ($(strip $(WITH_STATIC_ANALYZER)),) |
| 221 | LOCAL_NO_STATIC_ANALYZER := true |
| 222 | endif |
| 223 | |
Andrew Hsieh | 6cea59a | 2013-08-27 17:33:06 +0800 | [diff] [blame] | 224 | ifneq ($(strip $(LOCAL_IS_HOST_MODULE)),) |
| 225 | my_syntax_arch := host |
| 226 | else |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 227 | my_syntax_arch := $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH) |
Andrew Hsieh | 6cea59a | 2013-08-27 17:33:06 +0800 | [diff] [blame] | 228 | endif |
| 229 | |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 230 | ifeq ($(strip $(my_cc)),) |
Evgeniy Stepanov | b71e2df | 2012-03-20 18:00:16 +0400 | [diff] [blame] | 231 | ifeq ($(strip $(LOCAL_CLANG)),true) |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 232 | my_cc := $(CLANG) |
Evgeniy Stepanov | b71e2df | 2012-03-20 18:00:16 +0400 | [diff] [blame] | 233 | else |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 234 | my_cc := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)CC) |
Evgeniy Stepanov | b71e2df | 2012-03-20 18:00:16 +0400 | [diff] [blame] | 235 | endif |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 236 | endif |
Andrew Hsieh | 906cb78 | 2013-09-10 17:37:14 +0800 | [diff] [blame] | 237 | ifneq ($(LOCAL_NO_STATIC_ANALYZER),true) |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 238 | my_cc := $(SYNTAX_TOOLS_PREFIX)/ccc-analyzer $(my_syntax_arch) "$(my_cc)" |
Andrew Hsieh | 906cb78 | 2013-09-10 17:37:14 +0800 | [diff] [blame] | 239 | else |
Andrew Hsieh | 6cea59a | 2013-08-27 17:33:06 +0800 | [diff] [blame] | 240 | ifneq ($(LOCAL_NO_SYNTAX_CHECK),true) |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 241 | my_cc := $(SYNTAX_TOOLS_PREFIX)/ccc-syntax $(my_syntax_arch) "$(my_cc)" |
Andrew Hsieh | 6cea59a | 2013-08-27 17:33:06 +0800 | [diff] [blame] | 242 | endif |
Andrew Hsieh | 906cb78 | 2013-09-10 17:37:14 +0800 | [diff] [blame] | 243 | endif |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 244 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CC := $(my_cc) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 245 | |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 246 | ifeq ($(strip $(my_cxx)),) |
Evgeniy Stepanov | b71e2df | 2012-03-20 18:00:16 +0400 | [diff] [blame] | 247 | ifeq ($(strip $(LOCAL_CLANG)),true) |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 248 | my_cxx := $(CLANG_CXX) |
Evgeniy Stepanov | b71e2df | 2012-03-20 18:00:16 +0400 | [diff] [blame] | 249 | else |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 250 | my_cxx := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)CXX) |
Evgeniy Stepanov | b71e2df | 2012-03-20 18:00:16 +0400 | [diff] [blame] | 251 | endif |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 252 | endif |
Andrew Hsieh | 906cb78 | 2013-09-10 17:37:14 +0800 | [diff] [blame] | 253 | ifneq ($(LOCAL_NO_STATIC_ANALYZER),true) |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 254 | my_cxx := $(SYNTAX_TOOLS_PREFIX)/cxx-analyzer $(my_syntax_arch) "$(my_cxx)" |
Andrew Hsieh | 906cb78 | 2013-09-10 17:37:14 +0800 | [diff] [blame] | 255 | else |
Andrew Hsieh | 6cea59a | 2013-08-27 17:33:06 +0800 | [diff] [blame] | 256 | ifneq ($(LOCAL_NO_SYNTAX_CHECK),true) |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 257 | my_cxx := $(SYNTAX_TOOLS_PREFIX)/cxx-syntax $(my_syntax_arch) "$(my_cxx)" |
Andrew Hsieh | 6cea59a | 2013-08-27 17:33:06 +0800 | [diff] [blame] | 258 | endif |
Andrew Hsieh | 906cb78 | 2013-09-10 17:37:14 +0800 | [diff] [blame] | 259 | endif |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 260 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CXX := $(my_cxx) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 261 | |
| 262 | # TODO: support a mix of standard extensions so that this isn't necessary |
| 263 | LOCAL_CPP_EXTENSION := $(strip $(LOCAL_CPP_EXTENSION)) |
| 264 | ifeq ($(LOCAL_CPP_EXTENSION),) |
| 265 | LOCAL_CPP_EXTENSION := .cpp |
| 266 | endif |
| 267 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CPP_EXTENSION := $(LOCAL_CPP_EXTENSION) |
| 268 | |
| 269 | # Certain modules like libdl have to have symbols resolved at runtime and blow |
| 270 | # up if --no-undefined is passed to the linker. |
| 271 | ifeq ($(strip $(LOCAL_NO_DEFAULT_COMPILER_FLAGS)),) |
| 272 | ifeq ($(strip $(LOCAL_ALLOW_UNDEFINED_SYMBOLS)),) |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 273 | my_ldflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)NO_UNDEFINED_LDFLAGS) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 274 | endif |
| 275 | endif |
| 276 | |
Ying Wang | fcdabd4 | 2011-04-25 14:22:41 -0700 | [diff] [blame] | 277 | ifeq (true,$(LOCAL_GROUP_STATIC_LIBRARIES)) |
| 278 | $(LOCAL_BUILT_MODULE): PRIVATE_GROUP_STATIC_LIBRARIES := true |
| 279 | else |
| 280 | $(LOCAL_BUILT_MODULE): PRIVATE_GROUP_STATIC_LIBRARIES := |
| 281 | endif |
| 282 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 283 | ########################################################### |
| 284 | ## Define arm-vs-thumb-mode flags. |
| 285 | ########################################################### |
| 286 | LOCAL_ARM_MODE := $(strip $(LOCAL_ARM_MODE)) |
Colin Cross | 6e087a3 | 2014-01-22 17:36:05 -0800 | [diff] [blame] | 287 | ifeq ($(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH),arm) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 288 | arm_objects_mode := $(if $(LOCAL_ARM_MODE),$(LOCAL_ARM_MODE),arm) |
| 289 | normal_objects_mode := $(if $(LOCAL_ARM_MODE),$(LOCAL_ARM_MODE),thumb) |
| 290 | |
Dave Bort | 9528248 | 2009-04-23 18:44:55 -0700 | [diff] [blame] | 291 | # Read the values from something like TARGET_arm_CFLAGS or |
| 292 | # TARGET_thumb_CFLAGS. HOST_(arm|thumb)_CFLAGS values aren't |
| 293 | # actually used (although they are usually empty). |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 294 | arm_objects_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)$(arm_objects_mode)_CFLAGS) |
| 295 | normal_objects_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)$(normal_objects_mode)_CFLAGS) |
Logan Chien | e6f6543 | 2013-12-10 19:07:41 +0800 | [diff] [blame] | 296 | ifeq ($(strip $(LOCAL_CLANG)),true) |
Ying Wang | 1f98283 | 2014-02-06 18:08:44 -0800 | [diff] [blame^] | 297 | arm_objects_cflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(arm_objects_cflags)) |
| 298 | normal_objects_cflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(normal_objects_cflags)) |
Evgeniy Stepanov | f50f4c5 | 2012-04-05 11:44:37 +0400 | [diff] [blame] | 299 | endif |
| 300 | |
Chih-Wei Huang | 0d09e58 | 2010-07-09 10:07:52 +0800 | [diff] [blame] | 301 | else |
| 302 | arm_objects_mode := |
| 303 | normal_objects_mode := |
| 304 | arm_objects_cflags := |
| 305 | normal_objects_cflags := |
| 306 | endif |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 307 | |
| 308 | ########################################################### |
| 309 | ## Define per-module debugging flags. Users can turn on |
| 310 | ## debugging for a particular module by setting DEBUG_MODULE_ModuleName |
| 311 | ## to a non-empty value in their environment or buildspec.mk, |
| 312 | ## and setting HOST_/TARGET_CUSTOM_DEBUG_CFLAGS to the |
| 313 | ## debug flags that they want to use. |
| 314 | ########################################################### |
| 315 | ifdef DEBUG_MODULE_$(strip $(LOCAL_MODULE)) |
| 316 | debug_cflags := $($(my_prefix)CUSTOM_DEBUG_CFLAGS) |
| 317 | else |
| 318 | debug_cflags := |
| 319 | endif |
| 320 | |
Tim Murray | a7aa800 | 2012-10-29 16:06:00 -0700 | [diff] [blame] | 321 | #################################################### |
| 322 | ## Compile RenderScript with reflected C++ |
| 323 | #################################################### |
| 324 | |
Ying Wang | b8e0185 | 2014-01-23 15:09:04 -0800 | [diff] [blame] | 325 | renderscript_sources := $(filter %.rs %.fs,$(my_src_files)) |
Tim Murray | a7aa800 | 2012-10-29 16:06:00 -0700 | [diff] [blame] | 326 | |
| 327 | ifneq (,$(renderscript_sources)) |
| 328 | |
| 329 | renderscript_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(renderscript_sources)) |
| 330 | RenderScript_file_stamp := $(intermediates)/RenderScriptCPP.stamp |
| 331 | renderscript_intermediate := $(intermediates)/renderscript |
| 332 | |
| 333 | ifeq ($(LOCAL_RENDERSCRIPT_CC),) |
| 334 | LOCAL_RENDERSCRIPT_CC := $(LLVM_RS_CC) |
| 335 | endif |
| 336 | |
| 337 | # Turn on all warnings and warnings as errors for RS compiles. |
| 338 | # This can be disabled with LOCAL_RENDERSCRIPT_FLAGS := -Wno-error |
| 339 | renderscript_flags := -Wall -Werror |
| 340 | renderscript_flags += $(LOCAL_RENDERSCRIPT_FLAGS) |
| 341 | |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 342 | renderscript_includes := \ |
Tim Murray | a7aa800 | 2012-10-29 16:06:00 -0700 | [diff] [blame] | 343 | $(TOPDIR)external/clang/lib/Headers \ |
| 344 | $(TOPDIR)frameworks/rs/scriptc \ |
| 345 | $(LOCAL_RENDERSCRIPT_INCLUDES) |
| 346 | |
| 347 | ifneq ($(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE),) |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 348 | renderscript_includes := $(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE) |
Tim Murray | a7aa800 | 2012-10-29 16:06:00 -0700 | [diff] [blame] | 349 | endif |
| 350 | |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 351 | $(RenderScript_file_stamp): PRIVATE_RS_INCLUDES := $(renderscript_includes) |
Tim Murray | a7aa800 | 2012-10-29 16:06:00 -0700 | [diff] [blame] | 352 | $(RenderScript_file_stamp): PRIVATE_RS_CC := $(LOCAL_RENDERSCRIPT_CC) |
| 353 | $(RenderScript_file_stamp): PRIVATE_RS_FLAGS := $(renderscript_flags) |
| 354 | $(RenderScript_file_stamp): PRIVATE_RS_SOURCE_FILES := $(renderscript_sources_fullpath) |
| 355 | $(RenderScript_file_stamp): PRIVATE_RS_OUTPUT_DIR := $(renderscript_intermediate) |
| 356 | $(RenderScript_file_stamp): $(renderscript_sources_fullpath) $(LOCAL_RENDERSCRIPT_CC) |
| 357 | $(transform-renderscripts-to-cpp-and-bc) |
| 358 | |
| 359 | # include the dependency files (.d) generated by llvm-rs-cc. |
| 360 | renderscript_generated_dep_files := $(addprefix $(renderscript_intermediate)/, \ |
| 361 | $(patsubst %.fs,%.d, $(patsubst %.rs,%.d, $(notdir $(renderscript_sources))))) |
| 362 | -include $(renderscript_generated_dep_files) |
| 363 | |
| 364 | LOCAL_INTERMEDIATE_TARGETS += $(RenderScript_file_stamp) |
| 365 | |
| 366 | rs_generated_cpps := $(addprefix \ |
| 367 | $(renderscript_intermediate)/ScriptC_,$(patsubst %.fs,%.cpp, $(patsubst %.rs,%.cpp, \ |
| 368 | $(notdir $(renderscript_sources))))) |
| 369 | |
| 370 | $(rs_generated_cpps) : $(RenderScript_file_stamp) |
| 371 | |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 372 | my_c_includes += $(renderscript_intermediate) |
| 373 | my_generated_sources += $(rs_generated_cpps) |
Tim Murray | a7aa800 | 2012-10-29 16:06:00 -0700 | [diff] [blame] | 374 | |
| 375 | endif |
| 376 | |
| 377 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 378 | ########################################################### |
| 379 | ## Stuff source generated from one-off tools |
| 380 | ########################################################### |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 381 | $(my_generated_sources): PRIVATE_MODULE := $(my_register_name) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 382 | |
Colin Cross | d826264 | 2014-01-24 23:17:21 -0800 | [diff] [blame] | 383 | my_gen_sources_copy := $(patsubst $(generated_sources_dir)/%,$(intermediates)/%,$(filter $(generated_sources_dir)/%,$(my_generated_sources))) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 384 | |
Colin Cross | d826264 | 2014-01-24 23:17:21 -0800 | [diff] [blame] | 385 | $(my_gen_sources_copy): $(intermediates)/% : $(generated_sources_dir)/% | $(ACP) |
| 386 | @echo "Copy: $@" |
| 387 | $(copy-file-to-target) |
| 388 | |
| 389 | my_generated_sources := $(patsubst $(generated_sources_dir)/%,$(intermediates)/%,$(my_generated_sources)) |
| 390 | |
| 391 | ALL_GENERATED_SOURCES += $(my_generated_sources) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 392 | |
| 393 | ########################################################### |
Ying Wang | a5fc87a | 2010-11-02 18:43:16 -0700 | [diff] [blame] | 394 | ## Compile the .proto files to .cc and then to .o |
| 395 | ########################################################### |
Ying Wang | b8e0185 | 2014-01-23 15:09:04 -0800 | [diff] [blame] | 396 | proto_sources := $(filter %.proto,$(my_src_files)) |
Ying Wang | a5fc87a | 2010-11-02 18:43:16 -0700 | [diff] [blame] | 397 | proto_generated_objects := |
| 398 | proto_generated_headers := |
| 399 | ifneq ($(proto_sources),) |
| 400 | proto_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(proto_sources)) |
| 401 | proto_generated_cc_sources_dir := $(intermediates)/proto |
| 402 | proto_generated_cc_sources := $(addprefix $(proto_generated_cc_sources_dir)/, \ |
Ying Wang | dfbe79b | 2012-03-22 11:26:22 -0700 | [diff] [blame] | 403 | $(patsubst %.proto,%.pb.cc,$(proto_sources_fullpath))) |
Ying Wang | a5fc87a | 2010-11-02 18:43:16 -0700 | [diff] [blame] | 404 | proto_generated_objects := $(patsubst %.cc,%.o, $(proto_generated_cc_sources)) |
| 405 | |
| 406 | $(proto_generated_cc_sources): PRIVATE_PROTO_INCLUDES := $(TOP) |
| 407 | $(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] | 408 | $(proto_generated_cc_sources): PRIVATE_PROTOC_FLAGS := $(LOCAL_PROTOC_FLAGS) |
Ying Wang | a5fc87a | 2010-11-02 18:43:16 -0700 | [diff] [blame] | 409 | $(proto_generated_cc_sources): $(proto_generated_cc_sources_dir)/%.pb.cc: %.proto $(PROTOC) |
| 410 | $(transform-proto-to-cc) |
| 411 | |
| 412 | proto_generated_headers := $(patsubst %.pb.cc,%.pb.h, $(proto_generated_cc_sources)) |
| 413 | $(proto_generated_headers): $(proto_generated_cc_sources_dir)/%.pb.h: $(proto_generated_cc_sources_dir)/%.pb.cc |
| 414 | |
Ying Wang | 022a7b3 | 2012-06-13 11:38:10 -0700 | [diff] [blame] | 415 | $(proto_generated_objects): PRIVATE_ARM_MODE := $(normal_objects_mode) |
| 416 | $(proto_generated_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags) |
Narayan Kamath | 2109487 | 2012-04-02 18:19:31 +0100 | [diff] [blame] | 417 | $(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] | 418 | $(transform-$(PRIVATE_HOST)cpp-to-o) |
| 419 | -include $(proto_generated_objects:%.o=%.P) |
| 420 | |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 421 | my_c_includes += external/protobuf/src $(proto_generated_cc_sources_dir) |
| 422 | my_cflags += -DGOOGLE_PROTOBUF_NO_RTTI |
Ying Wang | a5fc87a | 2010-11-02 18:43:16 -0700 | [diff] [blame] | 423 | ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),full) |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 424 | my_static_libraries += libprotobuf-cpp-2.3.0-full |
Ying Wang | a5fc87a | 2010-11-02 18:43:16 -0700 | [diff] [blame] | 425 | else |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 426 | my_static_libraries += libprotobuf-cpp-2.3.0-lite |
Ying Wang | a5fc87a | 2010-11-02 18:43:16 -0700 | [diff] [blame] | 427 | endif |
| 428 | endif |
| 429 | |
| 430 | |
| 431 | ########################################################### |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 432 | ## YACC: Compile .y files to .cpp and the to .o. |
| 433 | ########################################################### |
| 434 | |
Ying Wang | b8e0185 | 2014-01-23 15:09:04 -0800 | [diff] [blame] | 435 | yacc_sources := $(filter %.y,$(my_src_files)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 436 | yacc_cpps := $(addprefix \ |
Ying Wang | dfbe79b | 2012-03-22 11:26:22 -0700 | [diff] [blame] | 437 | $(intermediates)/,$(yacc_sources:.y=$(LOCAL_CPP_EXTENSION))) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 438 | yacc_headers := $(yacc_cpps:$(LOCAL_CPP_EXTENSION)=.h) |
| 439 | yacc_objects := $(yacc_cpps:$(LOCAL_CPP_EXTENSION)=.o) |
| 440 | |
| 441 | ifneq ($(strip $(yacc_cpps)),) |
| 442 | $(yacc_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \ |
Ying Wang | dfbe79b | 2012-03-22 11:26:22 -0700 | [diff] [blame] | 443 | $(TOPDIR)$(LOCAL_PATH)/%.y \ |
| 444 | $(lex_cpps) $(LOCAL_ADDITIONAL_DEPENDENCIES) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 445 | $(call transform-y-to-cpp,$(PRIVATE_CPP_EXTENSION)) |
| 446 | $(yacc_headers): $(intermediates)/%.h: $(intermediates)/%$(LOCAL_CPP_EXTENSION) |
| 447 | |
| 448 | $(yacc_objects): PRIVATE_ARM_MODE := $(normal_objects_mode) |
| 449 | $(yacc_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags) |
| 450 | $(yacc_objects): $(intermediates)/%.o: $(intermediates)/%$(LOCAL_CPP_EXTENSION) |
| 451 | $(transform-$(PRIVATE_HOST)cpp-to-o) |
| 452 | endif |
| 453 | |
| 454 | ########################################################### |
| 455 | ## LEX: Compile .l files to .cpp and then to .o. |
| 456 | ########################################################### |
| 457 | |
Ying Wang | b8e0185 | 2014-01-23 15:09:04 -0800 | [diff] [blame] | 458 | lex_sources := $(filter %.l,$(my_src_files)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 459 | lex_cpps := $(addprefix \ |
Ying Wang | dfbe79b | 2012-03-22 11:26:22 -0700 | [diff] [blame] | 460 | $(intermediates)/,$(lex_sources:.l=$(LOCAL_CPP_EXTENSION))) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 461 | lex_objects := $(lex_cpps:$(LOCAL_CPP_EXTENSION)=.o) |
| 462 | |
| 463 | ifneq ($(strip $(lex_cpps)),) |
| 464 | $(lex_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \ |
Ying Wang | dfbe79b | 2012-03-22 11:26:22 -0700 | [diff] [blame] | 465 | $(TOPDIR)$(LOCAL_PATH)/%.l |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 466 | $(transform-l-to-cpp) |
| 467 | |
| 468 | $(lex_objects): PRIVATE_ARM_MODE := $(normal_objects_mode) |
| 469 | $(lex_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags) |
| 470 | $(lex_objects): $(intermediates)/%.o: \ |
Ying Wang | dfbe79b | 2012-03-22 11:26:22 -0700 | [diff] [blame] | 471 | $(intermediates)/%$(LOCAL_CPP_EXTENSION) \ |
| 472 | $(LOCAL_ADDITIONAL_DEPENDENCIES) \ |
| 473 | $(yacc_headers) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 474 | $(transform-$(PRIVATE_HOST)cpp-to-o) |
| 475 | endif |
| 476 | |
| 477 | ########################################################### |
| 478 | ## C++: Compile .cpp files to .o. |
| 479 | ########################################################### |
| 480 | |
Jeff Brown | e33ba4c | 2011-07-11 22:11:46 -0700 | [diff] [blame] | 481 | # we also do this on host modules, even though |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 482 | # it's not really arm, because there are files that are shared. |
Ying Wang | b8e0185 | 2014-01-23 15:09:04 -0800 | [diff] [blame] | 483 | cpp_arm_sources := $(patsubst %$(LOCAL_CPP_EXTENSION).arm,%$(LOCAL_CPP_EXTENSION),$(filter %$(LOCAL_CPP_EXTENSION).arm,$(my_src_files))) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 484 | cpp_arm_objects := $(addprefix $(intermediates)/,$(cpp_arm_sources:$(LOCAL_CPP_EXTENSION)=.o)) |
| 485 | |
Ying Wang | b8e0185 | 2014-01-23 15:09:04 -0800 | [diff] [blame] | 486 | cpp_normal_sources := $(filter %$(LOCAL_CPP_EXTENSION),$(my_src_files)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 487 | cpp_normal_objects := $(addprefix $(intermediates)/,$(cpp_normal_sources:$(LOCAL_CPP_EXTENSION)=.o)) |
| 488 | |
| 489 | $(cpp_arm_objects): PRIVATE_ARM_MODE := $(arm_objects_mode) |
| 490 | $(cpp_arm_objects): PRIVATE_ARM_CFLAGS := $(arm_objects_cflags) |
| 491 | $(cpp_normal_objects): PRIVATE_ARM_MODE := $(normal_objects_mode) |
| 492 | $(cpp_normal_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags) |
| 493 | |
| 494 | cpp_objects := $(cpp_arm_objects) $(cpp_normal_objects) |
| 495 | |
| 496 | ifneq ($(strip $(cpp_objects)),) |
| 497 | $(cpp_objects): $(intermediates)/%.o: \ |
Ying Wang | dfbe79b | 2012-03-22 11:26:22 -0700 | [diff] [blame] | 498 | $(TOPDIR)$(LOCAL_PATH)/%$(LOCAL_CPP_EXTENSION) \ |
Ying Wang | 9c3aa05 | 2013-02-20 13:34:05 -0800 | [diff] [blame] | 499 | $(yacc_cpps) $(proto_generated_headers) \ |
| 500 | $(LOCAL_ADDITIONAL_DEPENDENCIES) \ |
| 501 | | $(my_compiler_dependencies) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 502 | $(transform-$(PRIVATE_HOST)cpp-to-o) |
| 503 | -include $(cpp_objects:%.o=%.P) |
| 504 | endif |
| 505 | |
| 506 | ########################################################### |
| 507 | ## C++: Compile generated .cpp files to .o. |
| 508 | ########################################################### |
| 509 | |
Ying Wang | ec6d626 | 2014-01-16 16:21:03 -0800 | [diff] [blame] | 510 | gen_cpp_sources := $(filter %$(LOCAL_CPP_EXTENSION),$(my_generated_sources)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 511 | gen_cpp_objects := $(gen_cpp_sources:%$(LOCAL_CPP_EXTENSION)=%.o) |
| 512 | |
| 513 | ifneq ($(strip $(gen_cpp_objects)),) |
| 514 | # Compile all generated files as thumb. |
| 515 | # TODO: support compiling certain generated files as arm. |
| 516 | $(gen_cpp_objects): PRIVATE_ARM_MODE := $(normal_objects_mode) |
| 517 | $(gen_cpp_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags) |
Evgeniy Stepanov | b71e2df | 2012-03-20 18:00:16 +0400 | [diff] [blame] | 518 | $(gen_cpp_objects): $(intermediates)/%.o: \ |
| 519 | $(intermediates)/%$(LOCAL_CPP_EXTENSION) $(yacc_cpps) \ |
Ying Wang | 9c3aa05 | 2013-02-20 13:34:05 -0800 | [diff] [blame] | 520 | $(proto_generated_headers) \ |
| 521 | $(LOCAL_ADDITIONAL_DEPENDENCIES) \ |
| 522 | | $(my_compiler_dependencies) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 523 | $(transform-$(PRIVATE_HOST)cpp-to-o) |
| 524 | -include $(gen_cpp_objects:%.o=%.P) |
| 525 | endif |
| 526 | |
| 527 | ########################################################### |
| 528 | ## S: Compile generated .S and .s files to .o. |
| 529 | ########################################################### |
| 530 | |
Ying Wang | ec6d626 | 2014-01-16 16:21:03 -0800 | [diff] [blame] | 531 | gen_S_sources := $(filter %.S,$(my_generated_sources)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 532 | gen_S_objects := $(gen_S_sources:%.S=%.o) |
| 533 | |
| 534 | ifneq ($(strip $(gen_S_sources)),) |
Evgeniy Stepanov | b71e2df | 2012-03-20 18:00:16 +0400 | [diff] [blame] | 535 | $(gen_S_objects): $(intermediates)/%.o: $(intermediates)/%.S \ |
Ying Wang | 9c3aa05 | 2013-02-20 13:34:05 -0800 | [diff] [blame] | 536 | $(LOCAL_ADDITIONAL_DEPENDENCIES) \ |
| 537 | | $(my_compiler_dependencies) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 538 | $(transform-$(PRIVATE_HOST)s-to-o) |
| 539 | -include $(gen_S_objects:%.o=%.P) |
| 540 | endif |
| 541 | |
Ying Wang | ec6d626 | 2014-01-16 16:21:03 -0800 | [diff] [blame] | 542 | gen_s_sources := $(filter %.s,$(my_generated_sources)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 543 | gen_s_objects := $(gen_s_sources:%.s=%.o) |
| 544 | |
| 545 | ifneq ($(strip $(gen_s_objects)),) |
Evgeniy Stepanov | b71e2df | 2012-03-20 18:00:16 +0400 | [diff] [blame] | 546 | $(gen_s_objects): $(intermediates)/%.o: $(intermediates)/%.s \ |
Ying Wang | 9c3aa05 | 2013-02-20 13:34:05 -0800 | [diff] [blame] | 547 | $(LOCAL_ADDITIONAL_DEPENDENCIES) \ |
| 548 | | $(my_compiler_dependencies) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 549 | $(transform-$(PRIVATE_HOST)s-to-o-no-deps) |
| 550 | -include $(gen_s_objects:%.o=%.P) |
| 551 | endif |
| 552 | |
| 553 | gen_asm_objects := $(gen_S_objects) $(gen_s_objects) |
| 554 | |
| 555 | ########################################################### |
Torne (Richard Coles) | aace202 | 2013-02-21 14:01:35 +0000 | [diff] [blame] | 556 | ## o: Include generated .o files in output. |
| 557 | ########################################################### |
| 558 | |
Ying Wang | ec6d626 | 2014-01-16 16:21:03 -0800 | [diff] [blame] | 559 | gen_o_objects := $(filter %.o,$(my_generated_sources)) |
Torne (Richard Coles) | aace202 | 2013-02-21 14:01:35 +0000 | [diff] [blame] | 560 | |
| 561 | ########################################################### |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 562 | ## C: Compile .c files to .o. |
| 563 | ########################################################### |
| 564 | |
Ying Wang | b8e0185 | 2014-01-23 15:09:04 -0800 | [diff] [blame] | 565 | c_arm_sources := $(patsubst %.c.arm,%.c,$(filter %.c.arm,$(my_src_files))) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 566 | c_arm_objects := $(addprefix $(intermediates)/,$(c_arm_sources:.c=.o)) |
| 567 | |
Ying Wang | b8e0185 | 2014-01-23 15:09:04 -0800 | [diff] [blame] | 568 | c_normal_sources := $(filter %.c,$(my_src_files)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 569 | c_normal_objects := $(addprefix $(intermediates)/,$(c_normal_sources:.c=.o)) |
| 570 | |
| 571 | $(c_arm_objects): PRIVATE_ARM_MODE := $(arm_objects_mode) |
| 572 | $(c_arm_objects): PRIVATE_ARM_CFLAGS := $(arm_objects_cflags) |
| 573 | $(c_normal_objects): PRIVATE_ARM_MODE := $(normal_objects_mode) |
| 574 | $(c_normal_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags) |
| 575 | |
| 576 | c_objects := $(c_arm_objects) $(c_normal_objects) |
| 577 | |
| 578 | ifneq ($(strip $(c_objects)),) |
Evgeniy Stepanov | b71e2df | 2012-03-20 18:00:16 +0400 | [diff] [blame] | 579 | $(c_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.c $(yacc_cpps) $(proto_generated_headers) \ |
Ying Wang | 9c3aa05 | 2013-02-20 13:34:05 -0800 | [diff] [blame] | 580 | $(LOCAL_ADDITIONAL_DEPENDENCIES) \ |
| 581 | | $(my_compiler_dependencies) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 582 | $(transform-$(PRIVATE_HOST)c-to-o) |
| 583 | -include $(c_objects:%.o=%.P) |
| 584 | endif |
| 585 | |
| 586 | ########################################################### |
Jack Palevich | e7b3e2c | 2009-05-04 14:32:44 -0700 | [diff] [blame] | 587 | ## C: Compile generated .c files to .o. |
| 588 | ########################################################### |
| 589 | |
Ying Wang | ec6d626 | 2014-01-16 16:21:03 -0800 | [diff] [blame] | 590 | gen_c_sources := $(filter %.c,$(my_generated_sources)) |
Jack Palevich | e7b3e2c | 2009-05-04 14:32:44 -0700 | [diff] [blame] | 591 | gen_c_objects := $(gen_c_sources:%.c=%.o) |
| 592 | |
| 593 | ifneq ($(strip $(gen_c_objects)),) |
| 594 | # Compile all generated files as thumb. |
| 595 | # TODO: support compiling certain generated files as arm. |
| 596 | $(gen_c_objects): PRIVATE_ARM_MODE := $(normal_objects_mode) |
| 597 | $(gen_c_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags) |
Evgeniy Stepanov | b71e2df | 2012-03-20 18:00:16 +0400 | [diff] [blame] | 598 | $(gen_c_objects): $(intermediates)/%.o: $(intermediates)/%.c $(yacc_cpps) $(proto_generated_headers) \ |
Ying Wang | 9c3aa05 | 2013-02-20 13:34:05 -0800 | [diff] [blame] | 599 | $(LOCAL_ADDITIONAL_DEPENDENCIES) \ |
| 600 | | $(my_compiler_dependencies) |
Jack Palevich | e7b3e2c | 2009-05-04 14:32:44 -0700 | [diff] [blame] | 601 | $(transform-$(PRIVATE_HOST)c-to-o) |
| 602 | -include $(gen_c_objects:%.o=%.P) |
| 603 | endif |
| 604 | |
| 605 | ########################################################### |
David 'Digit' Turner | 5dbb529 | 2009-05-14 16:00:09 +0200 | [diff] [blame] | 606 | ## ObjC: Compile .m files to .o |
| 607 | ########################################################### |
| 608 | |
Ying Wang | b8e0185 | 2014-01-23 15:09:04 -0800 | [diff] [blame] | 609 | objc_sources := $(filter %.m,$(my_src_files)) |
David 'Digit' Turner | 5dbb529 | 2009-05-14 16:00:09 +0200 | [diff] [blame] | 610 | objc_objects := $(addprefix $(intermediates)/,$(objc_sources:.m=.o)) |
| 611 | |
| 612 | ifneq ($(strip $(objc_objects)),) |
Evgeniy Stepanov | b71e2df | 2012-03-20 18:00:16 +0400 | [diff] [blame] | 613 | $(objc_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.m $(yacc_cpps) $(proto_generated_headers) \ |
Ying Wang | 9c3aa05 | 2013-02-20 13:34:05 -0800 | [diff] [blame] | 614 | $(LOCAL_ADDITIONAL_DEPENDENCIES) \ |
| 615 | | $(my_compiler_dependencies) |
David 'Digit' Turner | 5dbb529 | 2009-05-14 16:00:09 +0200 | [diff] [blame] | 616 | $(transform-$(PRIVATE_HOST)m-to-o) |
| 617 | -include $(objc_objects:%.o=%.P) |
| 618 | endif |
| 619 | |
| 620 | ########################################################### |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 621 | ## AS: Compile .S files to .o. |
| 622 | ########################################################### |
| 623 | |
Ying Wang | b8e0185 | 2014-01-23 15:09:04 -0800 | [diff] [blame] | 624 | asm_sources_S := $(filter %.S,$(my_src_files)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 625 | asm_objects_S := $(addprefix $(intermediates)/,$(asm_sources_S:.S=.o)) |
| 626 | |
| 627 | ifneq ($(strip $(asm_objects_S)),) |
Evgeniy Stepanov | b71e2df | 2012-03-20 18:00:16 +0400 | [diff] [blame] | 628 | $(asm_objects_S): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.S \ |
Ying Wang | 9c3aa05 | 2013-02-20 13:34:05 -0800 | [diff] [blame] | 629 | $(LOCAL_ADDITIONAL_DEPENDENCIES) \ |
| 630 | | $(my_compiler_dependencies) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 631 | $(transform-$(PRIVATE_HOST)s-to-o) |
| 632 | -include $(asm_objects_S:%.o=%.P) |
| 633 | endif |
| 634 | |
Ying Wang | b8e0185 | 2014-01-23 15:09:04 -0800 | [diff] [blame] | 635 | asm_sources_s := $(filter %.s,$(my_src_files)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 636 | asm_objects_s := $(addprefix $(intermediates)/,$(asm_sources_s:.s=.o)) |
| 637 | |
| 638 | ifneq ($(strip $(asm_objects_s)),) |
Evgeniy Stepanov | b71e2df | 2012-03-20 18:00:16 +0400 | [diff] [blame] | 639 | $(asm_objects_s): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.s \ |
Ying Wang | 9c3aa05 | 2013-02-20 13:34:05 -0800 | [diff] [blame] | 640 | $(LOCAL_ADDITIONAL_DEPENDENCIES) \ |
| 641 | | $(my_compiler_dependencies) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 642 | $(transform-$(PRIVATE_HOST)s-to-o-no-deps) |
| 643 | -include $(asm_objects_s:%.o=%.P) |
| 644 | endif |
| 645 | |
| 646 | asm_objects := $(asm_objects_S) $(asm_objects_s) |
| 647 | |
| 648 | |
Ying Wang | 5f07480 | 2011-11-08 09:31:21 -0800 | [diff] [blame] | 649 | #################################################### |
| 650 | ## Import includes |
| 651 | #################################################### |
| 652 | import_includes := $(intermediates)/import_includes |
| 653 | import_includes_deps := $(strip \ |
| 654 | $(foreach l, $(installed_shared_library_module_names), \ |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 655 | $(call intermediates-dir-for,SHARED_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX))/export_includes) \ |
Colin Cross | 90353fe | 2014-02-04 14:53:25 -0800 | [diff] [blame] | 656 | $(foreach l, $(my_static_libraries) $(my_whole_static_libraries), \ |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 657 | $(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX))/export_includes)) |
Ying Wang | 5f07480 | 2011-11-08 09:31:21 -0800 | [diff] [blame] | 658 | $(import_includes) : $(import_includes_deps) |
| 659 | @echo Import includes file: $@ |
| 660 | $(hide) mkdir -p $(dir $@) && rm -f $@ |
| 661 | ifdef import_includes_deps |
| 662 | $(hide) for f in $^; do \ |
| 663 | cat $$f >> $@; \ |
| 664 | done |
| 665 | else |
| 666 | $(hide) touch $@ |
| 667 | endif |
| 668 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 669 | ########################################################### |
| 670 | ## Common object handling. |
| 671 | ########################################################### |
| 672 | |
| 673 | # some rules depend on asm_objects being first. If your code depends on |
| 674 | # being first, it's reasonable to require it to be assembly |
Torne (Richard Coles) | a5afbe8 | 2013-08-29 15:36:34 +0100 | [diff] [blame] | 675 | normal_objects := \ |
Ying Wang | dfbe79b | 2012-03-22 11:26:22 -0700 | [diff] [blame] | 676 | $(asm_objects) \ |
| 677 | $(cpp_objects) \ |
| 678 | $(gen_cpp_objects) \ |
| 679 | $(gen_asm_objects) \ |
| 680 | $(c_objects) \ |
| 681 | $(gen_c_objects) \ |
| 682 | $(objc_objects) \ |
| 683 | $(yacc_objects) \ |
| 684 | $(lex_objects) \ |
| 685 | $(proto_generated_objects) \ |
Torne (Richard Coles) | a5afbe8 | 2013-08-29 15:36:34 +0100 | [diff] [blame] | 686 | $(addprefix $(TOPDIR)$(LOCAL_PATH)/,$(LOCAL_PREBUILT_OBJ_FILES)) |
| 687 | |
| 688 | all_objects := $(normal_objects) $(gen_o_objects) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 689 | |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 690 | my_c_includes += $(TOPDIR)$(LOCAL_PATH) $(intermediates) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 691 | |
Ying Wang | 848020f | 2012-08-14 10:13:16 -0700 | [diff] [blame] | 692 | ifndef LOCAL_SDK_VERSION |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 693 | my_c_includes += $(JNI_H_INCLUDE) |
Ying Wang | bce4b75 | 2010-07-22 15:51:56 -0700 | [diff] [blame] | 694 | endif |
| 695 | |
Torne (Richard Coles) | a5afbe8 | 2013-08-29 15:36:34 +0100 | [diff] [blame] | 696 | # all_objects includes gen_o_objects which were part of LOCAL_GENERATED_SOURCES; |
| 697 | # use normal_objects here to avoid creating circular dependencies. This assumes |
| 698 | # that custom build rules which generate .o files don't consume other generated |
| 699 | # sources as input (or if they do they take care of that dependency themselves). |
Ying Wang | ec6d626 | 2014-01-16 16:21:03 -0800 | [diff] [blame] | 700 | $(normal_objects) : | $(my_generated_sources) |
Torne (Richard Coles) | a5afbe8 | 2013-08-29 15:36:34 +0100 | [diff] [blame] | 701 | $(all_objects) : | $(import_includes) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 702 | ALL_C_CPP_ETC_OBJECTS += $(all_objects) |
| 703 | |
| 704 | ########################################################### |
| 705 | ## Copy headers to the install tree |
| 706 | ########################################################### |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 707 | ifndef LOCAL_2ND_ARCH_VAR_PREFIX |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 708 | include $(BUILD_COPY_HEADERS) |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 709 | endif |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 710 | |
| 711 | ########################################################### |
| 712 | # Standard library handling. |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 713 | ########################################################### |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 714 | |
| 715 | ########################################################### |
| 716 | # The list of libraries that this module will link against are in |
| 717 | # these variables. Each is a list of bare module names like "libc libm". |
| 718 | # |
| 719 | # LOCAL_SHARED_LIBRARIES |
| 720 | # LOCAL_STATIC_LIBRARIES |
| 721 | # LOCAL_WHOLE_STATIC_LIBRARIES |
| 722 | # |
| 723 | # We need to convert the bare names into the dependencies that |
| 724 | # we'll use for LOCAL_BUILT_MODULE and LOCAL_INSTALLED_MODULE. |
| 725 | # LOCAL_BUILT_MODULE should depend on the BUILT versions of the |
| 726 | # libraries, so that simply building this module doesn't force |
| 727 | # an install of a library. Similarly, LOCAL_INSTALLED_MODULE |
| 728 | # should depend on the INSTALLED versions of the libraries so |
| 729 | # that they get installed when this module does. |
| 730 | ########################################################### |
| 731 | # NOTE: |
| 732 | # WHOLE_STATIC_LIBRARIES are libraries that are pulled into the |
| 733 | # module without leaving anything out, which is useful for turning |
| 734 | # a collection of .a files into a .so file. Linking against a |
| 735 | # normal STATIC_LIBRARY will only pull in code/symbols that are |
| 736 | # referenced by the module. (see gcc/ld's --whole-archive option) |
| 737 | ########################################################### |
| 738 | |
| 739 | # Get the list of BUILT libraries, which are under |
| 740 | # various intermediates directories. |
| 741 | so_suffix := $($(my_prefix)SHLIB_SUFFIX) |
| 742 | a_suffix := $($(my_prefix)STATIC_LIB_SUFFIX) |
| 743 | |
Ying Wang | 848020f | 2012-08-14 10:13:16 -0700 | [diff] [blame] | 744 | ifdef LOCAL_SDK_VERSION |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 745 | built_shared_libraries := \ |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 746 | $(addprefix $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \ |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 747 | $(addsuffix $(so_suffix), \ |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 748 | $(my_shared_libraries))) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 749 | |
Ying Wang | cce4c97 | 2011-03-03 18:53:53 -0800 | [diff] [blame] | 750 | my_system_shared_libraries_fullpath := \ |
| 751 | $(my_ndk_stl_shared_lib_fullpath) \ |
| 752 | $(addprefix $(my_ndk_version_root)/usr/lib/, \ |
| 753 | $(addsuffix $(so_suffix), $(LOCAL_SYSTEM_SHARED_LIBRARIES))) |
Ying Wang | 1a08100 | 2010-07-13 14:55:47 -0700 | [diff] [blame] | 754 | |
| 755 | built_shared_libraries += $(my_system_shared_libraries_fullpath) |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 756 | my_shared_libraries += $(LOCAL_SYSTEM_SHARED_LIBRARIES) |
Ying Wang | 1a08100 | 2010-07-13 14:55:47 -0700 | [diff] [blame] | 757 | else |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 758 | my_shared_libraries += $(LOCAL_SYSTEM_SHARED_LIBRARIES) |
Ying Wang | 1a08100 | 2010-07-13 14:55:47 -0700 | [diff] [blame] | 759 | built_shared_libraries := \ |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 760 | $(addprefix $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \ |
Ying Wang | 1a08100 | 2010-07-13 14:55:47 -0700 | [diff] [blame] | 761 | $(addsuffix $(so_suffix), \ |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 762 | $(my_shared_libraries))) |
Ying Wang | 1a08100 | 2010-07-13 14:55:47 -0700 | [diff] [blame] | 763 | endif |
| 764 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 765 | built_static_libraries := \ |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 766 | $(foreach lib,$(my_static_libraries), \ |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 767 | $(call intermediates-dir-for, \ |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 768 | STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX))/$(lib)$(a_suffix)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 769 | |
Ying Wang | 848020f | 2012-08-14 10:13:16 -0700 | [diff] [blame] | 770 | ifdef LOCAL_SDK_VERSION |
Ying Wang | cce4c97 | 2011-03-03 18:53:53 -0800 | [diff] [blame] | 771 | built_static_libraries += $(my_ndk_stl_static_lib) |
| 772 | endif |
| 773 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 774 | built_whole_libraries := \ |
Colin Cross | 90353fe | 2014-02-04 14:53:25 -0800 | [diff] [blame] | 775 | $(foreach lib,$(my_whole_static_libraries), \ |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 776 | $(call intermediates-dir-for, \ |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 777 | STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX))/$(lib)$(a_suffix)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 778 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 779 | # We don't care about installed static libraries, since the |
| 780 | # libraries have already been linked into the module at that point. |
| 781 | # We do, however, care about the NOTICE files for any static |
Steve Block | d14d3b4 | 2012-03-01 11:34:41 +0000 | [diff] [blame] | 782 | # libraries that we use. (see notice_files.mk) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 783 | |
| 784 | installed_static_library_notice_file_targets := \ |
Colin Cross | 90353fe | 2014-02-04 14:53:25 -0800 | [diff] [blame] | 785 | $(foreach lib,$(my_static_libraries) $(my_whole_static_libraries), \ |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 786 | NOTICE-$(if $(LOCAL_IS_HOST_MODULE),HOST,TARGET)-STATIC_LIBRARIES-$(lib)) |
| 787 | |
Doug Kwan | 9a8ecf9 | 2011-05-10 21:50:58 -0700 | [diff] [blame] | 788 | # Default is -fno-rtti. |
Doug Kwan | e3c3c6d | 2011-06-07 10:55:48 -0700 | [diff] [blame] | 789 | ifeq ($(strip $(LOCAL_RTTI_FLAG)),) |
| 790 | LOCAL_RTTI_FLAG := -fno-rtti |
| 791 | endif |
Doug Kwan | 9a8ecf9 | 2011-05-10 21:50:58 -0700 | [diff] [blame] | 792 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 793 | ########################################################### |
| 794 | # Rule-specific variable definitions |
| 795 | ########################################################### |
Logan Chien | e6f6543 | 2013-12-10 19:07:41 +0800 | [diff] [blame] | 796 | |
| 797 | ifeq ($(LOCAL_CLANG),true) |
Ying Wang | 1f98283 | 2014-02-06 18:08:44 -0800 | [diff] [blame^] | 798 | my_cflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(my_cflags)) |
| 799 | my_cppflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(my_cppflags)) |
| 800 | my_asflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(my_asflags)) |
| 801 | my_ldflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(my_ldflags)) |
Logan Chien | e6f6543 | 2013-12-10 19:07:41 +0800 | [diff] [blame] | 802 | endif |
| 803 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 804 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_YACCFLAGS := $(LOCAL_YACCFLAGS) |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 805 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASFLAGS := $(my_asflags) |
Ying Wang | 7429e21 | 2012-08-15 10:59:10 -0700 | [diff] [blame] | 806 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CONLYFLAGS := $(LOCAL_CONLYFLAGS) |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 807 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CFLAGS := $(my_cflags) |
| 808 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CPPFLAGS := $(my_cppflags) |
Doug Kwan | 9a8ecf9 | 2011-05-10 21:50:58 -0700 | [diff] [blame] | 809 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RTTI_FLAG := $(LOCAL_RTTI_FLAG) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 810 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEBUG_CFLAGS := $(debug_cflags) |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 811 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_C_INCLUDES := $(my_c_includes) |
Ying Wang | 5f07480 | 2011-11-08 09:31:21 -0800 | [diff] [blame] | 812 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_IMPORT_INCLUDES := $(import_includes) |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 813 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDFLAGS := $(my_ldflags) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 814 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDLIBS := $(LOCAL_LDLIBS) |
Ying Wang | b8e0185 | 2014-01-23 15:09:04 -0800 | [diff] [blame] | 815 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_NO_CRT := $(strip $(LOCAL_NO_CRT) $(LOCAL_NO_CRT_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 816 | |
| 817 | # this is really the way to get the files onto the command line instead |
| 818 | # of using $^, because then LOCAL_ADDITIONAL_DEPENDENCIES doesn't work |
| 819 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_SHARED_LIBRARIES := $(built_shared_libraries) |
| 820 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_STATIC_LIBRARIES := $(built_static_libraries) |
| 821 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_WHOLE_STATIC_LIBRARIES := $(built_whole_libraries) |
| 822 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_OBJECTS := $(all_objects) |
| 823 | |
| 824 | ########################################################### |
| 825 | # Define library dependencies. |
| 826 | ########################################################### |
| 827 | # all_libraries is used for the dependencies on LOCAL_BUILT_MODULE. |
| 828 | all_libraries := \ |
| 829 | $(built_shared_libraries) \ |
| 830 | $(built_static_libraries) \ |
| 831 | $(built_whole_libraries) |
| 832 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 833 | # Also depend on the notice files for any static libraries that |
| 834 | # are linked into this module. This will force them to be installed |
| 835 | # when this module is. |
| 836 | $(LOCAL_INSTALLED_MODULE): | $(installed_static_library_notice_file_targets) |
Ying Wang | 5f07480 | 2011-11-08 09:31:21 -0800 | [diff] [blame] | 837 | |
| 838 | ########################################################### |
| 839 | # Export includes |
| 840 | ########################################################### |
| 841 | export_includes := $(intermediates)/export_includes |
| 842 | $(export_includes): PRIVATE_EXPORT_C_INCLUDE_DIRS := $(LOCAL_EXPORT_C_INCLUDE_DIRS) |
Ying Wang | 68f1c77 | 2012-04-23 21:29:18 -0700 | [diff] [blame] | 843 | $(export_includes) : $(LOCAL_MODULE_MAKEFILE) |
Ying Wang | 5f07480 | 2011-11-08 09:31:21 -0800 | [diff] [blame] | 844 | @echo Export includes file: $< -- $@ |
| 845 | $(hide) mkdir -p $(dir $@) && rm -f $@ |
| 846 | ifdef LOCAL_EXPORT_C_INCLUDE_DIRS |
| 847 | $(hide) for d in $(PRIVATE_EXPORT_C_INCLUDE_DIRS); do \ |
| 848 | echo "-I $$d" >> $@; \ |
| 849 | done |
| 850 | else |
| 851 | $(hide) touch $@ |
| 852 | endif |
Ying Wang | 616e596 | 2012-04-18 17:35:55 -0700 | [diff] [blame] | 853 | |
| 854 | # Make sure export_includes gets generated when you are running mm/mmm |
| 855 | $(LOCAL_BUILT_MODULE) : | $(export_includes) |