blob: dd68feec3f84cc85b2a38afcb9365c6634543fa4 [file] [log] [blame]
The Android Open Source Project88b60792009-03-03 19:28:42 -08001###########################################################
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 Wang1a081002010-07-13 14:55:47 -07008my_ndk_version_root :=
Ying Wang848020f2012-08-14 10:13:16 -07009ifdef LOCAL_SDK_VERSION
Ying Wangfe1bfe72012-08-14 11:08:03 -070010 ifdef LOCAL_NDK_VERSION
11 $(error $(LOCAL_PATH): LOCAL_NDK_VERSION is now retired.)
12 endif
Ying Wang1a081002010-07-13 14:55:47 -070013 ifdef LOCAL_IS_HOST_MODULE
Ian Rogers76a6dc32012-10-01 16:36:23 -070014 $(error $(LOCAL_PATH): LOCAL_SDK_VERSION cannot be used in host module)
Ying Wang1a081002010-07-13 14:55:47 -070015 endif
Ying Wang848020f2012-08-14 10:13:16 -070016 my_ndk_source_root := $(HISTORICAL_NDK_VERSIONS_ROOT)/current/sources
17 my_ndk_version_root := $(HISTORICAL_NDK_VERSIONS_ROOT)/current/platforms/android-$(LOCAL_SDK_VERSION)/arch-$(TARGET_ARCH)
Ying Wangcce4c972011-03-03 18:53:53 -080018
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 Wang848020f2012-08-14 10:13:16 -070029 $(error $(LOCAL_PATH): Unknown LOCAL_NDK_STL_VARIANT $(LOCAL_NDK_STL_VARIANT))
Ying Wangcce4c972011-03-03 18:53:53 -080030 endif
31 ifeq (system,$(LOCAL_NDK_STL_VARIANT))
32 my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/system/include
33 # for "system" variant, the shared library exists in the system library and -lstdc++ is added by default.
34 else # LOCAL_NDK_STL_VARIANT is not system
35 ifneq (,$(filter stlport_%, $(LOCAL_NDK_STL_VARIANT)))
36 my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/stlport/stlport
37 ifeq (stlport_static,$(LOCAL_NDK_STL_VARIANT))
38 my_ndk_stl_static_lib := $(my_ndk_source_root)/cxx-stl/stlport/libs/$(TARGET_CPU_ABI)/libstlport_static.a
39 else
40 my_ndk_stl_shared_lib_fullpath := $(my_ndk_source_root)/cxx-stl/stlport/libs/$(TARGET_CPU_ABI)/libstlport_shared.so
41 my_ndk_stl_shared_lib := -lstlport_shared
42 endif
43 else
44 # LOCAL_NDK_STL_VARIANT is gnustl_static
Ying Wangd9020c22011-09-07 14:31:47 -070045 my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/libs/$(TARGET_CPU_ABI)/include \
46 $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/include
Ying Wang848020f2012-08-14 10:13:16 -070047 my_ndk_stl_static_lib := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/libs/$(TARGET_CPU_ABI)/libgnustl_static.a
Ying Wangcce4c972011-03-03 18:53:53 -080048 endif
49 endif
Ying Wang1a081002010-07-13 14:55:47 -070050endif
51
Ying Wang704c0c92011-09-15 13:50:52 -070052##################################################
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.
59ifdef LOCAL_IS_HOST_MODULE
60 ifeq ($(LOCAL_SYSTEM_SHARED_LIBRARIES),none)
61 LOCAL_SYSTEM_SHARED_LIBRARIES :=
62 endif
63else
64 ifeq ($(LOCAL_SYSTEM_SHARED_LIBRARIES),none)
65 LOCAL_SYSTEM_SHARED_LIBRARIES := $(TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES)
66 endif
67endif
68
Ying Wangc04a8282013-04-10 22:11:43 +000069# Logging used to be part of libcutils (target) and libutils (sim);
70# hack modules that use those other libs to also include liblog.
71# All of this complexity is to make sure that liblog only appears
72# once, and appears just before libcutils or libutils on the link
73# line.
74# TODO: remove this hack and change all modules to use liblog
75# when necessary.
76define insert-liblog
77 $(if $(filter liblog,$(1)),$(1), \
78 $(if $(filter libcutils,$(1)), \
79 $(patsubst libcutils,liblog libcutils,$(1)) \
80 , \
81 $(patsubst libutils,liblog libutils,$(1)) \
82 ) \
83 )
84endef
85ifneq (,$(filter libcutils libutils,$(LOCAL_SHARED_LIBRARIES)))
86 LOCAL_SHARED_LIBRARIES := $(call insert-liblog,$(LOCAL_SHARED_LIBRARIES))
87endif
88ifneq (,$(filter libcutils libutils,$(LOCAL_STATIC_LIBRARIES)))
89 LOCAL_STATIC_LIBRARIES := $(call insert-liblog,$(LOCAL_STATIC_LIBRARIES))
90endif
91ifneq (,$(filter libcutils libutils,$(LOCAL_WHOLE_STATIC_LIBRARIES)))
92 LOCAL_WHOLE_STATIC_LIBRARIES := $(call insert-liblog,$(LOCAL_WHOLE_STATIC_LIBRARIES))
93endif
94
Ying Wang848020f2012-08-14 10:13:16 -070095ifdef LOCAL_SDK_VERSION
Ying Wang704c0c92011-09-15 13:50:52 -070096 # Get the list of INSTALLED libraries as module names.
Ian Rogers76a6dc32012-10-01 16:36:23 -070097 # We cannot compute the full path of the LOCAL_SHARED_LIBRARIES for
Ying Wang704c0c92011-09-15 13:50:52 -070098 # they may cusomize their install path with LOCAL_MODULE_PATH
99 installed_shared_library_module_names := \
100 $(LOCAL_SHARED_LIBRARIES)
101else
102 installed_shared_library_module_names := \
103 $(LOCAL_SYSTEM_SHARED_LIBRARIES) $(LOCAL_SHARED_LIBRARIES)
104endif
Ying Wang9485a572013-02-22 14:32:30 -0800105installed_shared_library_module_names := $(sort $(installed_shared_library_module_names))
Ying Wang704c0c92011-09-15 13:50:52 -0700106
The Android Open Source Project88b60792009-03-03 19:28:42 -0800107#######################################
108include $(BUILD_SYSTEM)/base_rules.mk
109#######################################
Evgeniy Stepanov6cc9c062012-03-30 12:15:12 +0400110
Ying Wang9485a572013-02-22 14:32:30 -0800111# The real dependency will be added after all Android.mks are loaded and the install paths
112# of the shared libraries are determined.
113ifdef LOCAL_INSTALLED_MODULE
114ifdef installed_shared_library_module_names
115$(my_prefix)DEPENDENCIES_ON_SHARED_LIBRARIES += $(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(installed_shared_library_module_names))
116endif
117endif
118
Evgeniy Stepanov6cc9c062012-03-30 12:15:12 +0400119ifeq ($(strip $(LOCAL_ADDRESS_SANITIZER)),true)
120 LOCAL_CLANG := true
121 LOCAL_CFLAGS += $(ADDRESS_SANITIZER_CONFIG_EXTRA_CFLAGS)
122 LOCAL_LDFLAGS += $(ADDRESS_SANITIZER_CONFIG_EXTRA_LDFLAGS)
123 LOCAL_SHARED_LIBRARIES += $(ADDRESS_SANITIZER_CONFIG_EXTRA_SHARED_LIBRARIES)
124 LOCAL_STATIC_LIBRARIES += $(ADDRESS_SANITIZER_CONFIG_EXTRA_STATIC_LIBRARIES)
125endif
126
Shih-wei Liaoc8dfc162013-01-27 01:45:59 -0800127# Add in libcompiler_rt for all regular device builds
Mike Lockwooddaf5e222012-10-18 10:17:47 -0700128ifeq (,$(LOCAL_SDK_VERSION)$(LOCAL_IS_HOST_MODULE)$(WITHOUT_LIBCOMPILER_RT))
Stephen Hinesc72f3962012-06-11 14:53:34 -0700129 LOCAL_STATIC_LIBRARIES += $(COMPILER_RT_CONFIG_EXTRA_STATIC_LIBRARIES)
130endif
131
Ying Wangdfbe79b2012-03-22 11:26:22 -0700132my_compiler_dependencies :=
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400133ifeq ($(strip $(LOCAL_CLANG)),true)
134 LOCAL_CFLAGS += $(CLANG_CONFIG_EXTRA_CFLAGS)
Ying Wang65d78522012-08-10 16:30:42 -0700135 LOCAL_ASFLAGS += $(CLANG_CONFIG_EXTRA_ASFLAGS)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400136 LOCAL_LDFLAGS += $(CLANG_CONFIG_EXTRA_LDFLAGS)
Ying Wangdfbe79b2012-03-22 11:26:22 -0700137 my_compiler_dependencies := $(CLANG) $(CLANG_CXX)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400138endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800139
Jing Yu2dcc8062009-09-21 16:31:50 -0700140####################################################
141## Add FDO flags if FDO is turned on and supported
142####################################################
143ifeq ($(strip $(LOCAL_NO_FDO_SUPPORT)),)
144 LOCAL_CFLAGS += $(TARGET_FDO_CFLAGS)
145 LOCAL_CPPFLAGS += $(TARGET_FDO_CFLAGS)
146 LOCAL_LDFLAGS += $(TARGET_FDO_CFLAGS)
147endif
148
Kito Cheng70dc3e12012-06-15 15:15:50 +0800149####################################################
150## Add profiling flags if aprof is turned on
151####################################################
152ifeq ($(strip $(LOCAL_ENABLE_APROF)),true)
153 # -ffunction-sections and -fomit-frame-pointer are conflict with -pg
154 LOCAL_CFLAGS += -fno-omit-frame-pointer -fno-function-sections -pg
155 LOCAL_CPPFLAGS += -fno-omit-frame-pointer -fno-function-sections -pg
156endif
157
The Android Open Source Project88b60792009-03-03 19:28:42 -0800158###########################################################
Jim Huang20d1ba62010-10-14 16:15:56 +0800159## Explicitly declare assembly-only __ASSEMBLY__ macro for
160## assembly source
161###########################################################
162LOCAL_ASFLAGS += -D__ASSEMBLY__
163
164###########################################################
Ying Wang1a081002010-07-13 14:55:47 -0700165## Define PRIVATE_ variables from global vars
166###########################################################
Ying Wang848020f2012-08-14 10:13:16 -0700167ifdef LOCAL_SDK_VERSION
Ying Wang1a081002010-07-13 14:55:47 -0700168my_target_project_includes :=
Evgeniy Stepanova7095e92012-03-30 12:18:52 +0400169my_target_c_includes := $(my_ndk_stl_include_path) $(my_ndk_version_root)/usr/include
Ying Wangda4bf422012-08-16 16:45:01 -0700170
171# filter out including of AndroidConfig.h in system/core.
172TARGET_GLOBAL_CFLAGS_NO_ANDCONF ?= $(subst $(TARGET_ANDROID_CONFIG_CFLAGS),,\
173 $(TARGET_GLOBAL_CFLAGS))
174my_target_global_cflags := $(TARGET_GLOBAL_CFLAGS_NO_ANDCONF)
Ying Wang1a081002010-07-13 14:55:47 -0700175else
176my_target_project_includes := $(TARGET_PROJECT_INCLUDES)
Evgeniy Stepanova7095e92012-03-30 12:18:52 +0400177my_target_c_includes := $(TARGET_C_INCLUDES)
Evgeniy Stepanova7095e92012-03-30 12:18:52 +0400178ifeq ($(strip $(LOCAL_CLANG)),true)
Ying Wangda4bf422012-08-16 16:45:01 -0700179my_target_c_includes += $(CLANG_CONFIG_EXTRA_TARGET_C_INCLUDES)
180my_target_global_cflags := $(TARGET_GLOBAL_CLANG_FLAGS)
181else
182my_target_global_cflags := $(TARGET_GLOBAL_CFLAGS)
183endif # LOCAL_CLANG
184endif # LOCAL_SDK_VERSION
185
Ying Wang1a081002010-07-13 14:55:47 -0700186$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_PROJECT_INCLUDES := $(my_target_project_includes)
Evgeniy Stepanova7095e92012-03-30 12:18:52 +0400187$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_C_INCLUDES := $(my_target_c_includes)
Ying Wang1a081002010-07-13 14:55:47 -0700188$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CFLAGS := $(my_target_global_cflags)
Ying Wangda4bf422012-08-16 16:45:01 -0700189$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CPPFLAGS := $(TARGET_GLOBAL_CPPFLAGS)
Ying Wang1a081002010-07-13 14:55:47 -0700190
191###########################################################
The Android Open Source Project88b60792009-03-03 19:28:42 -0800192## Define PRIVATE_ variables used by multiple module types
193###########################################################
194$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_NO_DEFAULT_COMPILER_FLAGS := \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700195 $(strip $(LOCAL_NO_DEFAULT_COMPILER_FLAGS))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800196
197ifeq ($(strip $(LOCAL_CC)),)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400198 ifeq ($(strip $(LOCAL_CLANG)),true)
199 LOCAL_CC := $(CLANG)
200 else
201 LOCAL_CC := $($(my_prefix)CC)
202 endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800203endif
204$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CC := $(LOCAL_CC)
205
206ifeq ($(strip $(LOCAL_CXX)),)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400207 ifeq ($(strip $(LOCAL_CLANG)),true)
208 LOCAL_CXX := $(CLANG_CXX)
209 else
210 LOCAL_CXX := $($(my_prefix)CXX)
211 endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800212endif
213$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CXX := $(LOCAL_CXX)
214
215# TODO: support a mix of standard extensions so that this isn't necessary
216LOCAL_CPP_EXTENSION := $(strip $(LOCAL_CPP_EXTENSION))
217ifeq ($(LOCAL_CPP_EXTENSION),)
218 LOCAL_CPP_EXTENSION := .cpp
219endif
220$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CPP_EXTENSION := $(LOCAL_CPP_EXTENSION)
221
222# Certain modules like libdl have to have symbols resolved at runtime and blow
223# up if --no-undefined is passed to the linker.
224ifeq ($(strip $(LOCAL_NO_DEFAULT_COMPILER_FLAGS)),)
225ifeq ($(strip $(LOCAL_ALLOW_UNDEFINED_SYMBOLS)),)
226 LOCAL_LDFLAGS := $(LOCAL_LDFLAGS) $($(my_prefix)NO_UNDEFINED_LDFLAGS)
227endif
228endif
229
Ying Wangfcdabd42011-04-25 14:22:41 -0700230ifeq (true,$(LOCAL_GROUP_STATIC_LIBRARIES))
231$(LOCAL_BUILT_MODULE): PRIVATE_GROUP_STATIC_LIBRARIES := true
232else
233$(LOCAL_BUILT_MODULE): PRIVATE_GROUP_STATIC_LIBRARIES :=
234endif
235
The Android Open Source Project88b60792009-03-03 19:28:42 -0800236###########################################################
237## Define arm-vs-thumb-mode flags.
238###########################################################
239LOCAL_ARM_MODE := $(strip $(LOCAL_ARM_MODE))
Chih-Wei Huang0d09e582010-07-09 10:07:52 +0800240ifeq ($(TARGET_ARCH),arm)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800241arm_objects_mode := $(if $(LOCAL_ARM_MODE),$(LOCAL_ARM_MODE),arm)
242normal_objects_mode := $(if $(LOCAL_ARM_MODE),$(LOCAL_ARM_MODE),thumb)
243
Dave Bort95282482009-04-23 18:44:55 -0700244# Read the values from something like TARGET_arm_CFLAGS or
245# TARGET_thumb_CFLAGS. HOST_(arm|thumb)_CFLAGS values aren't
246# actually used (although they are usually empty).
Evgeniy Stepanovf50f4c52012-04-05 11:44:37 +0400247ifeq ($(strip $(LOCAL_CLANG)),true)
248arm_objects_cflags := $($(my_prefix)$(arm_objects_mode)_CLANG_CFLAGS)
249normal_objects_cflags := $($(my_prefix)$(normal_objects_mode)_CLANG_CFLAGS)
250else
Dave Bort95282482009-04-23 18:44:55 -0700251arm_objects_cflags := $($(my_prefix)$(arm_objects_mode)_CFLAGS)
252normal_objects_cflags := $($(my_prefix)$(normal_objects_mode)_CFLAGS)
Evgeniy Stepanovf50f4c52012-04-05 11:44:37 +0400253endif
254
Chih-Wei Huang0d09e582010-07-09 10:07:52 +0800255else
256arm_objects_mode :=
257normal_objects_mode :=
258arm_objects_cflags :=
259normal_objects_cflags :=
260endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800261
262###########################################################
263## Define per-module debugging flags. Users can turn on
264## debugging for a particular module by setting DEBUG_MODULE_ModuleName
265## to a non-empty value in their environment or buildspec.mk,
266## and setting HOST_/TARGET_CUSTOM_DEBUG_CFLAGS to the
267## debug flags that they want to use.
268###########################################################
269ifdef DEBUG_MODULE_$(strip $(LOCAL_MODULE))
270 debug_cflags := $($(my_prefix)CUSTOM_DEBUG_CFLAGS)
271else
272 debug_cflags :=
273endif
274
Tim Murraya7aa8002012-10-29 16:06:00 -0700275####################################################
276## Compile RenderScript with reflected C++
277####################################################
278
279renderscript_sources := $(filter %.rs %.fs,$(LOCAL_SRC_FILES))
280
281ifneq (,$(renderscript_sources))
282
283renderscript_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(renderscript_sources))
284RenderScript_file_stamp := $(intermediates)/RenderScriptCPP.stamp
285renderscript_intermediate := $(intermediates)/renderscript
286
287ifeq ($(LOCAL_RENDERSCRIPT_CC),)
288LOCAL_RENDERSCRIPT_CC := $(LLVM_RS_CC)
289endif
290
291# Turn on all warnings and warnings as errors for RS compiles.
292# This can be disabled with LOCAL_RENDERSCRIPT_FLAGS := -Wno-error
293renderscript_flags := -Wall -Werror
294renderscript_flags += $(LOCAL_RENDERSCRIPT_FLAGS)
295
296LOCAL_RENDERSCRIPT_INCLUDES := \
297 $(TOPDIR)external/clang/lib/Headers \
298 $(TOPDIR)frameworks/rs/scriptc \
299 $(LOCAL_RENDERSCRIPT_INCLUDES)
300
301ifneq ($(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE),)
302LOCAL_RENDERSCRIPT_INCLUDES := $(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE)
303endif
304
305$(RenderScript_file_stamp): PRIVATE_RS_INCLUDES := $(LOCAL_RENDERSCRIPT_INCLUDES)
306$(RenderScript_file_stamp): PRIVATE_RS_CC := $(LOCAL_RENDERSCRIPT_CC)
307$(RenderScript_file_stamp): PRIVATE_RS_FLAGS := $(renderscript_flags)
308$(RenderScript_file_stamp): PRIVATE_RS_SOURCE_FILES := $(renderscript_sources_fullpath)
309$(RenderScript_file_stamp): PRIVATE_RS_OUTPUT_DIR := $(renderscript_intermediate)
310$(RenderScript_file_stamp): $(renderscript_sources_fullpath) $(LOCAL_RENDERSCRIPT_CC)
311 $(transform-renderscripts-to-cpp-and-bc)
312
313# include the dependency files (.d) generated by llvm-rs-cc.
314renderscript_generated_dep_files := $(addprefix $(renderscript_intermediate)/, \
315 $(patsubst %.fs,%.d, $(patsubst %.rs,%.d, $(notdir $(renderscript_sources)))))
316-include $(renderscript_generated_dep_files)
317
318LOCAL_INTERMEDIATE_TARGETS += $(RenderScript_file_stamp)
319
320rs_generated_cpps := $(addprefix \
321 $(renderscript_intermediate)/ScriptC_,$(patsubst %.fs,%.cpp, $(patsubst %.rs,%.cpp, \
322 $(notdir $(renderscript_sources)))))
323
324$(rs_generated_cpps) : $(RenderScript_file_stamp)
325
326LOCAL_C_INCLUDES += $(renderscript_intermediate)
327LOCAL_GENERATED_SOURCES += $(rs_generated_cpps)
328
329endif
330
331
The Android Open Source Project88b60792009-03-03 19:28:42 -0800332###########################################################
333## Stuff source generated from one-off tools
334###########################################################
335$(LOCAL_GENERATED_SOURCES): PRIVATE_MODULE := $(LOCAL_MODULE)
336
337ALL_GENERATED_SOURCES += $(LOCAL_GENERATED_SOURCES)
338
339
340###########################################################
Ying Wanga5fc87a2010-11-02 18:43:16 -0700341## Compile the .proto files to .cc and then to .o
342###########################################################
343proto_sources := $(filter %.proto,$(LOCAL_SRC_FILES))
344proto_generated_objects :=
345proto_generated_headers :=
346ifneq ($(proto_sources),)
347proto_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(proto_sources))
348proto_generated_cc_sources_dir := $(intermediates)/proto
349proto_generated_cc_sources := $(addprefix $(proto_generated_cc_sources_dir)/, \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700350 $(patsubst %.proto,%.pb.cc,$(proto_sources_fullpath)))
Ying Wanga5fc87a2010-11-02 18:43:16 -0700351proto_generated_objects := $(patsubst %.cc,%.o, $(proto_generated_cc_sources))
352
353$(proto_generated_cc_sources): PRIVATE_PROTO_INCLUDES := $(TOP)
354$(proto_generated_cc_sources): PRIVATE_PROTO_CC_OUTPUT_DIR := $(proto_generated_cc_sources_dir)
Ying Wang33c0d952010-11-05 11:30:58 -0700355$(proto_generated_cc_sources): PRIVATE_PROTOC_FLAGS := $(LOCAL_PROTOC_FLAGS)
Ying Wanga5fc87a2010-11-02 18:43:16 -0700356$(proto_generated_cc_sources): $(proto_generated_cc_sources_dir)/%.pb.cc: %.proto $(PROTOC)
357 $(transform-proto-to-cc)
358
359proto_generated_headers := $(patsubst %.pb.cc,%.pb.h, $(proto_generated_cc_sources))
360$(proto_generated_headers): $(proto_generated_cc_sources_dir)/%.pb.h: $(proto_generated_cc_sources_dir)/%.pb.cc
361
Ying Wang022a7b32012-06-13 11:38:10 -0700362$(proto_generated_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
363$(proto_generated_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
Narayan Kamath21094872012-04-02 18:19:31 +0100364$(proto_generated_objects): $(proto_generated_cc_sources_dir)/%.o: $(proto_generated_cc_sources_dir)/%.cc $(proto_generated_headers)
Ying Wanga5fc87a2010-11-02 18:43:16 -0700365 $(transform-$(PRIVATE_HOST)cpp-to-o)
366-include $(proto_generated_objects:%.o=%.P)
367
368LOCAL_C_INCLUDES += external/protobuf/src $(proto_generated_cc_sources_dir)
369LOCAL_CFLAGS += -DGOOGLE_PROTOBUF_NO_RTTI
370ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),full)
371LOCAL_STATIC_LIBRARIES += libprotobuf-cpp-2.3.0-full
372else
373LOCAL_STATIC_LIBRARIES += libprotobuf-cpp-2.3.0-lite
374endif
375endif
376
377
378###########################################################
The Android Open Source Project88b60792009-03-03 19:28:42 -0800379## YACC: Compile .y files to .cpp and the to .o.
380###########################################################
381
382yacc_sources := $(filter %.y,$(LOCAL_SRC_FILES))
383yacc_cpps := $(addprefix \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700384 $(intermediates)/,$(yacc_sources:.y=$(LOCAL_CPP_EXTENSION)))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800385yacc_headers := $(yacc_cpps:$(LOCAL_CPP_EXTENSION)=.h)
386yacc_objects := $(yacc_cpps:$(LOCAL_CPP_EXTENSION)=.o)
387
388ifneq ($(strip $(yacc_cpps)),)
389$(yacc_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700390 $(TOPDIR)$(LOCAL_PATH)/%.y \
391 $(lex_cpps) $(LOCAL_ADDITIONAL_DEPENDENCIES)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800392 $(call transform-y-to-cpp,$(PRIVATE_CPP_EXTENSION))
393$(yacc_headers): $(intermediates)/%.h: $(intermediates)/%$(LOCAL_CPP_EXTENSION)
394
395$(yacc_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
396$(yacc_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
397$(yacc_objects): $(intermediates)/%.o: $(intermediates)/%$(LOCAL_CPP_EXTENSION)
398 $(transform-$(PRIVATE_HOST)cpp-to-o)
399endif
400
401###########################################################
402## LEX: Compile .l files to .cpp and then to .o.
403###########################################################
404
405lex_sources := $(filter %.l,$(LOCAL_SRC_FILES))
406lex_cpps := $(addprefix \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700407 $(intermediates)/,$(lex_sources:.l=$(LOCAL_CPP_EXTENSION)))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800408lex_objects := $(lex_cpps:$(LOCAL_CPP_EXTENSION)=.o)
409
410ifneq ($(strip $(lex_cpps)),)
411$(lex_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700412 $(TOPDIR)$(LOCAL_PATH)/%.l
The Android Open Source Project88b60792009-03-03 19:28:42 -0800413 $(transform-l-to-cpp)
414
415$(lex_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
416$(lex_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
417$(lex_objects): $(intermediates)/%.o: \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700418 $(intermediates)/%$(LOCAL_CPP_EXTENSION) \
419 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
420 $(yacc_headers)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800421 $(transform-$(PRIVATE_HOST)cpp-to-o)
422endif
423
424###########################################################
425## C++: Compile .cpp files to .o.
426###########################################################
427
Jeff Browne33ba4c2011-07-11 22:11:46 -0700428# we also do this on host modules, even though
The Android Open Source Project88b60792009-03-03 19:28:42 -0800429# it's not really arm, because there are files that are shared.
430cpp_arm_sources := $(patsubst %$(LOCAL_CPP_EXTENSION).arm,%$(LOCAL_CPP_EXTENSION),$(filter %$(LOCAL_CPP_EXTENSION).arm,$(LOCAL_SRC_FILES)))
431cpp_arm_objects := $(addprefix $(intermediates)/,$(cpp_arm_sources:$(LOCAL_CPP_EXTENSION)=.o))
432
433cpp_normal_sources := $(filter %$(LOCAL_CPP_EXTENSION),$(LOCAL_SRC_FILES))
434cpp_normal_objects := $(addprefix $(intermediates)/,$(cpp_normal_sources:$(LOCAL_CPP_EXTENSION)=.o))
435
436$(cpp_arm_objects): PRIVATE_ARM_MODE := $(arm_objects_mode)
437$(cpp_arm_objects): PRIVATE_ARM_CFLAGS := $(arm_objects_cflags)
438$(cpp_normal_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
439$(cpp_normal_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
440
441cpp_objects := $(cpp_arm_objects) $(cpp_normal_objects)
442
443ifneq ($(strip $(cpp_objects)),)
444$(cpp_objects): $(intermediates)/%.o: \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700445 $(TOPDIR)$(LOCAL_PATH)/%$(LOCAL_CPP_EXTENSION) \
Ying Wang9c3aa052013-02-20 13:34:05 -0800446 $(yacc_cpps) $(proto_generated_headers) \
447 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
448 | $(my_compiler_dependencies)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800449 $(transform-$(PRIVATE_HOST)cpp-to-o)
450-include $(cpp_objects:%.o=%.P)
451endif
452
453###########################################################
454## C++: Compile generated .cpp files to .o.
455###########################################################
456
457gen_cpp_sources := $(filter %$(LOCAL_CPP_EXTENSION),$(LOCAL_GENERATED_SOURCES))
458gen_cpp_objects := $(gen_cpp_sources:%$(LOCAL_CPP_EXTENSION)=%.o)
459
460ifneq ($(strip $(gen_cpp_objects)),)
461# Compile all generated files as thumb.
462# TODO: support compiling certain generated files as arm.
463$(gen_cpp_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
464$(gen_cpp_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400465$(gen_cpp_objects): $(intermediates)/%.o: \
466 $(intermediates)/%$(LOCAL_CPP_EXTENSION) $(yacc_cpps) \
Ying Wang9c3aa052013-02-20 13:34:05 -0800467 $(proto_generated_headers) \
468 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
469 | $(my_compiler_dependencies)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800470 $(transform-$(PRIVATE_HOST)cpp-to-o)
471-include $(gen_cpp_objects:%.o=%.P)
472endif
473
474###########################################################
475## S: Compile generated .S and .s files to .o.
476###########################################################
477
478gen_S_sources := $(filter %.S,$(LOCAL_GENERATED_SOURCES))
479gen_S_objects := $(gen_S_sources:%.S=%.o)
480
481ifneq ($(strip $(gen_S_sources)),)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400482$(gen_S_objects): $(intermediates)/%.o: $(intermediates)/%.S \
Ying Wang9c3aa052013-02-20 13:34:05 -0800483 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
484 | $(my_compiler_dependencies)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800485 $(transform-$(PRIVATE_HOST)s-to-o)
486-include $(gen_S_objects:%.o=%.P)
487endif
488
489gen_s_sources := $(filter %.s,$(LOCAL_GENERATED_SOURCES))
490gen_s_objects := $(gen_s_sources:%.s=%.o)
491
492ifneq ($(strip $(gen_s_objects)),)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400493$(gen_s_objects): $(intermediates)/%.o: $(intermediates)/%.s \
Ying Wang9c3aa052013-02-20 13:34:05 -0800494 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
495 | $(my_compiler_dependencies)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800496 $(transform-$(PRIVATE_HOST)s-to-o-no-deps)
497-include $(gen_s_objects:%.o=%.P)
498endif
499
500gen_asm_objects := $(gen_S_objects) $(gen_s_objects)
501
502###########################################################
Torne (Richard Coles)aace2022013-02-21 14:01:35 +0000503## o: Include generated .o files in output.
504###########################################################
505
506gen_o_objects := $(filter %.o,$(LOCAL_GENERATED_SOURCES))
507
508###########################################################
The Android Open Source Project88b60792009-03-03 19:28:42 -0800509## C: Compile .c files to .o.
510###########################################################
511
512c_arm_sources := $(patsubst %.c.arm,%.c,$(filter %.c.arm,$(LOCAL_SRC_FILES)))
513c_arm_objects := $(addprefix $(intermediates)/,$(c_arm_sources:.c=.o))
514
515c_normal_sources := $(filter %.c,$(LOCAL_SRC_FILES))
516c_normal_objects := $(addprefix $(intermediates)/,$(c_normal_sources:.c=.o))
517
518$(c_arm_objects): PRIVATE_ARM_MODE := $(arm_objects_mode)
519$(c_arm_objects): PRIVATE_ARM_CFLAGS := $(arm_objects_cflags)
520$(c_normal_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
521$(c_normal_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
522
523c_objects := $(c_arm_objects) $(c_normal_objects)
524
525ifneq ($(strip $(c_objects)),)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400526$(c_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.c $(yacc_cpps) $(proto_generated_headers) \
Ying Wang9c3aa052013-02-20 13:34:05 -0800527 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
528 | $(my_compiler_dependencies)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800529 $(transform-$(PRIVATE_HOST)c-to-o)
530-include $(c_objects:%.o=%.P)
531endif
532
533###########################################################
Jack Paleviche7b3e2c2009-05-04 14:32:44 -0700534## C: Compile generated .c files to .o.
535###########################################################
536
537gen_c_sources := $(filter %.c,$(LOCAL_GENERATED_SOURCES))
538gen_c_objects := $(gen_c_sources:%.c=%.o)
539
540ifneq ($(strip $(gen_c_objects)),)
541# Compile all generated files as thumb.
542# TODO: support compiling certain generated files as arm.
543$(gen_c_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
544$(gen_c_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400545$(gen_c_objects): $(intermediates)/%.o: $(intermediates)/%.c $(yacc_cpps) $(proto_generated_headers) \
Ying Wang9c3aa052013-02-20 13:34:05 -0800546 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
547 | $(my_compiler_dependencies)
Jack Paleviche7b3e2c2009-05-04 14:32:44 -0700548 $(transform-$(PRIVATE_HOST)c-to-o)
549-include $(gen_c_objects:%.o=%.P)
550endif
551
552###########################################################
David 'Digit' Turner5dbb5292009-05-14 16:00:09 +0200553## ObjC: Compile .m files to .o
554###########################################################
555
556objc_sources := $(filter %.m,$(LOCAL_SRC_FILES))
557objc_objects := $(addprefix $(intermediates)/,$(objc_sources:.m=.o))
558
559ifneq ($(strip $(objc_objects)),)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400560$(objc_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.m $(yacc_cpps) $(proto_generated_headers) \
Ying Wang9c3aa052013-02-20 13:34:05 -0800561 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
562 | $(my_compiler_dependencies)
David 'Digit' Turner5dbb5292009-05-14 16:00:09 +0200563 $(transform-$(PRIVATE_HOST)m-to-o)
564-include $(objc_objects:%.o=%.P)
565endif
566
567###########################################################
The Android Open Source Project88b60792009-03-03 19:28:42 -0800568## AS: Compile .S files to .o.
569###########################################################
570
571asm_sources_S := $(filter %.S,$(LOCAL_SRC_FILES))
572asm_objects_S := $(addprefix $(intermediates)/,$(asm_sources_S:.S=.o))
573
574ifneq ($(strip $(asm_objects_S)),)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400575$(asm_objects_S): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.S \
Ying Wang9c3aa052013-02-20 13:34:05 -0800576 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
577 | $(my_compiler_dependencies)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800578 $(transform-$(PRIVATE_HOST)s-to-o)
579-include $(asm_objects_S:%.o=%.P)
580endif
581
582asm_sources_s := $(filter %.s,$(LOCAL_SRC_FILES))
583asm_objects_s := $(addprefix $(intermediates)/,$(asm_sources_s:.s=.o))
584
585ifneq ($(strip $(asm_objects_s)),)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400586$(asm_objects_s): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.s \
Ying Wang9c3aa052013-02-20 13:34:05 -0800587 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
588 | $(my_compiler_dependencies)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800589 $(transform-$(PRIVATE_HOST)s-to-o-no-deps)
590-include $(asm_objects_s:%.o=%.P)
591endif
592
593asm_objects := $(asm_objects_S) $(asm_objects_s)
594
595
Ying Wang5f074802011-11-08 09:31:21 -0800596####################################################
597## Import includes
598####################################################
599import_includes := $(intermediates)/import_includes
600import_includes_deps := $(strip \
601 $(foreach l, $(installed_shared_library_module_names), \
602 $(call intermediates-dir-for,SHARED_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE))/export_includes) \
603 $(foreach l, $(LOCAL_STATIC_LIBRARIES) $(LOCAL_WHOLE_STATIC_LIBRARIES), \
604 $(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE))/export_includes))
605$(import_includes) : $(import_includes_deps)
606 @echo Import includes file: $@
607 $(hide) mkdir -p $(dir $@) && rm -f $@
608ifdef import_includes_deps
609 $(hide) for f in $^; do \
610 cat $$f >> $@; \
611 done
612else
613 $(hide) touch $@
614endif
615
The Android Open Source Project88b60792009-03-03 19:28:42 -0800616###########################################################
617## Common object handling.
618###########################################################
619
620# some rules depend on asm_objects being first. If your code depends on
621# being first, it's reasonable to require it to be assembly
622all_objects := \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700623 $(asm_objects) \
624 $(cpp_objects) \
625 $(gen_cpp_objects) \
626 $(gen_asm_objects) \
627 $(c_objects) \
628 $(gen_c_objects) \
629 $(objc_objects) \
630 $(yacc_objects) \
631 $(lex_objects) \
632 $(proto_generated_objects) \
Torne (Richard Coles)aace2022013-02-21 14:01:35 +0000633 $(addprefix $(TOPDIR)$(LOCAL_PATH)/,$(LOCAL_PREBUILT_OBJ_FILES)) \
634 $(gen_o_objects)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800635
Colin Cross9ad36ef2012-03-30 19:31:00 -0700636LOCAL_C_INCLUDES += $(TOPDIR)$(LOCAL_PATH) $(intermediates)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800637
Ying Wang848020f2012-08-14 10:13:16 -0700638ifndef LOCAL_SDK_VERSION
Ying Wangbce4b752010-07-22 15:51:56 -0700639 LOCAL_C_INCLUDES += $(JNI_H_INCLUDE)
640endif
641
Torne (Richard Coles)aace2022013-02-21 14:01:35 +0000642# .o files need to be filtered out of LOCAL_GENERATED_SOURCES
643# to avoid creating circular dependencies.
644$(all_objects) : | $(filter-out %.o,$(LOCAL_GENERATED_SOURCES)) $(import_includes)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800645ALL_C_CPP_ETC_OBJECTS += $(all_objects)
646
647###########################################################
648## Copy headers to the install tree
649###########################################################
650include $(BUILD_COPY_HEADERS)
651
652###########################################################
653# Standard library handling.
The Android Open Source Project88b60792009-03-03 19:28:42 -0800654###########################################################
The Android Open Source Project88b60792009-03-03 19:28:42 -0800655
656###########################################################
657# The list of libraries that this module will link against are in
658# these variables. Each is a list of bare module names like "libc libm".
659#
660# LOCAL_SHARED_LIBRARIES
661# LOCAL_STATIC_LIBRARIES
662# LOCAL_WHOLE_STATIC_LIBRARIES
663#
664# We need to convert the bare names into the dependencies that
665# we'll use for LOCAL_BUILT_MODULE and LOCAL_INSTALLED_MODULE.
666# LOCAL_BUILT_MODULE should depend on the BUILT versions of the
667# libraries, so that simply building this module doesn't force
668# an install of a library. Similarly, LOCAL_INSTALLED_MODULE
669# should depend on the INSTALLED versions of the libraries so
670# that they get installed when this module does.
671###########################################################
672# NOTE:
673# WHOLE_STATIC_LIBRARIES are libraries that are pulled into the
674# module without leaving anything out, which is useful for turning
675# a collection of .a files into a .so file. Linking against a
676# normal STATIC_LIBRARY will only pull in code/symbols that are
677# referenced by the module. (see gcc/ld's --whole-archive option)
678###########################################################
679
680# Get the list of BUILT libraries, which are under
681# various intermediates directories.
682so_suffix := $($(my_prefix)SHLIB_SUFFIX)
683a_suffix := $($(my_prefix)STATIC_LIB_SUFFIX)
684
Ying Wang848020f2012-08-14 10:13:16 -0700685ifdef LOCAL_SDK_VERSION
The Android Open Source Project88b60792009-03-03 19:28:42 -0800686built_shared_libraries := \
687 $(addprefix $($(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
688 $(addsuffix $(so_suffix), \
689 $(LOCAL_SHARED_LIBRARIES)))
690
Ying Wangcce4c972011-03-03 18:53:53 -0800691my_system_shared_libraries_fullpath := \
692 $(my_ndk_stl_shared_lib_fullpath) \
693 $(addprefix $(my_ndk_version_root)/usr/lib/, \
694 $(addsuffix $(so_suffix), $(LOCAL_SYSTEM_SHARED_LIBRARIES)))
Ying Wang1a081002010-07-13 14:55:47 -0700695
696built_shared_libraries += $(my_system_shared_libraries_fullpath)
697LOCAL_SHARED_LIBRARIES += $(LOCAL_SYSTEM_SHARED_LIBRARIES)
698else
699LOCAL_SHARED_LIBRARIES += $(LOCAL_SYSTEM_SHARED_LIBRARIES)
700built_shared_libraries := \
701 $(addprefix $($(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
702 $(addsuffix $(so_suffix), \
703 $(LOCAL_SHARED_LIBRARIES)))
Ying Wang1a081002010-07-13 14:55:47 -0700704endif
705
The Android Open Source Project88b60792009-03-03 19:28:42 -0800706built_static_libraries := \
707 $(foreach lib,$(LOCAL_STATIC_LIBRARIES), \
708 $(call intermediates-dir-for, \
709 STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE))/$(lib)$(a_suffix))
710
Ying Wang848020f2012-08-14 10:13:16 -0700711ifdef LOCAL_SDK_VERSION
Ying Wangcce4c972011-03-03 18:53:53 -0800712built_static_libraries += $(my_ndk_stl_static_lib)
713endif
714
The Android Open Source Project88b60792009-03-03 19:28:42 -0800715built_whole_libraries := \
716 $(foreach lib,$(LOCAL_WHOLE_STATIC_LIBRARIES), \
717 $(call intermediates-dir-for, \
718 STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE))/$(lib)$(a_suffix))
719
The Android Open Source Project88b60792009-03-03 19:28:42 -0800720# We don't care about installed static libraries, since the
721# libraries have already been linked into the module at that point.
722# We do, however, care about the NOTICE files for any static
Steve Blockd14d3b42012-03-01 11:34:41 +0000723# libraries that we use. (see notice_files.mk)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800724
725installed_static_library_notice_file_targets := \
726 $(foreach lib,$(LOCAL_STATIC_LIBRARIES) $(LOCAL_WHOLE_STATIC_LIBRARIES), \
727 NOTICE-$(if $(LOCAL_IS_HOST_MODULE),HOST,TARGET)-STATIC_LIBRARIES-$(lib))
728
Doug Kwan9a8ecf92011-05-10 21:50:58 -0700729# Default is -fno-rtti.
Doug Kwane3c3c6d2011-06-07 10:55:48 -0700730ifeq ($(strip $(LOCAL_RTTI_FLAG)),)
731LOCAL_RTTI_FLAG := -fno-rtti
732endif
Doug Kwan9a8ecf92011-05-10 21:50:58 -0700733
The Android Open Source Project88b60792009-03-03 19:28:42 -0800734###########################################################
735# Rule-specific variable definitions
736###########################################################
737$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_YACCFLAGS := $(LOCAL_YACCFLAGS)
738$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASFLAGS := $(LOCAL_ASFLAGS)
Ying Wang7429e212012-08-15 10:59:10 -0700739$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CONLYFLAGS := $(LOCAL_CONLYFLAGS)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800740$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CFLAGS := $(LOCAL_CFLAGS)
741$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CPPFLAGS := $(LOCAL_CPPFLAGS)
Doug Kwan9a8ecf92011-05-10 21:50:58 -0700742$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RTTI_FLAG := $(LOCAL_RTTI_FLAG)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800743$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEBUG_CFLAGS := $(debug_cflags)
744$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_C_INCLUDES := $(LOCAL_C_INCLUDES)
Ying Wang5f074802011-11-08 09:31:21 -0800745$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_IMPORT_INCLUDES := $(import_includes)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800746$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDFLAGS := $(LOCAL_LDFLAGS)
747$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDLIBS := $(LOCAL_LDLIBS)
Jeff Brown703e7c62011-02-04 20:15:00 -0800748$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_NO_CRT := $(LOCAL_NO_CRT)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800749
750# this is really the way to get the files onto the command line instead
751# of using $^, because then LOCAL_ADDITIONAL_DEPENDENCIES doesn't work
752$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_SHARED_LIBRARIES := $(built_shared_libraries)
753$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_STATIC_LIBRARIES := $(built_static_libraries)
754$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_WHOLE_STATIC_LIBRARIES := $(built_whole_libraries)
755$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_OBJECTS := $(all_objects)
756
757###########################################################
758# Define library dependencies.
759###########################################################
760# all_libraries is used for the dependencies on LOCAL_BUILT_MODULE.
761all_libraries := \
762 $(built_shared_libraries) \
763 $(built_static_libraries) \
764 $(built_whole_libraries)
765
The Android Open Source Project88b60792009-03-03 19:28:42 -0800766# Also depend on the notice files for any static libraries that
767# are linked into this module. This will force them to be installed
768# when this module is.
769$(LOCAL_INSTALLED_MODULE): | $(installed_static_library_notice_file_targets)
Ying Wang5f074802011-11-08 09:31:21 -0800770
771###########################################################
772# Export includes
773###########################################################
774export_includes := $(intermediates)/export_includes
775$(export_includes): PRIVATE_EXPORT_C_INCLUDE_DIRS := $(LOCAL_EXPORT_C_INCLUDE_DIRS)
Ying Wang68f1c772012-04-23 21:29:18 -0700776$(export_includes) : $(LOCAL_MODULE_MAKEFILE)
Ying Wang5f074802011-11-08 09:31:21 -0800777 @echo Export includes file: $< -- $@
778 $(hide) mkdir -p $(dir $@) && rm -f $@
779ifdef LOCAL_EXPORT_C_INCLUDE_DIRS
780 $(hide) for d in $(PRIVATE_EXPORT_C_INCLUDE_DIRS); do \
781 echo "-I $$d" >> $@; \
782 done
783else
784 $(hide) touch $@
785endif
Ying Wang616e5962012-04-18 17:35:55 -0700786
787# Make sure export_includes gets generated when you are running mm/mmm
788$(LOCAL_BUILT_MODULE) : | $(export_includes)