binary.mk revision 09295a82f8db8f3e699b3089f7d93565a82b72ca
1###########################################################
2## Standard rules for building binary object files from
3## asm/c/cpp/yacc/lex/etc source files.
4##
5## The list of object files is exported in $(all_objects).
6###########################################################
7
8#######################################
9include $(BUILD_SYSTEM)/base_rules.mk
10#######################################
11
12##################################################
13# Compute the dependency of the shared libraries
14##################################################
15# On the target, we compile with -nostdlib, so we must add in the
16# default system shared libraries, unless they have requested not
17# to by supplying a LOCAL_SYSTEM_SHARED_LIBRARIES value.  One would
18# supply that, for example, when building libc itself.
19ifdef LOCAL_IS_HOST_MODULE
20  ifeq ($(LOCAL_SYSTEM_SHARED_LIBRARIES),none)
21      my_system_shared_libraries :=
22  else
23      my_system_shared_libraries := $(LOCAL_SYSTEM_SHARED_LIBRARIES)
24  endif
25else
26  ifeq ($(LOCAL_SYSTEM_SHARED_LIBRARIES),none)
27      my_system_shared_libraries := libc libm
28  else
29      my_system_shared_libraries := $(LOCAL_SYSTEM_SHARED_LIBRARIES)
30  endif
31endif
32
33# The following LOCAL_ variables will be modified in this file.
34# Because the same LOCAL_ variables may be used to define modules for both 1st arch and 2nd arch,
35# we can't modify them in place.
36my_src_files := $(LOCAL_SRC_FILES)
37my_static_libraries := $(LOCAL_STATIC_LIBRARIES)
38my_whole_static_libraries := $(LOCAL_WHOLE_STATIC_LIBRARIES)
39my_shared_libraries := $(LOCAL_SHARED_LIBRARIES)
40my_cflags := $(LOCAL_CFLAGS)
41my_conlyflags := $(LOCAL_CONLYFLAGS)
42my_cppflags := $(LOCAL_CPPFLAGS)
43my_cflags_no_override := $(GLOBAL_CFLAGS_NO_OVERRIDE)
44my_cppflags_no_override := $(GLOBAL_CPPFLAGS_NO_OVERRIDE)
45my_ldflags := $(LOCAL_LDFLAGS)
46my_ldlibs := $(LOCAL_LDLIBS)
47my_asflags := $(LOCAL_ASFLAGS)
48my_cc := $(LOCAL_CC)
49my_cc_wrapper := $(CC_WRAPPER)
50my_cxx := $(LOCAL_CXX)
51my_cxx_wrapper := $(CXX_WRAPPER)
52my_c_includes := $(LOCAL_C_INCLUDES)
53my_generated_sources := $(LOCAL_GENERATED_SOURCES)
54my_native_coverage := $(LOCAL_NATIVE_COVERAGE)
55my_additional_dependencies := $(LOCAL_MODULE_MAKEFILE) $(LOCAL_ADDITIONAL_DEPENDENCIES)
56my_export_c_include_dirs := $(LOCAL_EXPORT_C_INCLUDE_DIRS)
57
58ifdef LOCAL_IS_HOST_MODULE
59my_allow_undefined_symbols := true
60else
61my_allow_undefined_symbols := $(strip $(LOCAL_ALLOW_UNDEFINED_SYMBOLS))
62endif
63
64my_ndk_sysroot :=
65my_ndk_sysroot_include :=
66my_ndk_sysroot_lib :=
67ifdef LOCAL_SDK_VERSION
68  ifdef LOCAL_NDK_VERSION
69    $(error $(LOCAL_PATH): LOCAL_NDK_VERSION is now retired.)
70  endif
71  ifdef LOCAL_IS_HOST_MODULE
72    $(error $(LOCAL_PATH): LOCAL_SDK_VERSION cannot be used in host module)
73  endif
74  my_ndk_source_root := $(HISTORICAL_NDK_VERSIONS_ROOT)/current/sources
75  my_ndk_sysroot := $(HISTORICAL_NDK_VERSIONS_ROOT)/current/platforms/android-$(LOCAL_SDK_VERSION)/arch-$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)
76  my_ndk_sysroot_include := $(my_ndk_sysroot)/usr/include
77  ifeq (x86_64,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
78    my_ndk_sysroot_lib := $(my_ndk_sysroot)/usr/lib64
79  else ifeq (mips32r6,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH_VARIANT))
80    my_ndk_sysroot_lib := $(my_ndk_sysroot)/usr/libr6
81  else
82    my_ndk_sysroot_lib := $(my_ndk_sysroot)/usr/lib
83  endif
84
85  # The bionic linker now has support for packed relocations and gnu style
86  # hashes (which are much faster!), but shipping to older devices requires
87  # the old style hash and disabling packed relocations.
88  #ifeq ($(shell expr $(LOCAL_SDK_VERSION) >= FIRST_SUPPORTED_VERSION),0)
89    my_ldflags += -Wl,--hash-style=sysv
90    LOCAL_PACK_MODULE_RELOCATIONS := false
91  #endif
92
93  # Set up the NDK stl variant. Starting from NDK-r5 the c++ stl resides in a separate location.
94  # See ndk/docs/CPLUSPLUS-SUPPORT.html
95  my_ndk_stl_include_path :=
96  my_ndk_stl_shared_lib_fullpath :=
97  my_ndk_stl_shared_lib :=
98  my_ndk_stl_static_lib :=
99  my_ndk_stl_cppflags :=
100  my_cpu_variant := $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)CPU_ABI)
101  ifeq (mips32r6,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH_VARIANT))
102    my_cpu_variant := mips32r6
103  endif
104  LOCAL_NDK_STL_VARIANT := $(strip $(LOCAL_NDK_STL_VARIANT))
105  ifeq (,$(LOCAL_NDK_STL_VARIANT))
106    LOCAL_NDK_STL_VARIANT := system
107  endif
108  ifneq (1,$(words $(filter system stlport_static stlport_shared c++_static c++_shared gnustl_static, $(LOCAL_NDK_STL_VARIANT))))
109    $(error $(LOCAL_PATH): Unknown LOCAL_NDK_STL_VARIANT $(LOCAL_NDK_STL_VARIANT))
110  endif
111  ifeq (system,$(LOCAL_NDK_STL_VARIANT))
112    my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/system/include
113    # for "system" variant, the shared library exists in the system library and -lstdc++ is added by default.
114  else # LOCAL_NDK_STL_VARIANT is not system
115  ifneq (,$(filter stlport_%, $(LOCAL_NDK_STL_VARIANT)))
116    my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/stlport/stlport
117    ifeq (stlport_static,$(LOCAL_NDK_STL_VARIANT))
118      my_ndk_stl_static_lib := $(my_ndk_source_root)/cxx-stl/stlport/libs/$(my_cpu_variant)/libstlport_static.a
119    else
120      my_ndk_stl_shared_lib_fullpath := $(my_ndk_source_root)/cxx-stl/stlport/libs/$(my_cpu_variant)/libstlport_shared.so
121      my_ndk_stl_shared_lib := -lstlport_shared
122    endif
123  else # LOCAL_NDK_STL_VARIANT is not stlport_* either
124  ifneq (,$(filter c++_%, $(LOCAL_NDK_STL_VARIANT)))
125    my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/llvm-libc++/libcxx/include \
126                               $(my_ndk_source_root)/cxx-stl/llvm-libc++/gabi++/include \
127                               $(my_ndk_source_root)/android/support/include
128    ifeq (c++_static,$(LOCAL_NDK_STL_VARIANT))
129      my_ndk_stl_static_lib := $(my_ndk_source_root)/cxx-stl/llvm-libc++/libs/$(my_cpu_variant)/libc++_static.a
130    else
131      my_ndk_stl_shared_lib_fullpath := $(my_ndk_source_root)/cxx-stl/llvm-libc++/libs/$(my_cpu_variant)/libc++_shared.so
132      my_ndk_stl_shared_lib := -lc++_shared
133    endif
134    my_ndk_stl_cppflags := -std=c++11
135  else
136    # LOCAL_NDK_STL_VARIANT is gnustl_static
137    my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/$($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_NDK_GCC_VERSION)/libs/$(my_cpu_variant)/include \
138                               $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/$($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_NDK_GCC_VERSION)/include
139    my_ndk_stl_static_lib := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/$($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_NDK_GCC_VERSION)/libs/$(my_cpu_variant)/libgnustl_static.a
140  endif
141  endif
142  endif
143endif
144
145# MinGW spits out warnings about -fPIC even for -fpie?!) being ignored because
146# all code is position independent, and then those warnings get promoted to
147# errors.
148ifneq ($($(my_prefix)OS),windows)
149ifeq ($(LOCAL_MODULE_CLASS),EXECUTABLES)
150my_cflags += -fpie
151else
152my_cflags += -fPIC
153endif
154endif
155
156ifdef LOCAL_IS_HOST_MODULE
157my_src_files += $(LOCAL_SRC_FILES_$($(my_prefix)OS)) $(LOCAL_SRC_FILES_$($(my_prefix)OS)_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
158my_static_libraries += $(LOCAL_STATIC_LIBRARIES_$($(my_prefix)OS))
159my_shared_libraries += $(LOCAL_SHARED_LIBRARIES_$($(my_prefix)OS))
160my_cflags += $(LOCAL_CFLAGS_$($(my_prefix)OS))
161my_cppflags += $(LOCAL_CPPFLAGS_$($(my_prefix)OS))
162my_ldflags += $(LOCAL_LDFLAGS_$($(my_prefix)OS))
163my_ldlibs += $(LOCAL_LDLIBS_$($(my_prefix)OS))
164my_asflags += $(LOCAL_ASFLAGS_$($(my_prefix)OS))
165my_c_includes += $(LOCAL_C_INCLUDES_$($(my_prefix)OS))
166my_generated_sources += $(LOCAL_GENERATED_SOURCES_$($(my_prefix)OS))
167endif
168
169my_src_files += $(LOCAL_SRC_FILES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_SRC_FILES_$(my_32_64_bit_suffix))
170my_shared_libraries += $(LOCAL_SHARED_LIBRARIES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_SHARED_LIBRARIES_$(my_32_64_bit_suffix))
171my_cflags += $(LOCAL_CFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CFLAGS_$(my_32_64_bit_suffix))
172my_cppflags += $(LOCAL_CPPFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CPPFLAGS_$(my_32_64_bit_suffix))
173my_ldflags += $(LOCAL_LDFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_LDFLAGS_$(my_32_64_bit_suffix))
174my_asflags += $(LOCAL_ASFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_ASFLAGS_$(my_32_64_bit_suffix))
175my_c_includes += $(LOCAL_C_INCLUDES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_C_INCLUDES_$(my_32_64_bit_suffix))
176my_generated_sources += $(LOCAL_GENERATED_SOURCES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_GENERATED_SOURCES_$(my_32_64_bit_suffix))
177
178my_clang := $(strip $(LOCAL_CLANG))
179ifdef LOCAL_CLANG_$(my_32_64_bit_suffix)
180my_clang := $(strip $(LOCAL_CLANG_$(my_32_64_bit_suffix)))
181endif
182ifdef LOCAL_CLANG_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)
183my_clang := $(strip $(LOCAL_CLANG_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)))
184endif
185
186# clang is enabled by default for host builds
187# enable it unless we've specifically disabled clang above
188ifdef LOCAL_IS_HOST_MODULE
189    ifneq ($($(my_prefix)OS),windows)
190    ifeq ($(my_clang),)
191        my_clang := true
192    endif
193    endif
194# Add option to make clang the default for device build
195else ifeq ($(USE_CLANG_PLATFORM_BUILD),true)
196    ifeq ($(my_clang),)
197        my_clang := true
198    endif
199endif
200
201my_cpp_std_version := -std=gnu++14
202ifdef LOCAL_SDK_VERSION
203    # The NDK handles this itself.
204    my_cpp_std_version :=
205endif
206
207ifdef LOCAL_IS_HOST_MODULE
208    ifneq ($(my_clang),true)
209        # The host GCC doesn't support C++14 (and is deprecated, so likely
210        # never will). Build these modules with C++11.
211        my_cpp_std_version := -std=gnu++11
212    endif
213endif
214
215my_cppflags := $(my_cpp_std_version) $(my_cppflags)
216
217
218# arch-specific static libraries go first so that generic ones can depend on them
219my_static_libraries := $(LOCAL_STATIC_LIBRARIES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_STATIC_LIBRARIES_$(my_32_64_bit_suffix)) $(my_static_libraries)
220my_whole_static_libraries := $(LOCAL_WHOLE_STATIC_LIBRARIES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_WHOLE_STATIC_LIBRARIES_$(my_32_64_bit_suffix)) $(my_whole_static_libraries)
221
222include $(BUILD_SYSTEM)/cxx_stl_setup.mk
223
224# Add static HAL libraries
225ifdef LOCAL_HAL_STATIC_LIBRARIES
226$(foreach lib, $(LOCAL_HAL_STATIC_LIBRARIES), \
227    $(eval b_lib := $(filter $(lib).%,$(BOARD_HAL_STATIC_LIBRARIES)))\
228    $(if $(b_lib), $(eval my_static_libraries += $(b_lib)),\
229                   $(eval my_static_libraries += $(lib).default)))
230b_lib :=
231endif
232
233my_linker := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LINKER)
234
235include $(BUILD_SYSTEM)/config_sanitizers.mk
236
237# Add in libcompiler_rt for all regular device builds
238ifeq (,$(LOCAL_SDK_VERSION)$(WITHOUT_LIBCOMPILER_RT))
239  my_static_libraries += $(COMPILER_RT_CONFIG_EXTRA_STATIC_LIBRARIES)
240endif
241
242####################################################
243## Add FDO flags if FDO is turned on and supported
244## Please note that we will do option filtering during FDO build.
245## i.e. Os->O2, remove -fno-early-inline and -finline-limit.
246##################################################################
247my_fdo_build :=
248ifneq ($(filter true always, $(LOCAL_FDO_SUPPORT)),)
249  ifeq ($(BUILD_FDO_INSTRUMENT),true)
250    my_cflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_FDO_INSTRUMENT_CFLAGS)
251    my_ldflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_FDO_INSTRUMENT_LDFLAGS)
252    my_fdo_build := true
253  else ifneq ($(filter true,$(BUILD_FDO_OPTIMIZE))$(filter always,$(LOCAL_FDO_SUPPORT)),)
254    my_cflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_FDO_OPTIMIZE_CFLAGS)
255    my_fdo_build := true
256  endif
257  # Disable ccache (or other compiler wrapper) except gomacc, which
258  # can handle -fprofile-use properly.
259  my_cc_wrapper := $(filter $(GOMA_CC),$(my_cc_wrapper))
260  my_cxx_wrapper := $(filter $(GOMA_CC),$(my_cxx_wrapper))
261endif
262
263###########################################################
264## Explicitly declare assembly-only __ASSEMBLY__ macro for
265## assembly source
266###########################################################
267my_asflags += -D__ASSEMBLY__
268
269
270###########################################################
271## Define PRIVATE_ variables from global vars
272###########################################################
273ifndef LOCAL_IS_HOST_MODULE
274ifdef LOCAL_SDK_VERSION
275my_target_project_includes :=
276my_target_c_includes := $(my_ndk_stl_include_path) $(my_ndk_sysroot_include)
277my_target_global_cppflags := $(my_ndk_stl_cppflags)
278else
279my_target_project_includes := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_PROJECT_INCLUDES)
280my_target_c_includes := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_C_INCLUDES)
281my_target_global_cppflags :=
282endif # LOCAL_SDK_VERSION
283
284ifeq ($(my_clang),true)
285my_target_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_TARGET_GLOBAL_CFLAGS)
286my_target_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_TARGET_GLOBAL_CONLYFLAGS)
287my_target_global_cppflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_TARGET_GLOBAL_CPPFLAGS)
288my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_TARGET_GLOBAL_LDFLAGS)
289else
290my_target_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_CFLAGS)
291my_target_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_CONLYFLAGS)
292my_target_global_cppflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_CPPFLAGS)
293my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LDFLAGS)
294endif # my_clang
295
296$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_PROJECT_INCLUDES := $(my_target_project_includes)
297$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_C_INCLUDES := $(my_target_c_includes)
298$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CFLAGS := $(my_target_global_cflags)
299$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CONLYFLAGS := $(my_target_global_conlyflags)
300$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CPPFLAGS := $(my_target_global_cppflags)
301$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(my_target_global_ldflags)
302
303else # LOCAL_IS_HOST_MODULE
304
305ifeq ($(my_clang),true)
306my_host_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CFLAGS)
307my_host_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CONLYFLAGS)
308my_host_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CPPFLAGS)
309my_host_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_LDFLAGS)
310my_host_c_includes := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES)
311else
312my_host_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_CFLAGS)
313my_host_global_conlyflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_CONLYFLAGS)
314my_host_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_CPPFLAGS)
315my_host_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_LDFLAGS)
316my_host_c_includes := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES)
317endif # my_clang
318
319$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_C_INCLUDES := $(my_host_c_includes)
320$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_CFLAGS := $(my_host_global_cflags)
321$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_CONLYFLAGS := $(my_host_global_conlyflags)
322$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_CPPFLAGS := $(my_host_global_cppflags)
323$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_LDFLAGS := $(my_host_global_ldflags)
324endif # LOCAL_IS_HOST_MODULE
325
326# To enable coverage for a given module, set LOCAL_NATIVE_COVERAGE=true and
327# build with NATIVE_COVERAGE=true in your enviornment. Note that the build
328# system is not sensitive to changes to NATIVE_COVERAGE, so you should do a
329# clean build of your module after toggling it.
330ifeq ($(NATIVE_COVERAGE),true)
331    ifeq ($(my_native_coverage),true)
332        # Note that clang coverage doesn't play nicely with acov out of the box.
333        # Clang apparently generates .gcno files that aren't compatible with
334        # gcov-4.8.  This can be solved by installing gcc-4.6 and invoking lcov
335        # with `--gcov-tool /usr/bin/gcov-4.6`.
336        #
337        # http://stackoverflow.com/questions/17758126/clang-code-coverage-invalid-output
338        my_cflags += --coverage -O0
339        my_ldflags += --coverage
340    endif
341else
342    my_native_coverage := false
343endif
344
345###########################################################
346## Define PRIVATE_ variables used by multiple module types
347###########################################################
348$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_NO_DEFAULT_COMPILER_FLAGS := \
349    $(strip $(LOCAL_NO_DEFAULT_COMPILER_FLAGS))
350
351ifeq ($(strip $(WITH_SYNTAX_CHECK)),)
352  LOCAL_NO_SYNTAX_CHECK := true
353endif
354
355ifeq ($(strip $(WITH_STATIC_ANALYZER)),)
356  LOCAL_NO_STATIC_ANALYZER := true
357endif
358
359ifneq ($(strip $(LOCAL_IS_HOST_MODULE)),)
360  my_syntax_arch := host
361else
362  my_syntax_arch := $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)
363endif
364
365ifeq ($(strip $(my_cc)),)
366  ifeq ($(my_clang),true)
367    my_cc := $(CLANG)
368  else
369    my_cc := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)CC)
370  endif
371  my_cc := $(my_cc_wrapper) $(my_cc)
372endif
373ifneq ($(LOCAL_NO_STATIC_ANALYZER),true)
374  my_cc := $(SYNTAX_TOOLS_PREFIX)/ccc-analyzer $(my_syntax_arch) "$(my_cc)"
375else
376ifneq ($(LOCAL_NO_SYNTAX_CHECK),true)
377  my_cc := $(SYNTAX_TOOLS_PREFIX)/ccc-syntax $(my_syntax_arch) "$(my_cc)"
378endif
379endif
380$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CC := $(my_cc)
381
382ifeq ($(strip $(my_cxx)),)
383  ifeq ($(my_clang),true)
384    my_cxx := $(CLANG_CXX)
385  else
386    my_cxx := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)CXX)
387  endif
388  my_cxx := $(my_cxx_wrapper) $(my_cxx)
389endif
390ifneq ($(LOCAL_NO_STATIC_ANALYZER),true)
391  my_cxx := $(SYNTAX_TOOLS_PREFIX)/cxx-analyzer $(my_syntax_arch) "$(my_cxx)"
392else
393ifneq ($(LOCAL_NO_SYNTAX_CHECK),true)
394  my_cxx := $(SYNTAX_TOOLS_PREFIX)/cxx-syntax $(my_syntax_arch) "$(my_cxx)"
395endif
396endif
397$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LINKER := $(my_linker)
398$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CXX := $(my_cxx)
399$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CLANG := $(my_clang)
400
401# TODO: support a mix of standard extensions so that this isn't necessary
402LOCAL_CPP_EXTENSION := $(strip $(LOCAL_CPP_EXTENSION))
403ifeq ($(LOCAL_CPP_EXTENSION),)
404  LOCAL_CPP_EXTENSION := .cpp
405endif
406$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CPP_EXTENSION := $(LOCAL_CPP_EXTENSION)
407
408# Certain modules like libdl have to have symbols resolved at runtime and blow
409# up if --no-undefined is passed to the linker.
410ifeq ($(strip $(LOCAL_NO_DEFAULT_COMPILER_FLAGS)),)
411ifeq ($(my_allow_undefined_symbols),)
412  my_ldflags +=  $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)NO_UNDEFINED_LDFLAGS)
413endif
414endif
415
416ifeq (true,$(LOCAL_GROUP_STATIC_LIBRARIES))
417$(LOCAL_BUILT_MODULE): PRIVATE_GROUP_STATIC_LIBRARIES := true
418else
419$(LOCAL_BUILT_MODULE): PRIVATE_GROUP_STATIC_LIBRARIES :=
420endif
421
422###########################################################
423## Define arm-vs-thumb-mode flags.
424###########################################################
425LOCAL_ARM_MODE := $(strip $(LOCAL_ARM_MODE))
426ifeq ($($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH),arm)
427arm_objects_mode := $(if $(LOCAL_ARM_MODE),$(LOCAL_ARM_MODE),arm)
428normal_objects_mode := $(if $(LOCAL_ARM_MODE),$(LOCAL_ARM_MODE),thumb)
429
430# Read the values from something like TARGET_arm_CFLAGS or
431# TARGET_thumb_CFLAGS.  HOST_(arm|thumb)_CFLAGS values aren't
432# actually used (although they are usually empty).
433arm_objects_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)$(arm_objects_mode)_CFLAGS)
434normal_objects_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)$(normal_objects_mode)_CFLAGS)
435ifeq ($(my_clang),true)
436arm_objects_cflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(arm_objects_cflags))
437normal_objects_cflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(normal_objects_cflags))
438endif
439
440else
441arm_objects_mode :=
442normal_objects_mode :=
443arm_objects_cflags :=
444normal_objects_cflags :=
445endif
446
447###########################################################
448## Define per-module debugging flags.  Users can turn on
449## debugging for a particular module by setting DEBUG_MODULE_ModuleName
450## to a non-empty value in their environment or buildspec.mk,
451## and setting HOST_/TARGET_CUSTOM_DEBUG_CFLAGS to the
452## debug flags that they want to use.
453###########################################################
454ifdef DEBUG_MODULE_$(strip $(LOCAL_MODULE))
455  debug_cflags := $($(my_prefix)CUSTOM_DEBUG_CFLAGS)
456else
457  debug_cflags :=
458endif
459
460####################################################
461## Compile RenderScript with reflected C++
462####################################################
463
464renderscript_sources := $(filter %.rs %.fs,$(my_src_files))
465
466ifneq (,$(renderscript_sources))
467
468renderscript_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(renderscript_sources))
469RenderScript_file_stamp := $(intermediates)/RenderScriptCPP.stamp
470renderscript_intermediate := $(intermediates)/renderscript
471
472renderscript_target_api :=
473
474ifneq (,$(LOCAL_RENDERSCRIPT_TARGET_API))
475renderscript_target_api := $(LOCAL_RENDERSCRIPT_TARGET_API)
476else
477ifneq (,$(LOCAL_SDK_VERSION))
478# Set target-api for LOCAL_SDK_VERSIONs other than current.
479ifneq (,$(filter-out current system_current, $(LOCAL_SDK_VERSION)))
480renderscript_target_api := $(LOCAL_SDK_VERSION)
481endif
482endif  # LOCAL_SDK_VERSION is set
483endif  # LOCAL_RENDERSCRIPT_TARGET_API is set
484
485
486ifeq ($(LOCAL_RENDERSCRIPT_CC),)
487LOCAL_RENDERSCRIPT_CC := $(LLVM_RS_CC)
488endif
489
490# Turn on all warnings and warnings as errors for RS compiles.
491# This can be disabled with LOCAL_RENDERSCRIPT_FLAGS := -Wno-error
492renderscript_flags := -Wall -Werror
493renderscript_flags += $(LOCAL_RENDERSCRIPT_FLAGS)
494# -m32 or -m64
495renderscript_flags += -m$(my_32_64_bit_suffix)
496
497renderscript_includes := \
498    $(TOPDIR)external/clang/lib/Headers \
499    $(TOPDIR)frameworks/rs/scriptc \
500    $(LOCAL_RENDERSCRIPT_INCLUDES)
501
502ifneq ($(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE),)
503renderscript_includes := $(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE)
504endif
505
506bc_dep_files := $(addprefix $(renderscript_intermediate)/, \
507    $(patsubst %.fs,%.d, $(patsubst %.rs,%.d, $(notdir $(renderscript_sources)))))
508
509$(RenderScript_file_stamp): PRIVATE_RS_INCLUDES := $(renderscript_includes)
510$(RenderScript_file_stamp): PRIVATE_RS_CC := $(LOCAL_RENDERSCRIPT_CC)
511$(RenderScript_file_stamp): PRIVATE_RS_FLAGS := $(renderscript_flags)
512$(RenderScript_file_stamp): PRIVATE_RS_SOURCE_FILES := $(renderscript_sources_fullpath)
513$(RenderScript_file_stamp): PRIVATE_RS_OUTPUT_DIR := $(renderscript_intermediate)
514$(RenderScript_file_stamp): PRIVATE_RS_TARGET_API := $(renderscript_target_api)
515$(RenderScript_file_stamp): PRIVATE_DEP_FILES := $(bc_dep_files)
516$(RenderScript_file_stamp): $(renderscript_sources_fullpath) $(LOCAL_RENDERSCRIPT_CC)
517	$(transform-renderscripts-to-cpp-and-bc)
518
519# include the dependency files (.d/.P) generated by llvm-rs-cc.
520-include $(bc_dep_files:%.d=%.P)
521
522LOCAL_INTERMEDIATE_TARGETS += $(RenderScript_file_stamp)
523
524rs_generated_cpps := $(addprefix \
525    $(renderscript_intermediate)/ScriptC_,$(patsubst %.fs,%.cpp, $(patsubst %.rs,%.cpp, \
526    $(notdir $(renderscript_sources)))))
527
528# This is just a dummy rule to make sure gmake doesn't skip updating the dependents.
529$(rs_generated_cpps) : $(RenderScript_file_stamp)
530	@echo "Updated RS generated cpp file $@."
531
532my_c_includes += $(renderscript_intermediate)
533my_generated_sources += $(rs_generated_cpps)
534
535endif
536
537
538###########################################################
539## Stuff source generated from one-off tools
540###########################################################
541$(my_generated_sources): PRIVATE_MODULE := $(my_register_name)
542
543my_gen_sources_copy := $(patsubst $(generated_sources_dir)/%,$(intermediates)/%,$(filter $(generated_sources_dir)/%,$(my_generated_sources)))
544
545$(my_gen_sources_copy): $(intermediates)/% : $(generated_sources_dir)/% | $(ACP)
546	@echo "Copy: $@"
547	$(copy-file-to-target)
548
549my_generated_sources := $(patsubst $(generated_sources_dir)/%,$(intermediates)/%,$(my_generated_sources))
550
551ALL_GENERATED_SOURCES += $(my_generated_sources)
552
553###########################################################
554## Compile the .proto files to .cc (or .c) and then to .o
555###########################################################
556proto_sources := $(filter %.proto,$(my_src_files))
557proto_generated_objects :=
558proto_generated_headers :=
559ifneq ($(proto_sources),)
560proto_generated_sources_dir := $(generated_sources_dir)/proto
561proto_generated_obj_dir := $(intermediates)/proto
562
563ifneq (,$(filter nanopb-c nanopb-c-enable_malloc, $(LOCAL_PROTOC_OPTIMIZE_TYPE)))
564my_proto_source_suffix := .c
565my_proto_c_includes := external/nanopb-c
566my_protoc_flags := --nanopb_out=$(proto_generated_sources_dir) \
567    --plugin=external/nanopb-c/generator/protoc-gen-nanopb
568else
569my_proto_source_suffix := .cc
570my_proto_c_includes := external/protobuf/src
571my_cflags += -DGOOGLE_PROTOBUF_NO_RTTI
572my_protoc_flags := --cpp_out=$(proto_generated_sources_dir)
573endif
574my_proto_c_includes += $(proto_generated_sources_dir)
575
576proto_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(proto_sources))
577proto_generated_sources := $(addprefix $(proto_generated_sources_dir)/, \
578    $(patsubst %.proto,%.pb$(my_proto_source_suffix),$(proto_sources_fullpath)))
579proto_generated_headers := $(patsubst %.pb$(my_proto_source_suffix),%.pb.h, $(proto_generated_sources))
580proto_generated_objects := $(addprefix $(proto_generated_obj_dir)/, \
581    $(patsubst %.proto,%.pb.o,$(proto_sources_fullpath)))
582
583# Ensure the transform-proto-to-cc rule is only defined once in multilib build.
584ifndef $(my_prefix)_$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_proto_defined
585$(proto_generated_sources): PRIVATE_PROTO_INCLUDES := $(TOP)
586$(proto_generated_sources): PRIVATE_PROTOC_FLAGS := $(LOCAL_PROTOC_FLAGS) $(my_protoc_flags)
587$(proto_generated_sources): $(proto_generated_sources_dir)/%.pb$(my_proto_source_suffix): %.proto $(PROTOC)
588	$(transform-proto-to-cc)
589
590# This is just a dummy rule to make sure gmake doesn't skip updating the dependents.
591$(proto_generated_headers): $(proto_generated_sources_dir)/%.pb.h: $(proto_generated_sources_dir)/%.pb$(my_proto_source_suffix)
592	@echo "Updated header file $@."
593
594$(my_prefix)_$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_proto_defined := true
595endif  # transform-proto-to-cc rule included only once
596
597$(proto_generated_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
598$(proto_generated_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
599$(proto_generated_objects): $(proto_generated_obj_dir)/%.o: $(proto_generated_sources_dir)/%$(my_proto_source_suffix) $(proto_generated_headers)
600ifeq ($(my_proto_source_suffix),.c)
601	$(transform-$(PRIVATE_HOST)c-to-o)
602else
603	$(transform-$(PRIVATE_HOST)cpp-to-o)
604endif
605-include $(proto_generated_objects:%.o=%.P)
606
607my_c_includes += $(my_proto_c_includes)
608# Auto-export the generated proto source dir.
609my_export_c_include_dirs += $(my_proto_c_includes)
610
611ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nanopb-c-enable_malloc)
612    my_static_libraries += libprotobuf-c-nano-enable_malloc
613else ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nanopb-c)
614    my_static_libraries += libprotobuf-c-nano
615else ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),full)
616    ifdef LOCAL_SDK_VERSION
617        my_static_libraries += libprotobuf-cpp-full-ndk
618    else
619        my_shared_libraries += libprotobuf-cpp-full
620    endif
621else
622    ifdef LOCAL_SDK_VERSION
623        my_static_libraries += libprotobuf-cpp-lite-ndk
624    else
625        my_shared_libraries += libprotobuf-cpp-lite
626    endif
627endif
628endif  # $(proto_sources) non-empty
629
630###########################################################
631## Compile the .dbus-xml files to c++ headers
632###########################################################
633dbus_definitions := $(filter %.dbus-xml,$(my_src_files))
634dbus_generated_headers :=
635ifneq ($(dbus_definitions),)
636
637dbus_definition_paths := $(addprefix $(LOCAL_PATH)/,$(dbus_definitions))
638dbus_service_config := $(filter %dbus-service-config.json,$(my_src_files))
639dbus_service_config_path := $(addprefix $(LOCAL_PATH)/,$(dbus_service_config))
640
641dbus_gen_dir := $(generated_sources_dir)/dbus_bindings
642
643ifdef LOCAL_DBUS_PROXY_PREFIX
644dbus_header_dir := $(dbus_gen_dir)/include/$(LOCAL_DBUS_PROXY_PREFIX)
645dbus_headers := dbus-proxies.h
646else
647dbus_header_dir := $(dbus_gen_dir)
648dbus_headers := $(patsubst %.dbus-xml,%.h,$(dbus_definitions))
649endif
650dbus_generated_headers := $(addprefix $(dbus_header_dir)/,$(dbus_headers))
651
652# Ensure that we only define build rules once in multilib builds.
653ifndef $(my_prefix)_$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_dbus_bindings_defined
654$(my_prefix)_$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_dbus_bindings_defined := true
655
656$(dbus_generated_headers): PRIVATE_MODULE := $(LOCAL_MODULE)
657$(dbus_generated_headers): PRIVATE_DBUS_SERVICE_CONFIG := $(dbus_service_config_path)
658$(dbus_generated_headers) : $(dbus_service_config_path) $(DBUS_GENERATOR)
659ifdef LOCAL_DBUS_PROXY_PREFIX
660$(dbus_generated_headers) : $(dbus_definition_paths)
661	$(generate-dbus-proxies)
662
663# Auto-export the generated dbus proxy directory.
664my_export_c_include_dirs += $(dbus_gen_dir)/include
665my_c_includes += $(dbus_gen_dir)/include
666else
667$(dbus_generated_headers) : $(dbus_header_dir)/%.h : $(LOCAL_PATH)/%.dbus-xml
668	$(generate-dbus-adaptors)
669
670my_export_c_include_dirs += $(dbus_header_dir)
671my_c_includes += $(dbus_header_dir)
672endif  # $(LOCAL_DBUS_PROXY_PREFIX)
673endif  # $(my_prefix)_$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_dbus_bindings_defined
674
675my_generated_sources += $(dbus_generated_headers)
676
677endif  # $(dbus_definitions) non-empty
678
679
680###########################################################
681## YACC: Compile .y and .yy files to .cpp and the to .o.
682###########################################################
683
684y_yacc_sources := $(filter %.y,$(my_src_files))
685y_yacc_cpps := $(addprefix \
686    $(intermediates)/,$(y_yacc_sources:.y=$(LOCAL_CPP_EXTENSION)))
687
688yy_yacc_sources := $(filter %.yy,$(my_src_files))
689yy_yacc_cpps := $(addprefix \
690    $(intermediates)/,$(yy_yacc_sources:.yy=$(LOCAL_CPP_EXTENSION)))
691
692yacc_cpps := $(y_yacc_cpps) $(yy_yacc_cpps)
693yacc_headers := $(yacc_cpps:$(LOCAL_CPP_EXTENSION)=.h)
694yacc_objects := $(yacc_cpps:$(LOCAL_CPP_EXTENSION)=.o)
695
696ifneq ($(strip $(y_yacc_cpps)),)
697$(y_yacc_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
698    $(TOPDIR)$(LOCAL_PATH)/%.y \
699    $(lex_cpps) $(my_additional_dependencies)
700	$(call transform-y-to-cpp,$(PRIVATE_CPP_EXTENSION))
701$(yacc_headers): $(intermediates)/%.h: $(intermediates)/%$(LOCAL_CPP_EXTENSION)
702endif
703
704ifneq ($(strip $(yy_yacc_cpps)),)
705$(yy_yacc_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
706    $(TOPDIR)$(LOCAL_PATH)/%.yy \
707    $(lex_cpps) $(my_additional_dependencies)
708	$(call transform-y-to-cpp,$(PRIVATE_CPP_EXTENSION))
709$(yacc_headers): $(intermediates)/%.h: $(intermediates)/%$(LOCAL_CPP_EXTENSION)
710endif
711
712ifneq ($(strip $(yacc_cpps)),)
713$(yacc_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
714$(yacc_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
715$(yacc_objects): $(intermediates)/%.o: $(intermediates)/%$(LOCAL_CPP_EXTENSION)
716	$(transform-$(PRIVATE_HOST)cpp-to-o)
717endif
718
719###########################################################
720## LEX: Compile .l and .ll files to .cpp and then to .o.
721###########################################################
722
723l_lex_sources := $(filter %.l,$(my_src_files))
724l_lex_cpps := $(addprefix \
725    $(intermediates)/,$(l_lex_sources:.l=$(LOCAL_CPP_EXTENSION)))
726
727ll_lex_sources := $(filter %.ll,$(my_src_files))
728ll_lex_cpps := $(addprefix \
729    $(intermediates)/,$(ll_lex_sources:.ll=$(LOCAL_CPP_EXTENSION)))
730
731lex_cpps := $(l_lex_cpps) $(ll_lex_cpps)
732lex_objects := $(lex_cpps:$(LOCAL_CPP_EXTENSION)=.o)
733
734ifneq ($(strip $(l_lex_cpps)),)
735$(l_lex_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
736    $(TOPDIR)$(LOCAL_PATH)/%.l
737	$(transform-l-to-cpp)
738endif
739
740ifneq ($(strip $(ll_lex_cpps)),)
741$(ll_lex_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
742    $(TOPDIR)$(LOCAL_PATH)/%.ll
743	$(transform-l-to-cpp)
744endif
745
746ifneq ($(strip $(lex_cpps)),)
747$(lex_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
748$(lex_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
749$(lex_objects): $(intermediates)/%.o: \
750    $(intermediates)/%$(LOCAL_CPP_EXTENSION) \
751    $(my_additional_dependencies) \
752    $(yacc_headers)
753	$(transform-$(PRIVATE_HOST)cpp-to-o)
754endif
755
756###########################################################
757## C++: Compile .cpp files to .o.
758###########################################################
759
760# we also do this on host modules, even though
761# it's not really arm, because there are files that are shared.
762cpp_arm_sources := $(patsubst %$(LOCAL_CPP_EXTENSION).arm,%$(LOCAL_CPP_EXTENSION),$(filter %$(LOCAL_CPP_EXTENSION).arm,$(my_src_files)))
763dotdot_arm_sources := $(filter ../%,$(cpp_arm_sources))
764cpp_arm_sources := $(filter-out ../%,$(cpp_arm_sources))
765cpp_arm_objects := $(addprefix $(intermediates)/,$(cpp_arm_sources:$(LOCAL_CPP_EXTENSION)=.o))
766
767# For source files starting with ../, we remove all the ../ in the object file path,
768# to avoid object file escaping the intermediate directory.
769dotdot_arm_objects :=
770$(foreach s,$(dotdot_arm_sources),\
771  $(eval $(call compile-dotdot-cpp-file,$(s),\
772  $(yacc_cpps) $(proto_generated_headers) $(my_additional_dependencies),\
773  dotdot_arm_objects)))
774
775dotdot_sources := $(filter ../%$(LOCAL_CPP_EXTENSION),$(my_src_files))
776dotdot_objects :=
777$(foreach s,$(dotdot_sources),\
778  $(eval $(call compile-dotdot-cpp-file,$(s),\
779    $(yacc_cpps) $(proto_generated_headers) $(my_additional_dependencies),\
780    dotdot_objects)))
781
782cpp_normal_sources := $(filter-out ../%,$(filter %$(LOCAL_CPP_EXTENSION),$(my_src_files)))
783cpp_normal_objects := $(addprefix $(intermediates)/,$(cpp_normal_sources:$(LOCAL_CPP_EXTENSION)=.o))
784
785$(dotdot_arm_objects) $(cpp_arm_objects): PRIVATE_ARM_MODE := $(arm_objects_mode)
786$(dotdot_arm_objects) $(cpp_arm_objects): PRIVATE_ARM_CFLAGS := $(arm_objects_cflags)
787$(dotdot_objects) $(cpp_normal_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
788$(dotdot_objects) $(cpp_normal_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
789
790cpp_objects        := $(cpp_arm_objects) $(cpp_normal_objects)
791
792ifneq ($(strip $(cpp_objects)),)
793$(cpp_objects): $(intermediates)/%.o: \
794    $(TOPDIR)$(LOCAL_PATH)/%$(LOCAL_CPP_EXTENSION) \
795    $(yacc_cpps) $(proto_generated_headers) \
796    $(my_additional_dependencies)
797	$(transform-$(PRIVATE_HOST)cpp-to-o)
798-include $(cpp_objects:%.o=%.P)
799endif
800
801cpp_objects += $(dotdot_arm_objects) $(dotdot_objects)
802
803###########################################################
804## C++: Compile generated .cpp files to .o.
805###########################################################
806
807gen_cpp_sources := $(filter %$(LOCAL_CPP_EXTENSION),$(my_generated_sources))
808gen_cpp_objects := $(gen_cpp_sources:%$(LOCAL_CPP_EXTENSION)=%.o)
809
810ifneq ($(strip $(gen_cpp_objects)),)
811# Compile all generated files as thumb.
812# TODO: support compiling certain generated files as arm.
813$(gen_cpp_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
814$(gen_cpp_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
815$(gen_cpp_objects): $(intermediates)/%.o: \
816    $(intermediates)/%$(LOCAL_CPP_EXTENSION) $(yacc_cpps) \
817    $(proto_generated_headers) \
818    $(my_additional_dependencies)
819	$(transform-$(PRIVATE_HOST)cpp-to-o)
820-include $(gen_cpp_objects:%.o=%.P)
821endif
822
823###########################################################
824## S: Compile generated .S and .s files to .o.
825###########################################################
826
827gen_S_sources := $(filter %.S,$(my_generated_sources))
828gen_S_objects := $(gen_S_sources:%.S=%.o)
829
830ifneq ($(strip $(gen_S_sources)),)
831$(gen_S_objects): $(intermediates)/%.o: $(intermediates)/%.S \
832    $(my_additional_dependencies)
833	$(transform-$(PRIVATE_HOST)s-to-o)
834-include $(gen_S_objects:%.o=%.P)
835endif
836
837gen_s_sources := $(filter %.s,$(my_generated_sources))
838gen_s_objects := $(gen_s_sources:%.s=%.o)
839
840ifneq ($(strip $(gen_s_objects)),)
841$(gen_s_objects): $(intermediates)/%.o: $(intermediates)/%.s \
842    $(my_additional_dependencies)
843	$(transform-$(PRIVATE_HOST)s-to-o-no-deps)
844-include $(gen_s_objects:%.o=%.P)
845endif
846
847gen_asm_objects := $(gen_S_objects) $(gen_s_objects)
848
849###########################################################
850## o: Include generated .o files in output.
851###########################################################
852
853gen_o_objects := $(filter %.o,$(my_generated_sources))
854
855###########################################################
856## C: Compile .c files to .o.
857###########################################################
858
859c_arm_sources := $(patsubst %.c.arm,%.c,$(filter %.c.arm,$(my_src_files)))
860dotdot_arm_sources := $(filter ../%,$(c_arm_sources))
861c_arm_sources := $(filter-out ../%,$(c_arm_sources))
862c_arm_objects := $(addprefix $(intermediates)/,$(c_arm_sources:.c=.o))
863
864# For source files starting with ../, we remove all the ../ in the object file path,
865# to avoid object file escaping the intermediate directory.
866dotdot_arm_objects :=
867$(foreach s,$(dotdot_arm_sources),\
868  $(eval $(call compile-dotdot-c-file,$(s),\
869    $(yacc_cpps) $(proto_generated_headers) $(my_additional_dependencies),\
870    dotdot_arm_objects)))
871
872dotdot_sources := $(filter ../%.c, $(my_src_files))
873dotdot_objects :=
874$(foreach s, $(dotdot_sources),\
875  $(eval $(call compile-dotdot-c-file,$(s),\
876    $(yacc_cpps) $(proto_generated_headers) $(my_additional_dependencies),\
877    dotdot_objects)))
878
879c_normal_sources := $(filter-out ../%,$(filter %.c,$(my_src_files)))
880c_normal_objects := $(addprefix $(intermediates)/,$(c_normal_sources:.c=.o))
881
882$(dotdot_arm_objects) $(c_arm_objects): PRIVATE_ARM_MODE := $(arm_objects_mode)
883$(dotdot_arm_objects) $(c_arm_objects): PRIVATE_ARM_CFLAGS := $(arm_objects_cflags)
884$(dotdot_objects) $(c_normal_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
885$(dotdot_objects) $(c_normal_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
886
887c_objects        := $(c_arm_objects) $(c_normal_objects)
888
889ifneq ($(strip $(c_objects)),)
890$(c_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.c $(yacc_cpps) $(proto_generated_headers) \
891    $(my_additional_dependencies)
892	$(transform-$(PRIVATE_HOST)c-to-o)
893-include $(c_objects:%.o=%.P)
894endif
895
896c_objects += $(dotdot_arm_objects) $(dotdot_objects)
897
898###########################################################
899## C: Compile generated .c files to .o.
900###########################################################
901
902gen_c_sources := $(filter %.c,$(my_generated_sources))
903gen_c_objects := $(gen_c_sources:%.c=%.o)
904
905ifneq ($(strip $(gen_c_objects)),)
906# Compile all generated files as thumb.
907# TODO: support compiling certain generated files as arm.
908$(gen_c_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
909$(gen_c_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
910$(gen_c_objects): $(intermediates)/%.o: $(intermediates)/%.c $(yacc_cpps) $(proto_generated_headers) \
911    $(my_additional_dependencies)
912	$(transform-$(PRIVATE_HOST)c-to-o)
913-include $(gen_c_objects:%.o=%.P)
914endif
915
916###########################################################
917## ObjC: Compile .m files to .o
918###########################################################
919
920objc_sources := $(filter %.m,$(my_src_files))
921objc_objects := $(addprefix $(intermediates)/,$(objc_sources:.m=.o))
922
923ifneq ($(strip $(objc_objects)),)
924$(objc_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.m $(yacc_cpps) $(proto_generated_headers) \
925    $(my_additional_dependencies)
926	$(transform-$(PRIVATE_HOST)m-to-o)
927-include $(objc_objects:%.o=%.P)
928endif
929
930###########################################################
931## ObjC++: Compile .mm files to .o
932###########################################################
933
934objcpp_sources := $(filter %.mm,$(my_src_files))
935objcpp_objects := $(addprefix $(intermediates)/,$(objcpp_sources:.mm=.o))
936
937ifneq ($(strip $(objcpp_objects)),)
938$(objcpp_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.mm $(yacc_cpps) $(proto_generated_headers) \
939    $(my_additional_dependencies)
940	$(transform-$(PRIVATE_HOST)mm-to-o)
941-include $(objcpp_objects:%.o=%.P)
942endif
943
944###########################################################
945## AS: Compile .S files to .o.
946###########################################################
947
948asm_sources_S := $(filter %.S,$(my_src_files))
949dotdot_sources := $(filter ../%,$(asm_sources_S))
950asm_sources_S := $(filter-out ../%,$(asm_sources_S))
951asm_objects_S := $(addprefix $(intermediates)/,$(asm_sources_S:.S=.o))
952
953dotdot_objects_S :=
954$(foreach s,$(dotdot_sources),\
955  $(eval $(call compile-dotdot-s-file,$(s),\
956    $(my_additional_dependencies),\
957    dotdot_objects_S)))
958
959ifneq ($(strip $(asm_objects_S)),)
960$(asm_objects_S): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.S \
961    $(my_additional_dependencies)
962	$(transform-$(PRIVATE_HOST)s-to-o)
963-include $(asm_objects_S:%.o=%.P)
964endif
965
966asm_sources_s := $(filter %.s,$(my_src_files))
967dotdot_sources := $(filter ../%,$(asm_sources_s))
968asm_sources_s := $(filter-out ../%,$(asm_sources_s))
969asm_objects_s := $(addprefix $(intermediates)/,$(asm_sources_s:.s=.o))
970
971dotdot_objects_s :=
972$(foreach s,$(dotdot_sources),\
973  $(eval $(call compile-dotdot-s-file-no-deps,$(s),\
974    $(my_additional_dependencies),\
975    dotdot_objects_s)))
976
977ifneq ($(strip $(asm_objects_s)),)
978$(asm_objects_s): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.s \
979    $(my_additional_dependencies)
980	$(transform-$(PRIVATE_HOST)s-to-o-no-deps)
981endif
982
983asm_objects := $(dotdot_objects_S) $(dotdot_objects_s) $(asm_objects_S) $(asm_objects_s)
984
985
986# .asm for x86/x86_64 needs to be compiled with yasm.
987asm_sources_asm := $(filter %.asm,$(my_src_files))
988ifneq ($(strip $(asm_sources_asm)),)
989asm_objects_asm := $(addprefix $(intermediates)/,$(asm_sources_asm:.asm=.o))
990$(asm_objects_asm): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.asm \
991    $(my_additional_dependencies)
992	$(transform-asm-to-o)
993
994asm_objects += $(asm_objects_asm)
995endif
996
997
998##########################################################
999## Set up installed module dependency
1000## We cannot compute the full path of the LOCAL_SHARED_LIBRARIES for
1001## they may cusomize their install path with LOCAL_MODULE_PATH
1002##########################################################
1003# Get the list of INSTALLED libraries as module names.
1004ifdef LOCAL_SDK_VERSION
1005  installed_shared_library_module_names := \
1006      $(my_shared_libraries)
1007else
1008  installed_shared_library_module_names := \
1009      $(my_shared_libraries) $(my_system_shared_libraries)
1010endif
1011
1012# The real dependency will be added after all Android.mks are loaded and the install paths
1013# of the shared libraries are determined.
1014ifdef LOCAL_INSTALLED_MODULE
1015ifdef installed_shared_library_module_names
1016$(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)DEPENDENCIES_ON_SHARED_LIBRARIES += \
1017    $(my_register_name):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(sort $(installed_shared_library_module_names)))
1018endif
1019endif
1020
1021
1022####################################################
1023## Import includes
1024####################################################
1025import_includes := $(intermediates)/import_includes
1026import_includes_deps := $(strip \
1027    $(foreach l, $(installed_shared_library_module_names), \
1028      $(call intermediates-dir-for,SHARED_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/export_includes) \
1029    $(foreach l, $(my_static_libraries) $(my_whole_static_libraries), \
1030      $(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/export_includes))
1031$(import_includes): PRIVATE_IMPORT_EXPORT_INCLUDES := $(import_includes_deps)
1032$(import_includes) : $(LOCAL_MODULE_MAKEFILE) $(import_includes_deps)
1033	@echo Import includes file: $@
1034	$(hide) mkdir -p $(dir $@) && rm -f $@
1035ifdef import_includes_deps
1036	$(hide) for f in $(PRIVATE_IMPORT_EXPORT_INCLUDES); do \
1037	  cat $$f >> $@; \
1038	done
1039else
1040	$(hide) touch $@
1041endif
1042
1043###########################################################
1044## Common object handling.
1045###########################################################
1046
1047# some rules depend on asm_objects being first.  If your code depends on
1048# being first, it's reasonable to require it to be assembly
1049normal_objects := \
1050    $(asm_objects) \
1051    $(cpp_objects) \
1052    $(gen_cpp_objects) \
1053    $(gen_asm_objects) \
1054    $(c_objects) \
1055    $(gen_c_objects) \
1056    $(objc_objects) \
1057    $(objcpp_objects) \
1058    $(yacc_objects) \
1059    $(lex_objects) \
1060    $(proto_generated_objects) \
1061    $(addprefix $(TOPDIR)$(LOCAL_PATH)/,$(LOCAL_PREBUILT_OBJ_FILES))
1062
1063all_objects := $(normal_objects) $(gen_o_objects)
1064
1065my_c_includes += $(TOPDIR)$(LOCAL_PATH) $(intermediates) $(generated_sources_dir)
1066
1067ifndef LOCAL_SDK_VERSION
1068  my_c_includes += $(JNI_H_INCLUDE)
1069endif
1070
1071# all_objects includes gen_o_objects which were part of LOCAL_GENERATED_SOURCES;
1072# use normal_objects here to avoid creating circular dependencies. This assumes
1073# that custom build rules which generate .o files don't consume other generated
1074# sources as input (or if they do they take care of that dependency themselves).
1075$(normal_objects) : | $(my_generated_sources)
1076$(all_objects) : | $(import_includes)
1077ALL_C_CPP_ETC_OBJECTS += $(all_objects)
1078
1079
1080###########################################################
1081# Standard library handling.
1082###########################################################
1083
1084###########################################################
1085# The list of libraries that this module will link against are in
1086# these variables.  Each is a list of bare module names like "libc libm".
1087#
1088# LOCAL_SHARED_LIBRARIES
1089# LOCAL_STATIC_LIBRARIES
1090# LOCAL_WHOLE_STATIC_LIBRARIES
1091#
1092# We need to convert the bare names into the dependencies that
1093# we'll use for LOCAL_BUILT_MODULE and LOCAL_INSTALLED_MODULE.
1094# LOCAL_BUILT_MODULE should depend on the BUILT versions of the
1095# libraries, so that simply building this module doesn't force
1096# an install of a library.  Similarly, LOCAL_INSTALLED_MODULE
1097# should depend on the INSTALLED versions of the libraries so
1098# that they get installed when this module does.
1099###########################################################
1100# NOTE:
1101# WHOLE_STATIC_LIBRARIES are libraries that are pulled into the
1102# module without leaving anything out, which is useful for turning
1103# a collection of .a files into a .so file.  Linking against a
1104# normal STATIC_LIBRARY will only pull in code/symbols that are
1105# referenced by the module. (see gcc/ld's --whole-archive option)
1106###########################################################
1107
1108# Get the list of BUILT libraries, which are under
1109# various intermediates directories.
1110so_suffix := $($(my_prefix)SHLIB_SUFFIX)
1111a_suffix := $($(my_prefix)STATIC_LIB_SUFFIX)
1112
1113ifdef LOCAL_SDK_VERSION
1114built_shared_libraries := \
1115    $(addprefix $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
1116      $(addsuffix $(so_suffix), \
1117        $(my_shared_libraries)))
1118
1119# Add the NDK libraries to the built module dependency
1120my_system_shared_libraries_fullpath := \
1121    $(my_ndk_stl_shared_lib_fullpath) \
1122    $(addprefix $(my_ndk_sysroot_lib)/, \
1123        $(addsuffix $(so_suffix), $(my_system_shared_libraries)))
1124
1125built_shared_libraries += $(my_system_shared_libraries_fullpath)
1126else
1127built_shared_libraries := \
1128    $(addprefix $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
1129      $(addsuffix $(so_suffix), \
1130        $(installed_shared_library_module_names)))
1131endif
1132
1133built_static_libraries := \
1134    $(foreach lib,$(my_static_libraries), \
1135      $(call intermediates-dir-for, \
1136        STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/$(lib)$(a_suffix))
1137
1138ifdef LOCAL_SDK_VERSION
1139built_static_libraries += $(my_ndk_stl_static_lib)
1140endif
1141
1142built_whole_libraries := \
1143    $(foreach lib,$(my_whole_static_libraries), \
1144      $(call intermediates-dir-for, \
1145        STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/$(lib)$(a_suffix))
1146
1147# We don't care about installed static libraries, since the
1148# libraries have already been linked into the module at that point.
1149# We do, however, care about the NOTICE files for any static
1150# libraries that we use. (see notice_files.mk)
1151
1152installed_static_library_notice_file_targets := \
1153    $(foreach lib,$(my_static_libraries) $(my_whole_static_libraries), \
1154      NOTICE-$(if $(LOCAL_IS_HOST_MODULE),HOST,TARGET)-STATIC_LIBRARIES-$(lib))
1155
1156# Default is -fno-rtti.
1157ifeq ($(strip $(LOCAL_RTTI_FLAG)),)
1158LOCAL_RTTI_FLAG := -fno-rtti
1159endif
1160
1161###########################################################
1162# Rule-specific variable definitions
1163###########################################################
1164
1165ifeq ($(my_clang),true)
1166my_cflags += $(LOCAL_CLANG_CFLAGS)
1167my_conlyflags += $(LOCAL_CLANG_CONLYFLAGS)
1168my_cppflags += $(LOCAL_CLANG_CPPFLAGS)
1169my_cflags_no_override += $(GLOBAL_CLANG_CFLAGS_NO_OVERRIDE)
1170my_cppflags_no_override += $(GLOBAL_CLANG_CPPFLAGS_NO_OVERRIDE)
1171my_asflags += $(LOCAL_CLANG_ASFLAGS)
1172my_ldflags += $(LOCAL_CLANG_LDFLAGS)
1173my_cflags += $(LOCAL_CLANG_CFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CLANG_CFLAGS_$(my_32_64_bit_suffix))
1174my_conlyflags += $(LOCAL_CLANG_CONLYFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CLANG_CONLYFLAGS_$(my_32_64_bit_suffix))
1175my_cppflags += $(LOCAL_CLANG_CPPFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CLANG_CPPFLAGS_$(my_32_64_bit_suffix))
1176my_ldflags += $(LOCAL_CLANG_LDFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CLANG_LDFLAGS_$(my_32_64_bit_suffix))
1177my_asflags += $(LOCAL_CLANG_ASFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CLANG_ASFLAGS_$(my_32_64_bit_suffix))
1178my_cflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(my_cflags))
1179my_cppflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(my_cppflags))
1180my_asflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(my_asflags))
1181my_ldflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(my_ldflags))
1182endif
1183
1184ifeq ($(my_fdo_build), true)
1185  my_cflags := $(patsubst -Os,-O2,$(my_cflags))
1186  fdo_incompatible_flags := -fno-early-inlining -finline-limit=%
1187  my_cflags := $(filter-out $(fdo_incompatible_flags),$(my_cflags))
1188endif
1189
1190# No one should ever use this flag. On GCC it's mere presence will disable all
1191# warnings, even those that are specified after it (contrary to typical warning
1192# flag behavior). This circumvents CFLAGS_NO_OVERRIDE from forcibly enabling the
1193# warnings that are *always* bugs.
1194my_illegal_flags := -w
1195my_cflags := $(filter-out $(my_illegal_flags),$(my_cflags))
1196my_cppflags := $(filter-out $(my_illegal_flags),$(my_cppflags))
1197my_conlyflags := $(filter-out $(my_illegal_flags),$(my_conlyflags))
1198
1199$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_YACCFLAGS := $(LOCAL_YACCFLAGS)
1200$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASFLAGS := $(my_asflags)
1201$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CONLYFLAGS := $(my_conlyflags)
1202$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CFLAGS := $(my_cflags)
1203$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CPPFLAGS := $(my_cppflags)
1204$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CFLAGS_NO_OVERRIDE := $(my_cflags_no_override)
1205$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CPPFLAGS_NO_OVERRIDE := $(my_cppflags_no_override)
1206$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RTTI_FLAG := $(LOCAL_RTTI_FLAG)
1207$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEBUG_CFLAGS := $(debug_cflags)
1208$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_C_INCLUDES := $(my_c_includes)
1209$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_IMPORT_INCLUDES := $(import_includes)
1210$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDFLAGS := $(my_ldflags)
1211$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDLIBS := $(my_ldlibs)
1212
1213# this is really the way to get the files onto the command line instead
1214# of using $^, because then LOCAL_ADDITIONAL_DEPENDENCIES doesn't work
1215$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_SHARED_LIBRARIES := $(built_shared_libraries)
1216$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_STATIC_LIBRARIES := $(built_static_libraries)
1217$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_WHOLE_STATIC_LIBRARIES := $(built_whole_libraries)
1218$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_OBJECTS := $(all_objects)
1219
1220###########################################################
1221# Define library dependencies.
1222###########################################################
1223# all_libraries is used for the dependencies on LOCAL_BUILT_MODULE.
1224all_libraries := \
1225    $(built_shared_libraries) \
1226    $(built_static_libraries) \
1227    $(built_whole_libraries)
1228
1229# Also depend on the notice files for any static libraries that
1230# are linked into this module.  This will force them to be installed
1231# when this module is.
1232$(LOCAL_INSTALLED_MODULE): | $(installed_static_library_notice_file_targets)
1233
1234###########################################################
1235# Export includes
1236###########################################################
1237export_includes := $(intermediates)/export_includes
1238$(export_includes): PRIVATE_EXPORT_C_INCLUDE_DIRS := $(my_export_c_include_dirs)
1239# Make sure .pb.h are already generated before any dependent source files get compiled.
1240$(export_includes) : $(LOCAL_MODULE_MAKEFILE) $(proto_generated_headers) $(dbus_generated_headers)
1241	@echo Export includes file: $< -- $@
1242	$(hide) mkdir -p $(dir $@) && rm -f $@
1243ifdef my_export_c_include_dirs
1244	$(hide) for d in $(PRIVATE_EXPORT_C_INCLUDE_DIRS); do \
1245	        echo "-I $$d" >> $@; \
1246	        done
1247else
1248	$(hide) touch $@
1249endif
1250
1251# Make sure export_includes gets generated when you are running mm/mmm
1252$(LOCAL_BUILT_MODULE) : | $(export_includes)
1253