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