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