blob: d5709cac88208a86f0898ec89565dba35a2153c5 [file] [log] [blame]
The Android Open Source Project88b60792009-03-03 19:28:42 -08001###########################################################
2## Standard rules for building binary object files from
Ying Wangd8d37212014-03-21 16:17:04 -07003## asm/c/cpp/yacc/lex/etc source files.
The Android Open Source Project88b60792009-03-03 19:28:42 -08004##
5## The list of object files is exported in $(all_objects).
6###########################################################
7
Ying Wangd8d37212014-03-21 16:17:04 -07008#######################################
9include $(BUILD_SYSTEM)/base_rules.mk
10#######################################
11
Andrew Hsieh140761af02014-04-25 23:47:10 -070012my_ndk_sysroot :=
13my_ndk_sysroot_include :=
14my_ndk_sysroot_lib :=
Ying Wang848020f2012-08-14 10:13:16 -070015ifdef LOCAL_SDK_VERSION
Ying Wangfe1bfe72012-08-14 11:08:03 -070016 ifdef LOCAL_NDK_VERSION
17 $(error $(LOCAL_PATH): LOCAL_NDK_VERSION is now retired.)
18 endif
Ying Wang1a081002010-07-13 14:55:47 -070019 ifdef LOCAL_IS_HOST_MODULE
Ian Rogers76a6dc32012-10-01 16:36:23 -070020 $(error $(LOCAL_PATH): LOCAL_SDK_VERSION cannot be used in host module)
Ying Wang1a081002010-07-13 14:55:47 -070021 endif
Ying Wang848020f2012-08-14 10:13:16 -070022 my_ndk_source_root := $(HISTORICAL_NDK_VERSIONS_ROOT)/current/sources
Andrew Hsieh140761af02014-04-25 23:47:10 -070023 my_ndk_sysroot := $(HISTORICAL_NDK_VERSIONS_ROOT)/current/platforms/android-$(LOCAL_SDK_VERSION)/arch-$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)
24 my_ndk_sysroot_include := $(my_ndk_sysroot)/usr/include
25 ifeq (x86_64,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
26 my_ndk_sysroot_lib := $(my_ndk_sysroot)/usr/lib64
27 else
28 my_ndk_sysroot_lib := $(my_ndk_sysroot)/usr/lib
29 endif
Ying Wangcce4c972011-03-03 18:53:53 -080030
31 # Set up the NDK stl variant. Starting from NDK-r5 the c++ stl resides in a separate location.
32 # See ndk/docs/CPLUSPLUS-SUPPORT.html
33 my_ndk_stl_include_path :=
34 my_ndk_stl_shared_lib_fullpath :=
35 my_ndk_stl_shared_lib :=
36 my_ndk_stl_static_lib :=
Andrew Hsieh73d800e2014-03-04 17:11:52 +080037 my_ndk_stl_cppflags :=
38 LOCAL_NDK_STL_VARIANT := $(strip $(LOCAL_NDK_STL_VARIANT))
Ying Wangcce4c972011-03-03 18:53:53 -080039 ifeq (,$(LOCAL_NDK_STL_VARIANT))
40 LOCAL_NDK_STL_VARIANT := system
41 endif
Andrew Hsieh73d800e2014-03-04 17:11:52 +080042 ifneq (1,$(words $(filter system stlport_static stlport_shared c++_static c++_shared gnustl_static, $(LOCAL_NDK_STL_VARIANT))))
Ying Wang848020f2012-08-14 10:13:16 -070043 $(error $(LOCAL_PATH): Unknown LOCAL_NDK_STL_VARIANT $(LOCAL_NDK_STL_VARIANT))
Ying Wangcce4c972011-03-03 18:53:53 -080044 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))
Ying Wang6ef65192014-01-15 16:02:16 -080052 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 Wangcce4c972011-03-03 18:53:53 -080053 else
Ying Wang6ef65192014-01-15 16:02:16 -080054 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 Wangcce4c972011-03-03 18:53:53 -080055 my_ndk_stl_shared_lib := -lstlport_shared
56 endif
Andrew Hsieh73d800e2014-03-04 17:11:52 +080057 else # LOCAL_NDK_STL_VARIANT is not stlport_* either
58 ifneq (,$(filter c++_%, $(LOCAL_NDK_STL_VARIANT)))
59 my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/llvm-libc++/libcxx/include \
60 $(my_ndk_source_root)/cxx-stl/llvm-libc++/gabi++/include \
61 $(my_ndk_source_root)/android/support/include
62 ifeq (c++_static,$(LOCAL_NDK_STL_VARIANT))
63 my_ndk_stl_static_lib := $(my_ndk_source_root)/cxx-stl/llvm-libc++/libs/$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)CPU_ABI)/libc++_static.a
64 else
65 my_ndk_stl_shared_lib_fullpath := $(my_ndk_source_root)/cxx-stl/llvm-libc++/libs/$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)CPU_ABI)/libc++_shared.so
66 my_ndk_stl_shared_lib := -lc++_shared
67 endif
68 my_ndk_stl_cppflags := -std=c++11
Ying Wangcce4c972011-03-03 18:53:53 -080069 else
70 # LOCAL_NDK_STL_VARIANT is gnustl_static
Ben Cheng4de6fa42014-04-10 22:46:26 -070071 my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/$($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_NDK_GCC_VERSION)/libs/$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)CPU_ABI)/include \
72 $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/$($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_NDK_GCC_VERSION)/include
73 my_ndk_stl_static_lib := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/$($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_NDK_GCC_VERSION)/libs/$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)CPU_ABI)/libgnustl_static.a
Ying Wangcce4c972011-03-03 18:53:53 -080074 endif
75 endif
Andrew Hsieh73d800e2014-03-04 17:11:52 +080076 endif
Ying Wang1a081002010-07-13 14:55:47 -070077endif
78
Ying Wang704c0c92011-09-15 13:50:52 -070079##################################################
80# Compute the dependency of the shared libraries
81##################################################
82# On the target, we compile with -nostdlib, so we must add in the
83# default system shared libraries, unless they have requested not
84# to by supplying a LOCAL_SYSTEM_SHARED_LIBRARIES value. One would
85# supply that, for example, when building libc itself.
86ifdef LOCAL_IS_HOST_MODULE
87 ifeq ($(LOCAL_SYSTEM_SHARED_LIBRARIES),none)
Ying Wangd8d37212014-03-21 16:17:04 -070088 my_system_shared_libraries :=
89 else
90 my_system_shared_libraries := $(LOCAL_SYSTEM_SHARED_LIBRARIES)
Ying Wang704c0c92011-09-15 13:50:52 -070091 endif
92else
93 ifeq ($(LOCAL_SYSTEM_SHARED_LIBRARIES),none)
Ying Wangd8d37212014-03-21 16:17:04 -070094 my_system_shared_libraries := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES)
95 else
96 my_system_shared_libraries := $(LOCAL_SYSTEM_SHARED_LIBRARIES)
Ying Wang704c0c92011-09-15 13:50:52 -070097 endif
98endif
99
Ying Wang6ef65192014-01-15 16:02:16 -0800100# The following LOCAL_ variables will be modified in this file.
101# Because the same LOCAL_ variables may be used to define modules for both 1st arch and 2nd arch,
102# we can't modify them in place.
Colin Crossf4f2fbe2014-02-12 21:15:12 -0800103my_src_files := $(LOCAL_SRC_FILES)
104my_static_libraries := $(LOCAL_STATIC_LIBRARIES)
105my_whole_static_libraries := $(LOCAL_WHOLE_STATIC_LIBRARIES)
106my_shared_libraries := $(LOCAL_SHARED_LIBRARIES)
107my_cflags := $(LOCAL_CFLAGS)
Ying Wang6ef65192014-01-15 16:02:16 -0800108my_cppflags := $(LOCAL_CPPFLAGS)
Colin Crossf4f2fbe2014-02-12 21:15:12 -0800109my_ldflags := $(LOCAL_LDFLAGS)
110my_asflags := $(LOCAL_ASFLAGS)
Ying Wang6ef65192014-01-15 16:02:16 -0800111my_cc := $(LOCAL_CC)
112my_cxx := $(LOCAL_CXX)
Colin Crossf4f2fbe2014-02-12 21:15:12 -0800113my_c_includes := $(LOCAL_C_INCLUDES)
114my_generated_sources := $(LOCAL_GENERATED_SOURCES)
115
116ifndef LOCAL_IS_HOST_MODULE
Colin Crossf4f2fbe2014-02-12 21:15:12 -0800117my_src_files += $(LOCAL_SRC_FILES_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_SRC_FILES_$(my_32_64_bit_suffix))
118my_shared_libraries += $(LOCAL_SHARED_LIBRARIES_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_SHARED_LIBRARIES_$(my_32_64_bit_suffix))
119my_cflags += $(LOCAL_CFLAGS_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CFLAGS_$(my_32_64_bit_suffix))
120my_cppflags += $(LOCAL_CPPFLAGS_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CPPFLAGS_$(my_32_64_bit_suffix))
121my_ldflags += $(LOCAL_LDFLAGS_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_LDFLAGS_$(my_32_64_bit_suffix))
122my_asflags += $(LOCAL_ASFLAGS_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_ASFLAGS_$(my_32_64_bit_suffix))
123my_c_includes += $(LOCAL_C_INCLUDES_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_C_INCLUDES_$(my_32_64_bit_suffix))
124my_generated_sources += $(LOCAL_GENERATED_SOURCES_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_GENERATED_SOURCES_$(my_32_64_bit_suffix))
125
126# arch-specific static libraries go first so that generic ones can depend on them
127my_static_libraries := $(LOCAL_STATIC_LIBRARIES_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_STATIC_LIBRARIES_$(my_32_64_bit_suffix)) $(my_static_libraries)
128my_whole_static_libraries := $(LOCAL_WHOLE_STATIC_LIBRARIES_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_WHOLE_STATIC_LIBRARIES_$(my_32_64_bit_suffix)) $(my_whole_static_libraries)
Ying Wang6ef65192014-01-15 16:02:16 -0800129
Colin Cross8f47fc32014-01-27 17:34:21 -0800130my_cflags := $(filter-out $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_UNSUPPORTED_CFLAGS),$(my_cflags))
Colin Crossf4f2fbe2014-02-12 21:15:12 -0800131endif
Ying Wang6ef65192014-01-15 16:02:16 -0800132
Ying Wang285045b2013-08-13 12:35:10 -0700133# Add static HAL libraries
134ifdef LOCAL_HAL_STATIC_LIBRARIES
135$(foreach lib, $(LOCAL_HAL_STATIC_LIBRARIES), \
136 $(eval b_lib := $(filter $(lib).%,$(BOARD_HAL_STATIC_LIBRARIES)))\
Ying Wang6ef65192014-01-15 16:02:16 -0800137 $(if $(b_lib), $(eval my_static_libraries += $(b_lib)),\
138 $(eval my_static_libraries += $(lib).default)))
Ying Wang285045b2013-08-13 12:35:10 -0700139b_lib :=
140endif
141
Evgeniy Stepanov6cc9c062012-03-30 12:15:12 +0400142ifeq ($(strip $(LOCAL_ADDRESS_SANITIZER)),true)
143 LOCAL_CLANG := true
Evgeniy Stepanov5d8029f2014-02-21 18:10:53 +0400144 # Frame pointer based unwinder in ASan requires ARM frame setup.
145 LOCAL_ARM_MODE := arm
Ying Wang6ef65192014-01-15 16:02:16 -0800146 my_cflags += $(ADDRESS_SANITIZER_CONFIG_EXTRA_CFLAGS)
147 my_ldflags += $(ADDRESS_SANITIZER_CONFIG_EXTRA_LDFLAGS)
148 my_shared_libraries += $(ADDRESS_SANITIZER_CONFIG_EXTRA_SHARED_LIBRARIES)
149 my_static_libraries += $(ADDRESS_SANITIZER_CONFIG_EXTRA_STATIC_LIBRARIES)
Evgeniy Stepanov6cc9c062012-03-30 12:15:12 +0400150endif
151
Ying Wangba8b3772014-03-10 18:23:08 -0700152ifeq ($(strip $($(LOCAL_2ND_ARCH_VAR_PREFIX)WITHOUT_$(my_prefix)CLANG)),true)
Mike Lockwood051a1742013-06-14 10:52:50 -0700153 LOCAL_CLANG :=
154endif
155
Shih-wei Liaoc8dfc162013-01-27 01:45:59 -0800156# Add in libcompiler_rt for all regular device builds
Mike Lockwooddaf5e222012-10-18 10:17:47 -0700157ifeq (,$(LOCAL_SDK_VERSION)$(LOCAL_IS_HOST_MODULE)$(WITHOUT_LIBCOMPILER_RT))
Ying Wang6ef65192014-01-15 16:02:16 -0800158 my_static_libraries += $(COMPILER_RT_CONFIG_EXTRA_STATIC_LIBRARIES)
Stephen Hinesc72f3962012-06-11 14:53:34 -0700159endif
160
Ying Wangdfbe79b2012-03-22 11:26:22 -0700161my_compiler_dependencies :=
The Android Open Source Project88b60792009-03-03 19:28:42 -0800162
Jing Yu2dcc8062009-09-21 16:31:50 -0700163####################################################
164## Add FDO flags if FDO is turned on and supported
165####################################################
synergydev7c467422013-08-13 17:41:52 -0700166ifneq ($(strip $(LOCAL_FDO_SUPPORT)),)
synergydev4a605762013-08-05 02:44:37 -0700167 ifeq ($(strip $(LOCAL_IS_HOST_MODULE)),)
Ying Wang6ef65192014-01-15 16:02:16 -0800168 my_cflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_FDO_CFLAGS)
169 my_cppflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_FDO_CFLAGS)
170 my_ldflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_FDO_CFLAGS)
synergydev4a605762013-08-05 02:44:37 -0700171 endif
Jing Yu2dcc8062009-09-21 16:31:50 -0700172endif
173
The Android Open Source Project88b60792009-03-03 19:28:42 -0800174###########################################################
Jim Huang20d1ba62010-10-14 16:15:56 +0800175## Explicitly declare assembly-only __ASSEMBLY__ macro for
176## assembly source
177###########################################################
Ying Wang6ef65192014-01-15 16:02:16 -0800178my_asflags += -D__ASSEMBLY__
Jim Huang20d1ba62010-10-14 16:15:56 +0800179
Ying Wangd8d37212014-03-21 16:17:04 -0700180
181##########################################################
182## Set up installed module dependency
183## We cannot compute the full path of the LOCAL_SHARED_LIBRARIES for
184## they may cusomize their install path with LOCAL_MODULE_PATH
185##########################################################
186# Get the list of INSTALLED libraries as module names.
187ifdef LOCAL_SDK_VERSION
188 installed_shared_library_module_names := \
189 $(my_shared_libraries)
190else
191 installed_shared_library_module_names := \
192 $(my_system_shared_libraries) $(my_shared_libraries)
193endif
194installed_shared_library_module_names := $(sort $(installed_shared_library_module_names))
195
196# The real dependency will be added after all Android.mks are loaded and the install paths
197# of the shared libraries are determined.
198ifdef LOCAL_INSTALLED_MODULE
199ifdef installed_shared_library_module_names
200$(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)DEPENDENCIES_ON_SHARED_LIBRARIES += \
201 $(LOCAL_MODULE):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(installed_shared_library_module_names))
202endif
203endif
204
Jim Huang20d1ba62010-10-14 16:15:56 +0800205###########################################################
Ying Wang1a081002010-07-13 14:55:47 -0700206## Define PRIVATE_ variables from global vars
207###########################################################
Ying Wang7fff9a12014-01-09 14:39:41 -0800208ifndef LOCAL_IS_HOST_MODULE
Ying Wang848020f2012-08-14 10:13:16 -0700209ifdef LOCAL_SDK_VERSION
Ying Wang1a081002010-07-13 14:55:47 -0700210my_target_project_includes :=
Andrew Hsieh140761af02014-04-25 23:47:10 -0700211my_target_c_includes := $(my_ndk_stl_include_path) $(my_ndk_sysroot_include)
Andrew Hsieh73d800e2014-03-04 17:11:52 +0800212my_target_global_cppflags := $(my_ndk_stl_cppflags)
Ying Wang1a081002010-07-13 14:55:47 -0700213else
Ying Wang6ef65192014-01-15 16:02:16 -0800214my_target_project_includes := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_PROJECT_INCLUDES)
215my_target_c_includes := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_C_INCLUDES)
Andrew Hsieh73d800e2014-03-04 17:11:52 +0800216my_target_global_cppflags :=
Ying Wangf4723fa2013-08-15 11:01:10 -0700217endif # LOCAL_SDK_VERSION
218
219ifeq ($(LOCAL_CLANG),true)
Ying Wang1f982832014-02-06 18:08:44 -0800220my_target_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_TARGET_GLOBAL_CFLAGS)
Andrew Hsieh73d800e2014-03-04 17:11:52 +0800221my_target_global_cppflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_TARGET_GLOBAL_CPPFLAGS)
Ying Wang1f982832014-02-06 18:08:44 -0800222my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_TARGET_GLOBAL_LDFLAGS)
Ying Wangf4723fa2013-08-15 11:01:10 -0700223my_target_c_includes += $(CLANG_CONFIG_EXTRA_TARGET_C_INCLUDES)
Ying Wangda4bf422012-08-16 16:45:01 -0700224else
Ying Wang6ef65192014-01-15 16:02:16 -0800225my_target_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_CFLAGS)
Andrew Hsieh73d800e2014-03-04 17:11:52 +0800226my_target_global_cppflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_CPPFLAGS)
Ying Wang6ef65192014-01-15 16:02:16 -0800227my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LDFLAGS)
Ying Wangda4bf422012-08-16 16:45:01 -0700228endif # LOCAL_CLANG
Ying Wangda4bf422012-08-16 16:45:01 -0700229
Ying Wang1a081002010-07-13 14:55:47 -0700230$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_PROJECT_INCLUDES := $(my_target_project_includes)
Evgeniy Stepanova7095e92012-03-30 12:18:52 +0400231$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_C_INCLUDES := $(my_target_c_includes)
Ying Wang1a081002010-07-13 14:55:47 -0700232$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CFLAGS := $(my_target_global_cflags)
Logan Chiene6f65432013-12-10 19:07:41 +0800233$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CPPFLAGS := $(my_target_global_cppflags)
234$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(my_target_global_ldflags)
235
Ying Wang7fff9a12014-01-09 14:39:41 -0800236else # LOCAL_IS_HOST_MODULE
237
Logan Chiene6f65432013-12-10 19:07:41 +0800238ifeq ($(LOCAL_CLANG),true)
239my_host_global_cflags := $(CLANG_HOST_GLOBAL_CFLAGS)
240my_host_global_cppflags := $(CLANG_HOST_GLOBAL_CPPFLAGS)
241my_host_global_ldflags := $(CLANG_HOST_GLOBAL_LDFLAGS)
242my_host_c_includes := $(HOST_C_INCLUDES) $(CLANG_CONFIG_EXTRA_HOST_C_INCLUDES)
243else
244my_host_global_cflags := $(HOST_GLOBAL_CFLAGS)
245my_host_global_cppflags := $(HOST_GLOBAL_CPPFLAGS)
246my_host_global_ldflags := $(HOST_GLOBAL_LDFLAGS)
247my_host_c_includes := $(HOST_C_INCLUDES)
248endif # LOCAL_CLANG
249
250$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_C_INCLUDES := $(my_host_c_includes)
251$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_CFLAGS := $(my_host_global_cflags)
252$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_CPPFLAGS := $(my_host_global_cppflags)
253$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_LDFLAGS := $(my_host_global_ldflags)
254endif # LOCAL_IS_HOST_MODULE
Ying Wang1a081002010-07-13 14:55:47 -0700255
256###########################################################
The Android Open Source Project88b60792009-03-03 19:28:42 -0800257## Define PRIVATE_ variables used by multiple module types
258###########################################################
259$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_NO_DEFAULT_COMPILER_FLAGS := \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700260 $(strip $(LOCAL_NO_DEFAULT_COMPILER_FLAGS))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800261
Andrew Hsieh6cea59a2013-08-27 17:33:06 +0800262ifeq ($(strip $(WITH_SYNTAX_CHECK)),)
263 LOCAL_NO_SYNTAX_CHECK := true
264endif
265
Andrew Hsieh906cb782013-09-10 17:37:14 +0800266ifeq ($(strip $(WITH_STATIC_ANALYZER)),)
267 LOCAL_NO_STATIC_ANALYZER := true
268endif
269
Andrew Hsieh6cea59a2013-08-27 17:33:06 +0800270ifneq ($(strip $(LOCAL_IS_HOST_MODULE)),)
271 my_syntax_arch := host
272else
Ying Wang6ef65192014-01-15 16:02:16 -0800273 my_syntax_arch := $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)
Andrew Hsieh6cea59a2013-08-27 17:33:06 +0800274endif
275
Ying Wang6ef65192014-01-15 16:02:16 -0800276ifeq ($(strip $(my_cc)),)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400277 ifeq ($(strip $(LOCAL_CLANG)),true)
Ying Wang6ef65192014-01-15 16:02:16 -0800278 my_cc := $(CLANG)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400279 else
Ying Wang6ef65192014-01-15 16:02:16 -0800280 my_cc := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)CC)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400281 endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800282endif
Andrew Hsieh906cb782013-09-10 17:37:14 +0800283ifneq ($(LOCAL_NO_STATIC_ANALYZER),true)
Ying Wang6ef65192014-01-15 16:02:16 -0800284 my_cc := $(SYNTAX_TOOLS_PREFIX)/ccc-analyzer $(my_syntax_arch) "$(my_cc)"
Andrew Hsieh906cb782013-09-10 17:37:14 +0800285else
Andrew Hsieh6cea59a2013-08-27 17:33:06 +0800286ifneq ($(LOCAL_NO_SYNTAX_CHECK),true)
Ying Wang6ef65192014-01-15 16:02:16 -0800287 my_cc := $(SYNTAX_TOOLS_PREFIX)/ccc-syntax $(my_syntax_arch) "$(my_cc)"
Andrew Hsieh6cea59a2013-08-27 17:33:06 +0800288endif
Andrew Hsieh906cb782013-09-10 17:37:14 +0800289endif
Ying Wang6ef65192014-01-15 16:02:16 -0800290$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CC := $(my_cc)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800291
Ying Wang6ef65192014-01-15 16:02:16 -0800292ifeq ($(strip $(my_cxx)),)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400293 ifeq ($(strip $(LOCAL_CLANG)),true)
Ying Wang6ef65192014-01-15 16:02:16 -0800294 my_cxx := $(CLANG_CXX)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400295 else
Ying Wang6ef65192014-01-15 16:02:16 -0800296 my_cxx := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)CXX)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400297 endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800298endif
Andrew Hsieh906cb782013-09-10 17:37:14 +0800299ifneq ($(LOCAL_NO_STATIC_ANALYZER),true)
Ying Wang6ef65192014-01-15 16:02:16 -0800300 my_cxx := $(SYNTAX_TOOLS_PREFIX)/cxx-analyzer $(my_syntax_arch) "$(my_cxx)"
Andrew Hsieh906cb782013-09-10 17:37:14 +0800301else
Andrew Hsieh6cea59a2013-08-27 17:33:06 +0800302ifneq ($(LOCAL_NO_SYNTAX_CHECK),true)
Ying Wang6ef65192014-01-15 16:02:16 -0800303 my_cxx := $(SYNTAX_TOOLS_PREFIX)/cxx-syntax $(my_syntax_arch) "$(my_cxx)"
Andrew Hsieh6cea59a2013-08-27 17:33:06 +0800304endif
Andrew Hsieh906cb782013-09-10 17:37:14 +0800305endif
Ying Wang6ef65192014-01-15 16:02:16 -0800306$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CXX := $(my_cxx)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800307
308# TODO: support a mix of standard extensions so that this isn't necessary
309LOCAL_CPP_EXTENSION := $(strip $(LOCAL_CPP_EXTENSION))
310ifeq ($(LOCAL_CPP_EXTENSION),)
311 LOCAL_CPP_EXTENSION := .cpp
312endif
313$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CPP_EXTENSION := $(LOCAL_CPP_EXTENSION)
314
315# Certain modules like libdl have to have symbols resolved at runtime and blow
316# up if --no-undefined is passed to the linker.
317ifeq ($(strip $(LOCAL_NO_DEFAULT_COMPILER_FLAGS)),)
318ifeq ($(strip $(LOCAL_ALLOW_UNDEFINED_SYMBOLS)),)
Ying Wang6ef65192014-01-15 16:02:16 -0800319 my_ldflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)NO_UNDEFINED_LDFLAGS)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800320endif
321endif
322
Ying Wangfcdabd42011-04-25 14:22:41 -0700323ifeq (true,$(LOCAL_GROUP_STATIC_LIBRARIES))
324$(LOCAL_BUILT_MODULE): PRIVATE_GROUP_STATIC_LIBRARIES := true
325else
326$(LOCAL_BUILT_MODULE): PRIVATE_GROUP_STATIC_LIBRARIES :=
327endif
328
The Android Open Source Project88b60792009-03-03 19:28:42 -0800329###########################################################
330## Define arm-vs-thumb-mode flags.
331###########################################################
332LOCAL_ARM_MODE := $(strip $(LOCAL_ARM_MODE))
Colin Cross6e087a32014-01-22 17:36:05 -0800333ifeq ($(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH),arm)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800334arm_objects_mode := $(if $(LOCAL_ARM_MODE),$(LOCAL_ARM_MODE),arm)
335normal_objects_mode := $(if $(LOCAL_ARM_MODE),$(LOCAL_ARM_MODE),thumb)
336
Dave Bort95282482009-04-23 18:44:55 -0700337# Read the values from something like TARGET_arm_CFLAGS or
338# TARGET_thumb_CFLAGS. HOST_(arm|thumb)_CFLAGS values aren't
339# actually used (although they are usually empty).
Ying Wang6ef65192014-01-15 16:02:16 -0800340arm_objects_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)$(arm_objects_mode)_CFLAGS)
341normal_objects_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)$(normal_objects_mode)_CFLAGS)
Logan Chiene6f65432013-12-10 19:07:41 +0800342ifeq ($(strip $(LOCAL_CLANG)),true)
Ying Wang1f982832014-02-06 18:08:44 -0800343arm_objects_cflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(arm_objects_cflags))
344normal_objects_cflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(normal_objects_cflags))
Evgeniy Stepanovf50f4c52012-04-05 11:44:37 +0400345endif
346
Chih-Wei Huang0d09e582010-07-09 10:07:52 +0800347else
348arm_objects_mode :=
349normal_objects_mode :=
350arm_objects_cflags :=
351normal_objects_cflags :=
352endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800353
354###########################################################
355## Define per-module debugging flags. Users can turn on
356## debugging for a particular module by setting DEBUG_MODULE_ModuleName
357## to a non-empty value in their environment or buildspec.mk,
358## and setting HOST_/TARGET_CUSTOM_DEBUG_CFLAGS to the
359## debug flags that they want to use.
360###########################################################
361ifdef DEBUG_MODULE_$(strip $(LOCAL_MODULE))
362 debug_cflags := $($(my_prefix)CUSTOM_DEBUG_CFLAGS)
363else
364 debug_cflags :=
365endif
366
Tim Murraya7aa8002012-10-29 16:06:00 -0700367####################################################
368## Compile RenderScript with reflected C++
369####################################################
370
Ying Wangb8e01852014-01-23 15:09:04 -0800371renderscript_sources := $(filter %.rs %.fs,$(my_src_files))
Tim Murraya7aa8002012-10-29 16:06:00 -0700372
373ifneq (,$(renderscript_sources))
374
375renderscript_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(renderscript_sources))
376RenderScript_file_stamp := $(intermediates)/RenderScriptCPP.stamp
377renderscript_intermediate := $(intermediates)/renderscript
378
379ifeq ($(LOCAL_RENDERSCRIPT_CC),)
380LOCAL_RENDERSCRIPT_CC := $(LLVM_RS_CC)
381endif
382
383# Turn on all warnings and warnings as errors for RS compiles.
384# This can be disabled with LOCAL_RENDERSCRIPT_FLAGS := -Wno-error
385renderscript_flags := -Wall -Werror
386renderscript_flags += $(LOCAL_RENDERSCRIPT_FLAGS)
387
Ying Wang6ef65192014-01-15 16:02:16 -0800388renderscript_includes := \
Tim Murraya7aa8002012-10-29 16:06:00 -0700389 $(TOPDIR)external/clang/lib/Headers \
390 $(TOPDIR)frameworks/rs/scriptc \
391 $(LOCAL_RENDERSCRIPT_INCLUDES)
392
393ifneq ($(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE),)
Ying Wang6ef65192014-01-15 16:02:16 -0800394renderscript_includes := $(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE)
Tim Murraya7aa8002012-10-29 16:06:00 -0700395endif
396
Ying Wang6ef65192014-01-15 16:02:16 -0800397$(RenderScript_file_stamp): PRIVATE_RS_INCLUDES := $(renderscript_includes)
Tim Murraya7aa8002012-10-29 16:06:00 -0700398$(RenderScript_file_stamp): PRIVATE_RS_CC := $(LOCAL_RENDERSCRIPT_CC)
399$(RenderScript_file_stamp): PRIVATE_RS_FLAGS := $(renderscript_flags)
400$(RenderScript_file_stamp): PRIVATE_RS_SOURCE_FILES := $(renderscript_sources_fullpath)
401$(RenderScript_file_stamp): PRIVATE_RS_OUTPUT_DIR := $(renderscript_intermediate)
402$(RenderScript_file_stamp): $(renderscript_sources_fullpath) $(LOCAL_RENDERSCRIPT_CC)
403 $(transform-renderscripts-to-cpp-and-bc)
404
405# include the dependency files (.d) generated by llvm-rs-cc.
406renderscript_generated_dep_files := $(addprefix $(renderscript_intermediate)/, \
407 $(patsubst %.fs,%.d, $(patsubst %.rs,%.d, $(notdir $(renderscript_sources)))))
408-include $(renderscript_generated_dep_files)
409
410LOCAL_INTERMEDIATE_TARGETS += $(RenderScript_file_stamp)
411
412rs_generated_cpps := $(addprefix \
413 $(renderscript_intermediate)/ScriptC_,$(patsubst %.fs,%.cpp, $(patsubst %.rs,%.cpp, \
414 $(notdir $(renderscript_sources)))))
415
416$(rs_generated_cpps) : $(RenderScript_file_stamp)
417
Ying Wang6ef65192014-01-15 16:02:16 -0800418my_c_includes += $(renderscript_intermediate)
419my_generated_sources += $(rs_generated_cpps)
Tim Murraya7aa8002012-10-29 16:06:00 -0700420
421endif
422
423
The Android Open Source Project88b60792009-03-03 19:28:42 -0800424###########################################################
425## Stuff source generated from one-off tools
426###########################################################
Ying Wang6ef65192014-01-15 16:02:16 -0800427$(my_generated_sources): PRIVATE_MODULE := $(my_register_name)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800428
Colin Crossd8262642014-01-24 23:17:21 -0800429my_gen_sources_copy := $(patsubst $(generated_sources_dir)/%,$(intermediates)/%,$(filter $(generated_sources_dir)/%,$(my_generated_sources)))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800430
Colin Crossd8262642014-01-24 23:17:21 -0800431$(my_gen_sources_copy): $(intermediates)/% : $(generated_sources_dir)/% | $(ACP)
432 @echo "Copy: $@"
433 $(copy-file-to-target)
434
435my_generated_sources := $(patsubst $(generated_sources_dir)/%,$(intermediates)/%,$(my_generated_sources))
436
437ALL_GENERATED_SOURCES += $(my_generated_sources)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800438
439###########################################################
Ying Wanga5fc87a2010-11-02 18:43:16 -0700440## Compile the .proto files to .cc and then to .o
441###########################################################
Ying Wangb8e01852014-01-23 15:09:04 -0800442proto_sources := $(filter %.proto,$(my_src_files))
Ying Wanga5fc87a2010-11-02 18:43:16 -0700443proto_generated_objects :=
444proto_generated_headers :=
445ifneq ($(proto_sources),)
446proto_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(proto_sources))
Ying Wangead89442014-02-25 11:18:40 -0800447proto_generated_cc_sources_dir := $(generated_sources_dir)/proto
Ying Wanga5fc87a2010-11-02 18:43:16 -0700448proto_generated_cc_sources := $(addprefix $(proto_generated_cc_sources_dir)/, \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700449 $(patsubst %.proto,%.pb.cc,$(proto_sources_fullpath)))
Ying Wangead89442014-02-25 11:18:40 -0800450proto_generated_headers := $(patsubst %.pb.cc,%.pb.h, $(proto_generated_cc_sources))
451proto_generated_obj_dir := $(intermediates)/proto
452proto_generated_objects := $(addprefix $(proto_generated_obj_dir)/, \
453 $(patsubst %.proto,%.pb.o,$(proto_sources_fullpath)))
Ying Wanga5fc87a2010-11-02 18:43:16 -0700454
Ying Wang49085952014-05-06 13:03:32 -0700455# Auto-export the generated proto source dir.
456LOCAL_EXPORT_C_INCLUDE_DIRS += $(proto_generated_cc_sources_dir)
457
Ying Wangead89442014-02-25 11:18:40 -0800458# Ensure the transform-proto-to-cc rule is only defined once in multilib build.
459ifndef $(my_prefix)_$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_proto_defined
Ying Wanga5fc87a2010-11-02 18:43:16 -0700460$(proto_generated_cc_sources): PRIVATE_PROTO_INCLUDES := $(TOP)
461$(proto_generated_cc_sources): PRIVATE_PROTO_CC_OUTPUT_DIR := $(proto_generated_cc_sources_dir)
Ying Wang33c0d952010-11-05 11:30:58 -0700462$(proto_generated_cc_sources): PRIVATE_PROTOC_FLAGS := $(LOCAL_PROTOC_FLAGS)
Ying Wanga5fc87a2010-11-02 18:43:16 -0700463$(proto_generated_cc_sources): $(proto_generated_cc_sources_dir)/%.pb.cc: %.proto $(PROTOC)
464 $(transform-proto-to-cc)
465
Ying Wanga5fc87a2010-11-02 18:43:16 -0700466$(proto_generated_headers): $(proto_generated_cc_sources_dir)/%.pb.h: $(proto_generated_cc_sources_dir)/%.pb.cc
Ying Wang8c556592014-02-13 18:04:00 -0800467 # This is just a dummy rule to make sure gmake doesn't skip updating the dependents.
468 @echo "Updated header file $<."
Ying Wanga5fc87a2010-11-02 18:43:16 -0700469
Ying Wangead89442014-02-25 11:18:40 -0800470$(my_prefix)_$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_proto_defined := true
471endif # transform-proto-to-cc rule included only once
472
Ying Wang022a7b32012-06-13 11:38:10 -0700473$(proto_generated_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
474$(proto_generated_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
Ying Wangead89442014-02-25 11:18:40 -0800475$(proto_generated_objects): $(proto_generated_obj_dir)/%.o: $(proto_generated_cc_sources_dir)/%.cc $(proto_generated_headers)
Ying Wanga5fc87a2010-11-02 18:43:16 -0700476 $(transform-$(PRIVATE_HOST)cpp-to-o)
477-include $(proto_generated_objects:%.o=%.P)
478
Ying Wang6ef65192014-01-15 16:02:16 -0800479my_c_includes += external/protobuf/src $(proto_generated_cc_sources_dir)
480my_cflags += -DGOOGLE_PROTOBUF_NO_RTTI
Ying Wanga5fc87a2010-11-02 18:43:16 -0700481ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),full)
Ying Wang6ef65192014-01-15 16:02:16 -0800482my_static_libraries += libprotobuf-cpp-2.3.0-full
Ying Wanga5fc87a2010-11-02 18:43:16 -0700483else
Ying Wang6ef65192014-01-15 16:02:16 -0800484my_static_libraries += libprotobuf-cpp-2.3.0-lite
Ying Wanga5fc87a2010-11-02 18:43:16 -0700485endif
Ying Wangead89442014-02-25 11:18:40 -0800486endif # $(proto_sources) non-empty
Ying Wanga5fc87a2010-11-02 18:43:16 -0700487
488
489###########################################################
Nicolas Geoffray9484e2e2014-03-03 15:57:06 +0000490## YACC: Compile .y and .yy files to .cpp and the to .o.
The Android Open Source Project88b60792009-03-03 19:28:42 -0800491###########################################################
492
Nicolas Geoffray9484e2e2014-03-03 15:57:06 +0000493y_yacc_sources := $(filter %.y,$(my_src_files))
494y_yacc_cpps := $(addprefix \
495 $(intermediates)/,$(y_yacc_sources:.y=$(LOCAL_CPP_EXTENSION)))
496
497yy_yacc_sources := $(filter %.yy,$(my_src_files))
498yy_yacc_cpps := $(addprefix \
499 $(intermediates)/,$(yy_yacc_sources:.yy=$(LOCAL_CPP_EXTENSION)))
500
501yacc_cpps := $(y_yacc_cpps) $(yy_yacc_cpps)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800502yacc_headers := $(yacc_cpps:$(LOCAL_CPP_EXTENSION)=.h)
503yacc_objects := $(yacc_cpps:$(LOCAL_CPP_EXTENSION)=.o)
504
Nicolas Geoffray9484e2e2014-03-03 15:57:06 +0000505ifneq ($(strip $(y_yacc_cpps)),)
506$(y_yacc_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700507 $(TOPDIR)$(LOCAL_PATH)/%.y \
508 $(lex_cpps) $(LOCAL_ADDITIONAL_DEPENDENCIES)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800509 $(call transform-y-to-cpp,$(PRIVATE_CPP_EXTENSION))
510$(yacc_headers): $(intermediates)/%.h: $(intermediates)/%$(LOCAL_CPP_EXTENSION)
Nicolas Geoffray9484e2e2014-03-03 15:57:06 +0000511endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800512
Nicolas Geoffray9484e2e2014-03-03 15:57:06 +0000513ifneq ($(strip $(yy_yacc_cpps)),)
514$(yy_yacc_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
515 $(TOPDIR)$(LOCAL_PATH)/%.yy \
516 $(lex_cpps) $(LOCAL_ADDITIONAL_DEPENDENCIES)
517 $(call transform-y-to-cpp,$(PRIVATE_CPP_EXTENSION))
518$(yacc_headers): $(intermediates)/%.h: $(intermediates)/%$(LOCAL_CPP_EXTENSION)
519endif
520
521ifneq ($(strip $(yacc_cpps)),)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800522$(yacc_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
523$(yacc_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
524$(yacc_objects): $(intermediates)/%.o: $(intermediates)/%$(LOCAL_CPP_EXTENSION)
525 $(transform-$(PRIVATE_HOST)cpp-to-o)
526endif
527
528###########################################################
Nicolas Geoffray9484e2e2014-03-03 15:57:06 +0000529## LEX: Compile .l and .ll files to .cpp and then to .o.
The Android Open Source Project88b60792009-03-03 19:28:42 -0800530###########################################################
531
Nicolas Geoffray9484e2e2014-03-03 15:57:06 +0000532l_lex_sources := $(filter %.l,$(my_src_files))
533l_lex_cpps := $(addprefix \
534 $(intermediates)/,$(l_lex_sources:.l=$(LOCAL_CPP_EXTENSION)))
535
536ll_lex_sources := $(filter %.ll,$(my_src_files))
537ll_lex_cpps := $(addprefix \
538 $(intermediates)/,$(ll_lex_sources:.ll=$(LOCAL_CPP_EXTENSION)))
539
540lex_cpps := $(l_lex_cpps) $(ll_lex_cpps)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800541lex_objects := $(lex_cpps:$(LOCAL_CPP_EXTENSION)=.o)
542
Nicolas Geoffray9484e2e2014-03-03 15:57:06 +0000543ifneq ($(strip $(l_lex_cpps)),)
544$(l_lex_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700545 $(TOPDIR)$(LOCAL_PATH)/%.l
The Android Open Source Project88b60792009-03-03 19:28:42 -0800546 $(transform-l-to-cpp)
Nicolas Geoffray9484e2e2014-03-03 15:57:06 +0000547endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800548
Nicolas Geoffray9484e2e2014-03-03 15:57:06 +0000549ifneq ($(strip $(ll_lex_cpps)),)
550$(ll_lex_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
551 $(TOPDIR)$(LOCAL_PATH)/%.ll
552 $(transform-l-to-cpp)
553endif
554
555ifneq ($(strip $(lex_cpps)),)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800556$(lex_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
557$(lex_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
558$(lex_objects): $(intermediates)/%.o: \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700559 $(intermediates)/%$(LOCAL_CPP_EXTENSION) \
560 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
561 $(yacc_headers)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800562 $(transform-$(PRIVATE_HOST)cpp-to-o)
563endif
564
565###########################################################
566## C++: Compile .cpp files to .o.
567###########################################################
568
Jeff Browne33ba4c2011-07-11 22:11:46 -0700569# we also do this on host modules, even though
The Android Open Source Project88b60792009-03-03 19:28:42 -0800570# it's not really arm, because there are files that are shared.
Ying Wangb8e01852014-01-23 15:09:04 -0800571cpp_arm_sources := $(patsubst %$(LOCAL_CPP_EXTENSION).arm,%$(LOCAL_CPP_EXTENSION),$(filter %$(LOCAL_CPP_EXTENSION).arm,$(my_src_files)))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800572cpp_arm_objects := $(addprefix $(intermediates)/,$(cpp_arm_sources:$(LOCAL_CPP_EXTENSION)=.o))
573
Ying Wangb8e01852014-01-23 15:09:04 -0800574cpp_normal_sources := $(filter %$(LOCAL_CPP_EXTENSION),$(my_src_files))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800575cpp_normal_objects := $(addprefix $(intermediates)/,$(cpp_normal_sources:$(LOCAL_CPP_EXTENSION)=.o))
576
577$(cpp_arm_objects): PRIVATE_ARM_MODE := $(arm_objects_mode)
578$(cpp_arm_objects): PRIVATE_ARM_CFLAGS := $(arm_objects_cflags)
579$(cpp_normal_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
580$(cpp_normal_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
581
582cpp_objects := $(cpp_arm_objects) $(cpp_normal_objects)
583
584ifneq ($(strip $(cpp_objects)),)
585$(cpp_objects): $(intermediates)/%.o: \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700586 $(TOPDIR)$(LOCAL_PATH)/%$(LOCAL_CPP_EXTENSION) \
Ying Wang9c3aa052013-02-20 13:34:05 -0800587 $(yacc_cpps) $(proto_generated_headers) \
588 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
589 | $(my_compiler_dependencies)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800590 $(transform-$(PRIVATE_HOST)cpp-to-o)
591-include $(cpp_objects:%.o=%.P)
592endif
593
594###########################################################
595## C++: Compile generated .cpp files to .o.
596###########################################################
597
Ying Wangec6d6262014-01-16 16:21:03 -0800598gen_cpp_sources := $(filter %$(LOCAL_CPP_EXTENSION),$(my_generated_sources))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800599gen_cpp_objects := $(gen_cpp_sources:%$(LOCAL_CPP_EXTENSION)=%.o)
600
601ifneq ($(strip $(gen_cpp_objects)),)
602# Compile all generated files as thumb.
603# TODO: support compiling certain generated files as arm.
604$(gen_cpp_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
605$(gen_cpp_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400606$(gen_cpp_objects): $(intermediates)/%.o: \
607 $(intermediates)/%$(LOCAL_CPP_EXTENSION) $(yacc_cpps) \
Ying Wang9c3aa052013-02-20 13:34:05 -0800608 $(proto_generated_headers) \
609 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
610 | $(my_compiler_dependencies)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800611 $(transform-$(PRIVATE_HOST)cpp-to-o)
612-include $(gen_cpp_objects:%.o=%.P)
613endif
614
615###########################################################
616## S: Compile generated .S and .s files to .o.
617###########################################################
618
Ying Wangec6d6262014-01-16 16:21:03 -0800619gen_S_sources := $(filter %.S,$(my_generated_sources))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800620gen_S_objects := $(gen_S_sources:%.S=%.o)
621
622ifneq ($(strip $(gen_S_sources)),)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400623$(gen_S_objects): $(intermediates)/%.o: $(intermediates)/%.S \
Ying Wang9c3aa052013-02-20 13:34:05 -0800624 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
625 | $(my_compiler_dependencies)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800626 $(transform-$(PRIVATE_HOST)s-to-o)
627-include $(gen_S_objects:%.o=%.P)
628endif
629
Ying Wangec6d6262014-01-16 16:21:03 -0800630gen_s_sources := $(filter %.s,$(my_generated_sources))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800631gen_s_objects := $(gen_s_sources:%.s=%.o)
632
633ifneq ($(strip $(gen_s_objects)),)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400634$(gen_s_objects): $(intermediates)/%.o: $(intermediates)/%.s \
Ying Wang9c3aa052013-02-20 13:34:05 -0800635 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
636 | $(my_compiler_dependencies)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800637 $(transform-$(PRIVATE_HOST)s-to-o-no-deps)
638-include $(gen_s_objects:%.o=%.P)
639endif
640
641gen_asm_objects := $(gen_S_objects) $(gen_s_objects)
642
643###########################################################
Torne (Richard Coles)aace2022013-02-21 14:01:35 +0000644## o: Include generated .o files in output.
645###########################################################
646
Ying Wangec6d6262014-01-16 16:21:03 -0800647gen_o_objects := $(filter %.o,$(my_generated_sources))
Torne (Richard Coles)aace2022013-02-21 14:01:35 +0000648
649###########################################################
The Android Open Source Project88b60792009-03-03 19:28:42 -0800650## C: Compile .c files to .o.
651###########################################################
652
Ying Wangb8e01852014-01-23 15:09:04 -0800653c_arm_sources := $(patsubst %.c.arm,%.c,$(filter %.c.arm,$(my_src_files)))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800654c_arm_objects := $(addprefix $(intermediates)/,$(c_arm_sources:.c=.o))
655
Ying Wangb8e01852014-01-23 15:09:04 -0800656c_normal_sources := $(filter %.c,$(my_src_files))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800657c_normal_objects := $(addprefix $(intermediates)/,$(c_normal_sources:.c=.o))
658
659$(c_arm_objects): PRIVATE_ARM_MODE := $(arm_objects_mode)
660$(c_arm_objects): PRIVATE_ARM_CFLAGS := $(arm_objects_cflags)
661$(c_normal_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
662$(c_normal_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
663
664c_objects := $(c_arm_objects) $(c_normal_objects)
665
666ifneq ($(strip $(c_objects)),)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400667$(c_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.c $(yacc_cpps) $(proto_generated_headers) \
Ying Wang9c3aa052013-02-20 13:34:05 -0800668 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
669 | $(my_compiler_dependencies)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800670 $(transform-$(PRIVATE_HOST)c-to-o)
671-include $(c_objects:%.o=%.P)
672endif
673
674###########################################################
Jack Paleviche7b3e2c2009-05-04 14:32:44 -0700675## C: Compile generated .c files to .o.
676###########################################################
677
Ying Wangec6d6262014-01-16 16:21:03 -0800678gen_c_sources := $(filter %.c,$(my_generated_sources))
Jack Paleviche7b3e2c2009-05-04 14:32:44 -0700679gen_c_objects := $(gen_c_sources:%.c=%.o)
680
681ifneq ($(strip $(gen_c_objects)),)
682# Compile all generated files as thumb.
683# TODO: support compiling certain generated files as arm.
684$(gen_c_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
685$(gen_c_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400686$(gen_c_objects): $(intermediates)/%.o: $(intermediates)/%.c $(yacc_cpps) $(proto_generated_headers) \
Ying Wang9c3aa052013-02-20 13:34:05 -0800687 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
688 | $(my_compiler_dependencies)
Jack Paleviche7b3e2c2009-05-04 14:32:44 -0700689 $(transform-$(PRIVATE_HOST)c-to-o)
690-include $(gen_c_objects:%.o=%.P)
691endif
692
693###########################################################
David 'Digit' Turner5dbb5292009-05-14 16:00:09 +0200694## ObjC: Compile .m files to .o
695###########################################################
696
Ying Wangb8e01852014-01-23 15:09:04 -0800697objc_sources := $(filter %.m,$(my_src_files))
David 'Digit' Turner5dbb5292009-05-14 16:00:09 +0200698objc_objects := $(addprefix $(intermediates)/,$(objc_sources:.m=.o))
699
700ifneq ($(strip $(objc_objects)),)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400701$(objc_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.m $(yacc_cpps) $(proto_generated_headers) \
Ying Wang9c3aa052013-02-20 13:34:05 -0800702 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
703 | $(my_compiler_dependencies)
David 'Digit' Turner5dbb5292009-05-14 16:00:09 +0200704 $(transform-$(PRIVATE_HOST)m-to-o)
705-include $(objc_objects:%.o=%.P)
706endif
707
708###########################################################
The Android Open Source Project88b60792009-03-03 19:28:42 -0800709## AS: Compile .S files to .o.
710###########################################################
711
Ying Wangb8e01852014-01-23 15:09:04 -0800712asm_sources_S := $(filter %.S,$(my_src_files))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800713asm_objects_S := $(addprefix $(intermediates)/,$(asm_sources_S:.S=.o))
714
715ifneq ($(strip $(asm_objects_S)),)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400716$(asm_objects_S): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.S \
Ying Wang9c3aa052013-02-20 13:34:05 -0800717 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
718 | $(my_compiler_dependencies)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800719 $(transform-$(PRIVATE_HOST)s-to-o)
720-include $(asm_objects_S:%.o=%.P)
721endif
722
Ying Wangb8e01852014-01-23 15:09:04 -0800723asm_sources_s := $(filter %.s,$(my_src_files))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800724asm_objects_s := $(addprefix $(intermediates)/,$(asm_sources_s:.s=.o))
725
726ifneq ($(strip $(asm_objects_s)),)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400727$(asm_objects_s): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.s \
Ying Wang9c3aa052013-02-20 13:34:05 -0800728 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
729 | $(my_compiler_dependencies)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800730 $(transform-$(PRIVATE_HOST)s-to-o-no-deps)
731-include $(asm_objects_s:%.o=%.P)
732endif
733
734asm_objects := $(asm_objects_S) $(asm_objects_s)
735
736
Ying Wang5f074802011-11-08 09:31:21 -0800737####################################################
738## Import includes
739####################################################
740import_includes := $(intermediates)/import_includes
741import_includes_deps := $(strip \
742 $(foreach l, $(installed_shared_library_module_names), \
Ying Wang6ef65192014-01-15 16:02:16 -0800743 $(call intermediates-dir-for,SHARED_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX))/export_includes) \
Colin Cross90353fe2014-02-04 14:53:25 -0800744 $(foreach l, $(my_static_libraries) $(my_whole_static_libraries), \
Ying Wang6ef65192014-01-15 16:02:16 -0800745 $(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX))/export_includes))
Ying Wang5f074802011-11-08 09:31:21 -0800746$(import_includes) : $(import_includes_deps)
747 @echo Import includes file: $@
748 $(hide) mkdir -p $(dir $@) && rm -f $@
749ifdef import_includes_deps
750 $(hide) for f in $^; do \
751 cat $$f >> $@; \
752 done
753else
754 $(hide) touch $@
755endif
756
The Android Open Source Project88b60792009-03-03 19:28:42 -0800757###########################################################
758## Common object handling.
759###########################################################
760
761# some rules depend on asm_objects being first. If your code depends on
762# being first, it's reasonable to require it to be assembly
Torne (Richard Coles)a5afbe82013-08-29 15:36:34 +0100763normal_objects := \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700764 $(asm_objects) \
765 $(cpp_objects) \
766 $(gen_cpp_objects) \
767 $(gen_asm_objects) \
768 $(c_objects) \
769 $(gen_c_objects) \
770 $(objc_objects) \
771 $(yacc_objects) \
772 $(lex_objects) \
773 $(proto_generated_objects) \
Torne (Richard Coles)a5afbe82013-08-29 15:36:34 +0100774 $(addprefix $(TOPDIR)$(LOCAL_PATH)/,$(LOCAL_PREBUILT_OBJ_FILES))
775
776all_objects := $(normal_objects) $(gen_o_objects)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800777
Colin Cross2d206702014-02-13 13:41:52 -0800778my_c_includes += $(TOPDIR)$(LOCAL_PATH) $(intermediates) $(generated_sources_dir)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800779
Ying Wang848020f2012-08-14 10:13:16 -0700780ifndef LOCAL_SDK_VERSION
Ying Wang6ef65192014-01-15 16:02:16 -0800781 my_c_includes += $(JNI_H_INCLUDE)
Ying Wangbce4b752010-07-22 15:51:56 -0700782endif
783
Torne (Richard Coles)a5afbe82013-08-29 15:36:34 +0100784# all_objects includes gen_o_objects which were part of LOCAL_GENERATED_SOURCES;
785# use normal_objects here to avoid creating circular dependencies. This assumes
786# that custom build rules which generate .o files don't consume other generated
787# sources as input (or if they do they take care of that dependency themselves).
Ying Wangec6d6262014-01-16 16:21:03 -0800788$(normal_objects) : | $(my_generated_sources)
Torne (Richard Coles)a5afbe82013-08-29 15:36:34 +0100789$(all_objects) : | $(import_includes)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800790ALL_C_CPP_ETC_OBJECTS += $(all_objects)
791
The Android Open Source Project88b60792009-03-03 19:28:42 -0800792
793###########################################################
794# Standard library handling.
The Android Open Source Project88b60792009-03-03 19:28:42 -0800795###########################################################
The Android Open Source Project88b60792009-03-03 19:28:42 -0800796
797###########################################################
798# The list of libraries that this module will link against are in
799# these variables. Each is a list of bare module names like "libc libm".
800#
801# LOCAL_SHARED_LIBRARIES
802# LOCAL_STATIC_LIBRARIES
803# LOCAL_WHOLE_STATIC_LIBRARIES
804#
805# We need to convert the bare names into the dependencies that
806# we'll use for LOCAL_BUILT_MODULE and LOCAL_INSTALLED_MODULE.
807# LOCAL_BUILT_MODULE should depend on the BUILT versions of the
808# libraries, so that simply building this module doesn't force
809# an install of a library. Similarly, LOCAL_INSTALLED_MODULE
810# should depend on the INSTALLED versions of the libraries so
811# that they get installed when this module does.
812###########################################################
813# NOTE:
814# WHOLE_STATIC_LIBRARIES are libraries that are pulled into the
815# module without leaving anything out, which is useful for turning
816# a collection of .a files into a .so file. Linking against a
817# normal STATIC_LIBRARY will only pull in code/symbols that are
818# referenced by the module. (see gcc/ld's --whole-archive option)
819###########################################################
820
821# Get the list of BUILT libraries, which are under
822# various intermediates directories.
823so_suffix := $($(my_prefix)SHLIB_SUFFIX)
824a_suffix := $($(my_prefix)STATIC_LIB_SUFFIX)
825
Ying Wang848020f2012-08-14 10:13:16 -0700826ifdef LOCAL_SDK_VERSION
The Android Open Source Project88b60792009-03-03 19:28:42 -0800827built_shared_libraries := \
Ying Wang6ef65192014-01-15 16:02:16 -0800828 $(addprefix $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800829 $(addsuffix $(so_suffix), \
Ying Wang6ef65192014-01-15 16:02:16 -0800830 $(my_shared_libraries)))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800831
Ying Wangd8d37212014-03-21 16:17:04 -0700832# Add the NDK libraries to the built module dependency
Ying Wangcce4c972011-03-03 18:53:53 -0800833my_system_shared_libraries_fullpath := \
834 $(my_ndk_stl_shared_lib_fullpath) \
Andrew Hsieh140761af02014-04-25 23:47:10 -0700835 $(addprefix $(my_ndk_sysroot_lib)/, \
Ying Wangd8d37212014-03-21 16:17:04 -0700836 $(addsuffix $(so_suffix), $(my_system_shared_libraries)))
Ying Wang1a081002010-07-13 14:55:47 -0700837
838built_shared_libraries += $(my_system_shared_libraries_fullpath)
Ying Wang1a081002010-07-13 14:55:47 -0700839else
Ying Wang1a081002010-07-13 14:55:47 -0700840built_shared_libraries := \
Ying Wang6ef65192014-01-15 16:02:16 -0800841 $(addprefix $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
Ying Wang1a081002010-07-13 14:55:47 -0700842 $(addsuffix $(so_suffix), \
Ying Wangd8d37212014-03-21 16:17:04 -0700843 $(installed_shared_library_module_names)))
Ying Wang1a081002010-07-13 14:55:47 -0700844endif
845
The Android Open Source Project88b60792009-03-03 19:28:42 -0800846built_static_libraries := \
Ying Wang6ef65192014-01-15 16:02:16 -0800847 $(foreach lib,$(my_static_libraries), \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800848 $(call intermediates-dir-for, \
Ying Wang6ef65192014-01-15 16:02:16 -0800849 STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX))/$(lib)$(a_suffix))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800850
Ying Wang848020f2012-08-14 10:13:16 -0700851ifdef LOCAL_SDK_VERSION
Ying Wangcce4c972011-03-03 18:53:53 -0800852built_static_libraries += $(my_ndk_stl_static_lib)
853endif
854
The Android Open Source Project88b60792009-03-03 19:28:42 -0800855built_whole_libraries := \
Colin Cross90353fe2014-02-04 14:53:25 -0800856 $(foreach lib,$(my_whole_static_libraries), \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800857 $(call intermediates-dir-for, \
Ying Wang6ef65192014-01-15 16:02:16 -0800858 STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX))/$(lib)$(a_suffix))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800859
The Android Open Source Project88b60792009-03-03 19:28:42 -0800860# We don't care about installed static libraries, since the
861# libraries have already been linked into the module at that point.
862# We do, however, care about the NOTICE files for any static
Steve Blockd14d3b42012-03-01 11:34:41 +0000863# libraries that we use. (see notice_files.mk)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800864
865installed_static_library_notice_file_targets := \
Colin Cross90353fe2014-02-04 14:53:25 -0800866 $(foreach lib,$(my_static_libraries) $(my_whole_static_libraries), \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800867 NOTICE-$(if $(LOCAL_IS_HOST_MODULE),HOST,TARGET)-STATIC_LIBRARIES-$(lib))
868
Doug Kwan9a8ecf92011-05-10 21:50:58 -0700869# Default is -fno-rtti.
Doug Kwane3c3c6d2011-06-07 10:55:48 -0700870ifeq ($(strip $(LOCAL_RTTI_FLAG)),)
871LOCAL_RTTI_FLAG := -fno-rtti
872endif
Doug Kwan9a8ecf92011-05-10 21:50:58 -0700873
The Android Open Source Project88b60792009-03-03 19:28:42 -0800874###########################################################
875# Rule-specific variable definitions
876###########################################################
Logan Chiene6f65432013-12-10 19:07:41 +0800877
878ifeq ($(LOCAL_CLANG),true)
Ying Wang1f982832014-02-06 18:08:44 -0800879my_cflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(my_cflags))
880my_cppflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(my_cppflags))
881my_asflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(my_asflags))
882my_ldflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(my_ldflags))
Logan Chiene6f65432013-12-10 19:07:41 +0800883endif
884
The Android Open Source Project88b60792009-03-03 19:28:42 -0800885$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_YACCFLAGS := $(LOCAL_YACCFLAGS)
Ying Wang6ef65192014-01-15 16:02:16 -0800886$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASFLAGS := $(my_asflags)
Ying Wang7429e212012-08-15 10:59:10 -0700887$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CONLYFLAGS := $(LOCAL_CONLYFLAGS)
Ying Wang6ef65192014-01-15 16:02:16 -0800888$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CFLAGS := $(my_cflags)
889$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CPPFLAGS := $(my_cppflags)
Doug Kwan9a8ecf92011-05-10 21:50:58 -0700890$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RTTI_FLAG := $(LOCAL_RTTI_FLAG)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800891$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEBUG_CFLAGS := $(debug_cflags)
Ying Wang6ef65192014-01-15 16:02:16 -0800892$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_C_INCLUDES := $(my_c_includes)
Ying Wang5f074802011-11-08 09:31:21 -0800893$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_IMPORT_INCLUDES := $(import_includes)
Ying Wang6ef65192014-01-15 16:02:16 -0800894$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDFLAGS := $(my_ldflags)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800895$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDLIBS := $(LOCAL_LDLIBS)
Ying Wangb8e01852014-01-23 15:09:04 -0800896$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_NO_CRT := $(strip $(LOCAL_NO_CRT) $(LOCAL_NO_CRT_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800897
898# this is really the way to get the files onto the command line instead
899# of using $^, because then LOCAL_ADDITIONAL_DEPENDENCIES doesn't work
900$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_SHARED_LIBRARIES := $(built_shared_libraries)
901$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_STATIC_LIBRARIES := $(built_static_libraries)
902$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_WHOLE_STATIC_LIBRARIES := $(built_whole_libraries)
903$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_OBJECTS := $(all_objects)
904
905###########################################################
906# Define library dependencies.
907###########################################################
908# all_libraries is used for the dependencies on LOCAL_BUILT_MODULE.
909all_libraries := \
910 $(built_shared_libraries) \
911 $(built_static_libraries) \
912 $(built_whole_libraries)
913
The Android Open Source Project88b60792009-03-03 19:28:42 -0800914# Also depend on the notice files for any static libraries that
915# are linked into this module. This will force them to be installed
916# when this module is.
917$(LOCAL_INSTALLED_MODULE): | $(installed_static_library_notice_file_targets)
Ying Wang5f074802011-11-08 09:31:21 -0800918
919###########################################################
920# Export includes
921###########################################################
922export_includes := $(intermediates)/export_includes
923$(export_includes): PRIVATE_EXPORT_C_INCLUDE_DIRS := $(LOCAL_EXPORT_C_INCLUDE_DIRS)
Ying Wang49085952014-05-06 13:03:32 -0700924# Make sure .pb.h are already generated before any dependent source files get compiled.
925$(export_includes) : $(LOCAL_MODULE_MAKEFILE) $(proto_generated_headers)
Ying Wang5f074802011-11-08 09:31:21 -0800926 @echo Export includes file: $< -- $@
927 $(hide) mkdir -p $(dir $@) && rm -f $@
928ifdef LOCAL_EXPORT_C_INCLUDE_DIRS
929 $(hide) for d in $(PRIVATE_EXPORT_C_INCLUDE_DIRS); do \
930 echo "-I $$d" >> $@; \
931 done
932else
933 $(hide) touch $@
934endif
Ying Wang616e5962012-04-18 17:35:55 -0700935
936# Make sure export_includes gets generated when you are running mm/mmm
937$(LOCAL_BUILT_MODULE) : | $(export_includes)