blob: 3893d035396455a192169bfa87c22ace8a24d5a9 [file] [log] [blame]
The Android Open Source Project88b60792009-03-03 19:28:42 -08001###########################################################
2## Standard rules for building binary object files from
3## asm/c/cpp/yacc/lex source files.
4##
5## The list of object files is exported in $(all_objects).
6###########################################################
7
Ying Wang1a081002010-07-13 14:55:47 -07008my_ndk_version_root :=
Ying Wang848020f2012-08-14 10:13:16 -07009ifdef LOCAL_SDK_VERSION
Ying Wangfe1bfe72012-08-14 11:08:03 -070010 ifdef LOCAL_NDK_VERSION
11 $(error $(LOCAL_PATH): LOCAL_NDK_VERSION is now retired.)
12 endif
Ying Wang1a081002010-07-13 14:55:47 -070013 ifdef LOCAL_IS_HOST_MODULE
Ian Rogers76a6dc32012-10-01 16:36:23 -070014 $(error $(LOCAL_PATH): LOCAL_SDK_VERSION cannot be used in host module)
Ying Wang1a081002010-07-13 14:55:47 -070015 endif
Ying Wang848020f2012-08-14 10:13:16 -070016 my_ndk_source_root := $(HISTORICAL_NDK_VERSIONS_ROOT)/current/sources
17 my_ndk_version_root := $(HISTORICAL_NDK_VERSIONS_ROOT)/current/platforms/android-$(LOCAL_SDK_VERSION)/arch-$(TARGET_ARCH)
Ying Wangcce4c972011-03-03 18:53:53 -080018
19 # Set up the NDK stl variant. Starting from NDK-r5 the c++ stl resides in a separate location.
20 # See ndk/docs/CPLUSPLUS-SUPPORT.html
21 my_ndk_stl_include_path :=
22 my_ndk_stl_shared_lib_fullpath :=
23 my_ndk_stl_shared_lib :=
24 my_ndk_stl_static_lib :=
25 ifeq (,$(LOCAL_NDK_STL_VARIANT))
26 LOCAL_NDK_STL_VARIANT := system
27 endif
28 ifneq (1,$(words $(filter system stlport_static stlport_shared gnustl_static, $(LOCAL_NDK_STL_VARIANT))))
Ying Wang848020f2012-08-14 10:13:16 -070029 $(error $(LOCAL_PATH): Unknown LOCAL_NDK_STL_VARIANT $(LOCAL_NDK_STL_VARIANT))
Ying Wangcce4c972011-03-03 18:53:53 -080030 endif
31 ifeq (system,$(LOCAL_NDK_STL_VARIANT))
32 my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/system/include
33 # for "system" variant, the shared library exists in the system library and -lstdc++ is added by default.
34 else # LOCAL_NDK_STL_VARIANT is not system
35 ifneq (,$(filter stlport_%, $(LOCAL_NDK_STL_VARIANT)))
36 my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/stlport/stlport
37 ifeq (stlport_static,$(LOCAL_NDK_STL_VARIANT))
38 my_ndk_stl_static_lib := $(my_ndk_source_root)/cxx-stl/stlport/libs/$(TARGET_CPU_ABI)/libstlport_static.a
39 else
40 my_ndk_stl_shared_lib_fullpath := $(my_ndk_source_root)/cxx-stl/stlport/libs/$(TARGET_CPU_ABI)/libstlport_shared.so
41 my_ndk_stl_shared_lib := -lstlport_shared
42 endif
43 else
44 # LOCAL_NDK_STL_VARIANT is gnustl_static
Ying Wangd9020c22011-09-07 14:31:47 -070045 my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/libs/$(TARGET_CPU_ABI)/include \
46 $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/include
Ying Wang848020f2012-08-14 10:13:16 -070047 my_ndk_stl_static_lib := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/libs/$(TARGET_CPU_ABI)/libgnustl_static.a
Ying Wangcce4c972011-03-03 18:53:53 -080048 endif
49 endif
Ying Wang1a081002010-07-13 14:55:47 -070050endif
51
Ying Wang704c0c92011-09-15 13:50:52 -070052##################################################
53# Compute the dependency of the shared libraries
54##################################################
55# On the target, we compile with -nostdlib, so we must add in the
56# default system shared libraries, unless they have requested not
57# to by supplying a LOCAL_SYSTEM_SHARED_LIBRARIES value. One would
58# supply that, for example, when building libc itself.
59ifdef LOCAL_IS_HOST_MODULE
60 ifeq ($(LOCAL_SYSTEM_SHARED_LIBRARIES),none)
61 LOCAL_SYSTEM_SHARED_LIBRARIES :=
62 endif
63else
64 ifeq ($(LOCAL_SYSTEM_SHARED_LIBRARIES),none)
65 LOCAL_SYSTEM_SHARED_LIBRARIES := $(TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES)
66 endif
67endif
68
Ying Wang848020f2012-08-14 10:13:16 -070069ifdef LOCAL_SDK_VERSION
Ying Wang704c0c92011-09-15 13:50:52 -070070 # Get the list of INSTALLED libraries as module names.
Ian Rogers76a6dc32012-10-01 16:36:23 -070071 # We cannot compute the full path of the LOCAL_SHARED_LIBRARIES for
Ying Wang704c0c92011-09-15 13:50:52 -070072 # they may cusomize their install path with LOCAL_MODULE_PATH
73 installed_shared_library_module_names := \
74 $(LOCAL_SHARED_LIBRARIES)
75else
76 installed_shared_library_module_names := \
77 $(LOCAL_SYSTEM_SHARED_LIBRARIES) $(LOCAL_SHARED_LIBRARIES)
78endif
Ying Wang9485a572013-02-22 14:32:30 -080079installed_shared_library_module_names := $(sort $(installed_shared_library_module_names))
Ying Wang704c0c92011-09-15 13:50:52 -070080
The Android Open Source Project88b60792009-03-03 19:28:42 -080081#######################################
82include $(BUILD_SYSTEM)/base_rules.mk
83#######################################
Evgeniy Stepanov6cc9c062012-03-30 12:15:12 +040084
Ying Wang9485a572013-02-22 14:32:30 -080085# The real dependency will be added after all Android.mks are loaded and the install paths
86# of the shared libraries are determined.
87ifdef LOCAL_INSTALLED_MODULE
88ifdef installed_shared_library_module_names
Ying Wangd6b1d612013-04-15 17:32:21 -070089$(my_prefix)DEPENDENCIES_ON_SHARED_LIBRARIES += $(LOCAL_MODULE):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(installed_shared_library_module_names))
Ying Wang9485a572013-02-22 14:32:30 -080090endif
91endif
92
Evgeniy Stepanov6cc9c062012-03-30 12:15:12 +040093ifeq ($(strip $(LOCAL_ADDRESS_SANITIZER)),true)
94 LOCAL_CLANG := true
95 LOCAL_CFLAGS += $(ADDRESS_SANITIZER_CONFIG_EXTRA_CFLAGS)
96 LOCAL_LDFLAGS += $(ADDRESS_SANITIZER_CONFIG_EXTRA_LDFLAGS)
97 LOCAL_SHARED_LIBRARIES += $(ADDRESS_SANITIZER_CONFIG_EXTRA_SHARED_LIBRARIES)
98 LOCAL_STATIC_LIBRARIES += $(ADDRESS_SANITIZER_CONFIG_EXTRA_STATIC_LIBRARIES)
99endif
100
Shih-wei Liaoc8dfc162013-01-27 01:45:59 -0800101# Add in libcompiler_rt for all regular device builds
Mike Lockwooddaf5e222012-10-18 10:17:47 -0700102ifeq (,$(LOCAL_SDK_VERSION)$(LOCAL_IS_HOST_MODULE)$(WITHOUT_LIBCOMPILER_RT))
Stephen Hinesc72f3962012-06-11 14:53:34 -0700103 LOCAL_STATIC_LIBRARIES += $(COMPILER_RT_CONFIG_EXTRA_STATIC_LIBRARIES)
104endif
105
Ying Wangdfbe79b2012-03-22 11:26:22 -0700106my_compiler_dependencies :=
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400107ifeq ($(strip $(LOCAL_CLANG)),true)
108 LOCAL_CFLAGS += $(CLANG_CONFIG_EXTRA_CFLAGS)
Ying Wang65d78522012-08-10 16:30:42 -0700109 LOCAL_ASFLAGS += $(CLANG_CONFIG_EXTRA_ASFLAGS)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400110 LOCAL_LDFLAGS += $(CLANG_CONFIG_EXTRA_LDFLAGS)
Ying Wangdfbe79b2012-03-22 11:26:22 -0700111 my_compiler_dependencies := $(CLANG) $(CLANG_CXX)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400112endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800113
Jing Yu2dcc8062009-09-21 16:31:50 -0700114####################################################
115## Add FDO flags if FDO is turned on and supported
116####################################################
117ifeq ($(strip $(LOCAL_NO_FDO_SUPPORT)),)
synergydev4a605762013-08-05 02:44:37 -0700118 ifeq ($(strip $(LOCAL_IS_HOST_MODULE)),)
119 LOCAL_CFLAGS += $(TARGET_FDO_CFLAGS)
120 LOCAL_CPPFLAGS += $(TARGET_FDO_CFLAGS)
121 LOCAL_LDFLAGS += $(TARGET_FDO_CFLAGS)
122 endif
Jing Yu2dcc8062009-09-21 16:31:50 -0700123endif
124
Kito Cheng70dc3e12012-06-15 15:15:50 +0800125####################################################
126## Add profiling flags if aprof is turned on
127####################################################
128ifeq ($(strip $(LOCAL_ENABLE_APROF)),true)
129 # -ffunction-sections and -fomit-frame-pointer are conflict with -pg
130 LOCAL_CFLAGS += -fno-omit-frame-pointer -fno-function-sections -pg
131 LOCAL_CPPFLAGS += -fno-omit-frame-pointer -fno-function-sections -pg
132endif
133
The Android Open Source Project88b60792009-03-03 19:28:42 -0800134###########################################################
Jim Huang20d1ba62010-10-14 16:15:56 +0800135## Explicitly declare assembly-only __ASSEMBLY__ macro for
136## assembly source
137###########################################################
138LOCAL_ASFLAGS += -D__ASSEMBLY__
139
140###########################################################
Ying Wang1a081002010-07-13 14:55:47 -0700141## Define PRIVATE_ variables from global vars
142###########################################################
Ying Wang848020f2012-08-14 10:13:16 -0700143ifdef LOCAL_SDK_VERSION
Ying Wang1a081002010-07-13 14:55:47 -0700144my_target_project_includes :=
Evgeniy Stepanova7095e92012-03-30 12:18:52 +0400145my_target_c_includes := $(my_ndk_stl_include_path) $(my_ndk_version_root)/usr/include
Ying Wangda4bf422012-08-16 16:45:01 -0700146
147# filter out including of AndroidConfig.h in system/core.
148TARGET_GLOBAL_CFLAGS_NO_ANDCONF ?= $(subst $(TARGET_ANDROID_CONFIG_CFLAGS),,\
149 $(TARGET_GLOBAL_CFLAGS))
150my_target_global_cflags := $(TARGET_GLOBAL_CFLAGS_NO_ANDCONF)
Ying Wang1a081002010-07-13 14:55:47 -0700151else
152my_target_project_includes := $(TARGET_PROJECT_INCLUDES)
Evgeniy Stepanova7095e92012-03-30 12:18:52 +0400153my_target_c_includes := $(TARGET_C_INCLUDES)
Evgeniy Stepanova7095e92012-03-30 12:18:52 +0400154ifeq ($(strip $(LOCAL_CLANG)),true)
Ying Wangda4bf422012-08-16 16:45:01 -0700155my_target_c_includes += $(CLANG_CONFIG_EXTRA_TARGET_C_INCLUDES)
156my_target_global_cflags := $(TARGET_GLOBAL_CLANG_FLAGS)
157else
158my_target_global_cflags := $(TARGET_GLOBAL_CFLAGS)
159endif # LOCAL_CLANG
160endif # LOCAL_SDK_VERSION
161
Ying Wang1a081002010-07-13 14:55:47 -0700162$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_PROJECT_INCLUDES := $(my_target_project_includes)
Evgeniy Stepanova7095e92012-03-30 12:18:52 +0400163$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_C_INCLUDES := $(my_target_c_includes)
Ying Wang1a081002010-07-13 14:55:47 -0700164$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CFLAGS := $(my_target_global_cflags)
Ying Wangda4bf422012-08-16 16:45:01 -0700165$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CPPFLAGS := $(TARGET_GLOBAL_CPPFLAGS)
Ying Wang1a081002010-07-13 14:55:47 -0700166
167###########################################################
The Android Open Source Project88b60792009-03-03 19:28:42 -0800168## Define PRIVATE_ variables used by multiple module types
169###########################################################
170$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_NO_DEFAULT_COMPILER_FLAGS := \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700171 $(strip $(LOCAL_NO_DEFAULT_COMPILER_FLAGS))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800172
173ifeq ($(strip $(LOCAL_CC)),)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400174 ifeq ($(strip $(LOCAL_CLANG)),true)
175 LOCAL_CC := $(CLANG)
176 else
177 LOCAL_CC := $($(my_prefix)CC)
178 endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800179endif
180$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CC := $(LOCAL_CC)
181
182ifeq ($(strip $(LOCAL_CXX)),)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400183 ifeq ($(strip $(LOCAL_CLANG)),true)
184 LOCAL_CXX := $(CLANG_CXX)
185 else
186 LOCAL_CXX := $($(my_prefix)CXX)
187 endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800188endif
189$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CXX := $(LOCAL_CXX)
190
191# TODO: support a mix of standard extensions so that this isn't necessary
192LOCAL_CPP_EXTENSION := $(strip $(LOCAL_CPP_EXTENSION))
193ifeq ($(LOCAL_CPP_EXTENSION),)
194 LOCAL_CPP_EXTENSION := .cpp
195endif
196$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CPP_EXTENSION := $(LOCAL_CPP_EXTENSION)
197
198# Certain modules like libdl have to have symbols resolved at runtime and blow
199# up if --no-undefined is passed to the linker.
200ifeq ($(strip $(LOCAL_NO_DEFAULT_COMPILER_FLAGS)),)
201ifeq ($(strip $(LOCAL_ALLOW_UNDEFINED_SYMBOLS)),)
202 LOCAL_LDFLAGS := $(LOCAL_LDFLAGS) $($(my_prefix)NO_UNDEFINED_LDFLAGS)
203endif
204endif
205
Ying Wangfcdabd42011-04-25 14:22:41 -0700206ifeq (true,$(LOCAL_GROUP_STATIC_LIBRARIES))
207$(LOCAL_BUILT_MODULE): PRIVATE_GROUP_STATIC_LIBRARIES := true
208else
209$(LOCAL_BUILT_MODULE): PRIVATE_GROUP_STATIC_LIBRARIES :=
210endif
211
The Android Open Source Project88b60792009-03-03 19:28:42 -0800212###########################################################
213## Define arm-vs-thumb-mode flags.
214###########################################################
215LOCAL_ARM_MODE := $(strip $(LOCAL_ARM_MODE))
Chih-Wei Huang0d09e582010-07-09 10:07:52 +0800216ifeq ($(TARGET_ARCH),arm)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800217arm_objects_mode := $(if $(LOCAL_ARM_MODE),$(LOCAL_ARM_MODE),arm)
218normal_objects_mode := $(if $(LOCAL_ARM_MODE),$(LOCAL_ARM_MODE),thumb)
219
Dave Bort95282482009-04-23 18:44:55 -0700220# Read the values from something like TARGET_arm_CFLAGS or
221# TARGET_thumb_CFLAGS. HOST_(arm|thumb)_CFLAGS values aren't
222# actually used (although they are usually empty).
Evgeniy Stepanovf50f4c52012-04-05 11:44:37 +0400223ifeq ($(strip $(LOCAL_CLANG)),true)
224arm_objects_cflags := $($(my_prefix)$(arm_objects_mode)_CLANG_CFLAGS)
225normal_objects_cflags := $($(my_prefix)$(normal_objects_mode)_CLANG_CFLAGS)
226else
Dave Bort95282482009-04-23 18:44:55 -0700227arm_objects_cflags := $($(my_prefix)$(arm_objects_mode)_CFLAGS)
228normal_objects_cflags := $($(my_prefix)$(normal_objects_mode)_CFLAGS)
Evgeniy Stepanovf50f4c52012-04-05 11:44:37 +0400229endif
230
Chih-Wei Huang0d09e582010-07-09 10:07:52 +0800231else
232arm_objects_mode :=
233normal_objects_mode :=
234arm_objects_cflags :=
235normal_objects_cflags :=
236endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800237
238###########################################################
239## Define per-module debugging flags. Users can turn on
240## debugging for a particular module by setting DEBUG_MODULE_ModuleName
241## to a non-empty value in their environment or buildspec.mk,
242## and setting HOST_/TARGET_CUSTOM_DEBUG_CFLAGS to the
243## debug flags that they want to use.
244###########################################################
245ifdef DEBUG_MODULE_$(strip $(LOCAL_MODULE))
246 debug_cflags := $($(my_prefix)CUSTOM_DEBUG_CFLAGS)
247else
248 debug_cflags :=
249endif
250
Tim Murraya7aa8002012-10-29 16:06:00 -0700251####################################################
252## Compile RenderScript with reflected C++
253####################################################
254
255renderscript_sources := $(filter %.rs %.fs,$(LOCAL_SRC_FILES))
256
257ifneq (,$(renderscript_sources))
258
259renderscript_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(renderscript_sources))
260RenderScript_file_stamp := $(intermediates)/RenderScriptCPP.stamp
261renderscript_intermediate := $(intermediates)/renderscript
262
263ifeq ($(LOCAL_RENDERSCRIPT_CC),)
264LOCAL_RENDERSCRIPT_CC := $(LLVM_RS_CC)
265endif
266
267# Turn on all warnings and warnings as errors for RS compiles.
268# This can be disabled with LOCAL_RENDERSCRIPT_FLAGS := -Wno-error
269renderscript_flags := -Wall -Werror
270renderscript_flags += $(LOCAL_RENDERSCRIPT_FLAGS)
271
272LOCAL_RENDERSCRIPT_INCLUDES := \
273 $(TOPDIR)external/clang/lib/Headers \
274 $(TOPDIR)frameworks/rs/scriptc \
275 $(LOCAL_RENDERSCRIPT_INCLUDES)
276
277ifneq ($(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE),)
278LOCAL_RENDERSCRIPT_INCLUDES := $(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE)
279endif
280
281$(RenderScript_file_stamp): PRIVATE_RS_INCLUDES := $(LOCAL_RENDERSCRIPT_INCLUDES)
282$(RenderScript_file_stamp): PRIVATE_RS_CC := $(LOCAL_RENDERSCRIPT_CC)
283$(RenderScript_file_stamp): PRIVATE_RS_FLAGS := $(renderscript_flags)
284$(RenderScript_file_stamp): PRIVATE_RS_SOURCE_FILES := $(renderscript_sources_fullpath)
285$(RenderScript_file_stamp): PRIVATE_RS_OUTPUT_DIR := $(renderscript_intermediate)
286$(RenderScript_file_stamp): $(renderscript_sources_fullpath) $(LOCAL_RENDERSCRIPT_CC)
287 $(transform-renderscripts-to-cpp-and-bc)
288
289# include the dependency files (.d) generated by llvm-rs-cc.
290renderscript_generated_dep_files := $(addprefix $(renderscript_intermediate)/, \
291 $(patsubst %.fs,%.d, $(patsubst %.rs,%.d, $(notdir $(renderscript_sources)))))
292-include $(renderscript_generated_dep_files)
293
294LOCAL_INTERMEDIATE_TARGETS += $(RenderScript_file_stamp)
295
296rs_generated_cpps := $(addprefix \
297 $(renderscript_intermediate)/ScriptC_,$(patsubst %.fs,%.cpp, $(patsubst %.rs,%.cpp, \
298 $(notdir $(renderscript_sources)))))
299
300$(rs_generated_cpps) : $(RenderScript_file_stamp)
301
302LOCAL_C_INCLUDES += $(renderscript_intermediate)
303LOCAL_GENERATED_SOURCES += $(rs_generated_cpps)
304
305endif
306
307
The Android Open Source Project88b60792009-03-03 19:28:42 -0800308###########################################################
309## Stuff source generated from one-off tools
310###########################################################
311$(LOCAL_GENERATED_SOURCES): PRIVATE_MODULE := $(LOCAL_MODULE)
312
313ALL_GENERATED_SOURCES += $(LOCAL_GENERATED_SOURCES)
314
315
316###########################################################
Ying Wanga5fc87a2010-11-02 18:43:16 -0700317## Compile the .proto files to .cc and then to .o
318###########################################################
319proto_sources := $(filter %.proto,$(LOCAL_SRC_FILES))
320proto_generated_objects :=
321proto_generated_headers :=
322ifneq ($(proto_sources),)
323proto_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(proto_sources))
324proto_generated_cc_sources_dir := $(intermediates)/proto
325proto_generated_cc_sources := $(addprefix $(proto_generated_cc_sources_dir)/, \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700326 $(patsubst %.proto,%.pb.cc,$(proto_sources_fullpath)))
Ying Wanga5fc87a2010-11-02 18:43:16 -0700327proto_generated_objects := $(patsubst %.cc,%.o, $(proto_generated_cc_sources))
328
329$(proto_generated_cc_sources): PRIVATE_PROTO_INCLUDES := $(TOP)
330$(proto_generated_cc_sources): PRIVATE_PROTO_CC_OUTPUT_DIR := $(proto_generated_cc_sources_dir)
Ying Wang33c0d952010-11-05 11:30:58 -0700331$(proto_generated_cc_sources): PRIVATE_PROTOC_FLAGS := $(LOCAL_PROTOC_FLAGS)
Ying Wanga5fc87a2010-11-02 18:43:16 -0700332$(proto_generated_cc_sources): $(proto_generated_cc_sources_dir)/%.pb.cc: %.proto $(PROTOC)
333 $(transform-proto-to-cc)
334
335proto_generated_headers := $(patsubst %.pb.cc,%.pb.h, $(proto_generated_cc_sources))
336$(proto_generated_headers): $(proto_generated_cc_sources_dir)/%.pb.h: $(proto_generated_cc_sources_dir)/%.pb.cc
337
Ying Wang022a7b32012-06-13 11:38:10 -0700338$(proto_generated_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
339$(proto_generated_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
Narayan Kamath21094872012-04-02 18:19:31 +0100340$(proto_generated_objects): $(proto_generated_cc_sources_dir)/%.o: $(proto_generated_cc_sources_dir)/%.cc $(proto_generated_headers)
Ying Wanga5fc87a2010-11-02 18:43:16 -0700341 $(transform-$(PRIVATE_HOST)cpp-to-o)
342-include $(proto_generated_objects:%.o=%.P)
343
344LOCAL_C_INCLUDES += external/protobuf/src $(proto_generated_cc_sources_dir)
345LOCAL_CFLAGS += -DGOOGLE_PROTOBUF_NO_RTTI
346ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),full)
347LOCAL_STATIC_LIBRARIES += libprotobuf-cpp-2.3.0-full
348else
349LOCAL_STATIC_LIBRARIES += libprotobuf-cpp-2.3.0-lite
350endif
351endif
352
353
354###########################################################
The Android Open Source Project88b60792009-03-03 19:28:42 -0800355## YACC: Compile .y files to .cpp and the to .o.
356###########################################################
357
358yacc_sources := $(filter %.y,$(LOCAL_SRC_FILES))
359yacc_cpps := $(addprefix \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700360 $(intermediates)/,$(yacc_sources:.y=$(LOCAL_CPP_EXTENSION)))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800361yacc_headers := $(yacc_cpps:$(LOCAL_CPP_EXTENSION)=.h)
362yacc_objects := $(yacc_cpps:$(LOCAL_CPP_EXTENSION)=.o)
363
364ifneq ($(strip $(yacc_cpps)),)
365$(yacc_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700366 $(TOPDIR)$(LOCAL_PATH)/%.y \
367 $(lex_cpps) $(LOCAL_ADDITIONAL_DEPENDENCIES)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800368 $(call transform-y-to-cpp,$(PRIVATE_CPP_EXTENSION))
369$(yacc_headers): $(intermediates)/%.h: $(intermediates)/%$(LOCAL_CPP_EXTENSION)
370
371$(yacc_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
372$(yacc_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
373$(yacc_objects): $(intermediates)/%.o: $(intermediates)/%$(LOCAL_CPP_EXTENSION)
374 $(transform-$(PRIVATE_HOST)cpp-to-o)
375endif
376
377###########################################################
378## LEX: Compile .l files to .cpp and then to .o.
379###########################################################
380
381lex_sources := $(filter %.l,$(LOCAL_SRC_FILES))
382lex_cpps := $(addprefix \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700383 $(intermediates)/,$(lex_sources:.l=$(LOCAL_CPP_EXTENSION)))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800384lex_objects := $(lex_cpps:$(LOCAL_CPP_EXTENSION)=.o)
385
386ifneq ($(strip $(lex_cpps)),)
387$(lex_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700388 $(TOPDIR)$(LOCAL_PATH)/%.l
The Android Open Source Project88b60792009-03-03 19:28:42 -0800389 $(transform-l-to-cpp)
390
391$(lex_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
392$(lex_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
393$(lex_objects): $(intermediates)/%.o: \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700394 $(intermediates)/%$(LOCAL_CPP_EXTENSION) \
395 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
396 $(yacc_headers)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800397 $(transform-$(PRIVATE_HOST)cpp-to-o)
398endif
399
400###########################################################
401## C++: Compile .cpp files to .o.
402###########################################################
403
Jeff Browne33ba4c2011-07-11 22:11:46 -0700404# we also do this on host modules, even though
The Android Open Source Project88b60792009-03-03 19:28:42 -0800405# it's not really arm, because there are files that are shared.
406cpp_arm_sources := $(patsubst %$(LOCAL_CPP_EXTENSION).arm,%$(LOCAL_CPP_EXTENSION),$(filter %$(LOCAL_CPP_EXTENSION).arm,$(LOCAL_SRC_FILES)))
407cpp_arm_objects := $(addprefix $(intermediates)/,$(cpp_arm_sources:$(LOCAL_CPP_EXTENSION)=.o))
408
409cpp_normal_sources := $(filter %$(LOCAL_CPP_EXTENSION),$(LOCAL_SRC_FILES))
410cpp_normal_objects := $(addprefix $(intermediates)/,$(cpp_normal_sources:$(LOCAL_CPP_EXTENSION)=.o))
411
412$(cpp_arm_objects): PRIVATE_ARM_MODE := $(arm_objects_mode)
413$(cpp_arm_objects): PRIVATE_ARM_CFLAGS := $(arm_objects_cflags)
414$(cpp_normal_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
415$(cpp_normal_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
416
417cpp_objects := $(cpp_arm_objects) $(cpp_normal_objects)
418
419ifneq ($(strip $(cpp_objects)),)
420$(cpp_objects): $(intermediates)/%.o: \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700421 $(TOPDIR)$(LOCAL_PATH)/%$(LOCAL_CPP_EXTENSION) \
Ying Wang9c3aa052013-02-20 13:34:05 -0800422 $(yacc_cpps) $(proto_generated_headers) \
423 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
424 | $(my_compiler_dependencies)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800425 $(transform-$(PRIVATE_HOST)cpp-to-o)
426-include $(cpp_objects:%.o=%.P)
427endif
428
429###########################################################
430## C++: Compile generated .cpp files to .o.
431###########################################################
432
433gen_cpp_sources := $(filter %$(LOCAL_CPP_EXTENSION),$(LOCAL_GENERATED_SOURCES))
434gen_cpp_objects := $(gen_cpp_sources:%$(LOCAL_CPP_EXTENSION)=%.o)
435
436ifneq ($(strip $(gen_cpp_objects)),)
437# Compile all generated files as thumb.
438# TODO: support compiling certain generated files as arm.
439$(gen_cpp_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
440$(gen_cpp_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400441$(gen_cpp_objects): $(intermediates)/%.o: \
442 $(intermediates)/%$(LOCAL_CPP_EXTENSION) $(yacc_cpps) \
Ying Wang9c3aa052013-02-20 13:34:05 -0800443 $(proto_generated_headers) \
444 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
445 | $(my_compiler_dependencies)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800446 $(transform-$(PRIVATE_HOST)cpp-to-o)
447-include $(gen_cpp_objects:%.o=%.P)
448endif
449
450###########################################################
451## S: Compile generated .S and .s files to .o.
452###########################################################
453
454gen_S_sources := $(filter %.S,$(LOCAL_GENERATED_SOURCES))
455gen_S_objects := $(gen_S_sources:%.S=%.o)
456
457ifneq ($(strip $(gen_S_sources)),)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400458$(gen_S_objects): $(intermediates)/%.o: $(intermediates)/%.S \
Ying Wang9c3aa052013-02-20 13:34:05 -0800459 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
460 | $(my_compiler_dependencies)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800461 $(transform-$(PRIVATE_HOST)s-to-o)
462-include $(gen_S_objects:%.o=%.P)
463endif
464
465gen_s_sources := $(filter %.s,$(LOCAL_GENERATED_SOURCES))
466gen_s_objects := $(gen_s_sources:%.s=%.o)
467
468ifneq ($(strip $(gen_s_objects)),)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400469$(gen_s_objects): $(intermediates)/%.o: $(intermediates)/%.s \
Ying Wang9c3aa052013-02-20 13:34:05 -0800470 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
471 | $(my_compiler_dependencies)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800472 $(transform-$(PRIVATE_HOST)s-to-o-no-deps)
473-include $(gen_s_objects:%.o=%.P)
474endif
475
476gen_asm_objects := $(gen_S_objects) $(gen_s_objects)
477
478###########################################################
Torne (Richard Coles)aace2022013-02-21 14:01:35 +0000479## o: Include generated .o files in output.
480###########################################################
481
482gen_o_objects := $(filter %.o,$(LOCAL_GENERATED_SOURCES))
483
484###########################################################
The Android Open Source Project88b60792009-03-03 19:28:42 -0800485## C: Compile .c files to .o.
486###########################################################
487
488c_arm_sources := $(patsubst %.c.arm,%.c,$(filter %.c.arm,$(LOCAL_SRC_FILES)))
489c_arm_objects := $(addprefix $(intermediates)/,$(c_arm_sources:.c=.o))
490
491c_normal_sources := $(filter %.c,$(LOCAL_SRC_FILES))
492c_normal_objects := $(addprefix $(intermediates)/,$(c_normal_sources:.c=.o))
493
494$(c_arm_objects): PRIVATE_ARM_MODE := $(arm_objects_mode)
495$(c_arm_objects): PRIVATE_ARM_CFLAGS := $(arm_objects_cflags)
496$(c_normal_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
497$(c_normal_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
498
499c_objects := $(c_arm_objects) $(c_normal_objects)
500
501ifneq ($(strip $(c_objects)),)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400502$(c_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.c $(yacc_cpps) $(proto_generated_headers) \
Ying Wang9c3aa052013-02-20 13:34:05 -0800503 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
504 | $(my_compiler_dependencies)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800505 $(transform-$(PRIVATE_HOST)c-to-o)
506-include $(c_objects:%.o=%.P)
507endif
508
509###########################################################
Jack Paleviche7b3e2c2009-05-04 14:32:44 -0700510## C: Compile generated .c files to .o.
511###########################################################
512
513gen_c_sources := $(filter %.c,$(LOCAL_GENERATED_SOURCES))
514gen_c_objects := $(gen_c_sources:%.c=%.o)
515
516ifneq ($(strip $(gen_c_objects)),)
517# Compile all generated files as thumb.
518# TODO: support compiling certain generated files as arm.
519$(gen_c_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
520$(gen_c_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400521$(gen_c_objects): $(intermediates)/%.o: $(intermediates)/%.c $(yacc_cpps) $(proto_generated_headers) \
Ying Wang9c3aa052013-02-20 13:34:05 -0800522 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
523 | $(my_compiler_dependencies)
Jack Paleviche7b3e2c2009-05-04 14:32:44 -0700524 $(transform-$(PRIVATE_HOST)c-to-o)
525-include $(gen_c_objects:%.o=%.P)
526endif
527
528###########################################################
David 'Digit' Turner5dbb5292009-05-14 16:00:09 +0200529## ObjC: Compile .m files to .o
530###########################################################
531
532objc_sources := $(filter %.m,$(LOCAL_SRC_FILES))
533objc_objects := $(addprefix $(intermediates)/,$(objc_sources:.m=.o))
534
535ifneq ($(strip $(objc_objects)),)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400536$(objc_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.m $(yacc_cpps) $(proto_generated_headers) \
Ying Wang9c3aa052013-02-20 13:34:05 -0800537 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
538 | $(my_compiler_dependencies)
David 'Digit' Turner5dbb5292009-05-14 16:00:09 +0200539 $(transform-$(PRIVATE_HOST)m-to-o)
540-include $(objc_objects:%.o=%.P)
541endif
542
543###########################################################
The Android Open Source Project88b60792009-03-03 19:28:42 -0800544## AS: Compile .S files to .o.
545###########################################################
546
547asm_sources_S := $(filter %.S,$(LOCAL_SRC_FILES))
548asm_objects_S := $(addprefix $(intermediates)/,$(asm_sources_S:.S=.o))
549
550ifneq ($(strip $(asm_objects_S)),)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400551$(asm_objects_S): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.S \
Ying Wang9c3aa052013-02-20 13:34:05 -0800552 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
553 | $(my_compiler_dependencies)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800554 $(transform-$(PRIVATE_HOST)s-to-o)
555-include $(asm_objects_S:%.o=%.P)
556endif
557
558asm_sources_s := $(filter %.s,$(LOCAL_SRC_FILES))
559asm_objects_s := $(addprefix $(intermediates)/,$(asm_sources_s:.s=.o))
560
561ifneq ($(strip $(asm_objects_s)),)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400562$(asm_objects_s): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.s \
Ying Wang9c3aa052013-02-20 13:34:05 -0800563 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
564 | $(my_compiler_dependencies)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800565 $(transform-$(PRIVATE_HOST)s-to-o-no-deps)
566-include $(asm_objects_s:%.o=%.P)
567endif
568
569asm_objects := $(asm_objects_S) $(asm_objects_s)
570
571
Ying Wang5f074802011-11-08 09:31:21 -0800572####################################################
573## Import includes
574####################################################
575import_includes := $(intermediates)/import_includes
576import_includes_deps := $(strip \
577 $(foreach l, $(installed_shared_library_module_names), \
578 $(call intermediates-dir-for,SHARED_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE))/export_includes) \
579 $(foreach l, $(LOCAL_STATIC_LIBRARIES) $(LOCAL_WHOLE_STATIC_LIBRARIES), \
580 $(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE))/export_includes))
581$(import_includes) : $(import_includes_deps)
582 @echo Import includes file: $@
583 $(hide) mkdir -p $(dir $@) && rm -f $@
584ifdef import_includes_deps
585 $(hide) for f in $^; do \
586 cat $$f >> $@; \
587 done
588else
589 $(hide) touch $@
590endif
591
The Android Open Source Project88b60792009-03-03 19:28:42 -0800592###########################################################
593## Common object handling.
594###########################################################
595
596# some rules depend on asm_objects being first. If your code depends on
597# being first, it's reasonable to require it to be assembly
598all_objects := \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700599 $(asm_objects) \
600 $(cpp_objects) \
601 $(gen_cpp_objects) \
602 $(gen_asm_objects) \
603 $(c_objects) \
604 $(gen_c_objects) \
605 $(objc_objects) \
606 $(yacc_objects) \
607 $(lex_objects) \
608 $(proto_generated_objects) \
Torne (Richard Coles)aace2022013-02-21 14:01:35 +0000609 $(addprefix $(TOPDIR)$(LOCAL_PATH)/,$(LOCAL_PREBUILT_OBJ_FILES)) \
610 $(gen_o_objects)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800611
Colin Cross9ad36ef2012-03-30 19:31:00 -0700612LOCAL_C_INCLUDES += $(TOPDIR)$(LOCAL_PATH) $(intermediates)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800613
Ying Wang848020f2012-08-14 10:13:16 -0700614ifndef LOCAL_SDK_VERSION
Ying Wangbce4b752010-07-22 15:51:56 -0700615 LOCAL_C_INCLUDES += $(JNI_H_INCLUDE)
616endif
617
Torne (Richard Coles)aace2022013-02-21 14:01:35 +0000618# .o files need to be filtered out of LOCAL_GENERATED_SOURCES
619# to avoid creating circular dependencies.
620$(all_objects) : | $(filter-out %.o,$(LOCAL_GENERATED_SOURCES)) $(import_includes)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800621ALL_C_CPP_ETC_OBJECTS += $(all_objects)
622
623###########################################################
624## Copy headers to the install tree
625###########################################################
626include $(BUILD_COPY_HEADERS)
627
628###########################################################
629# Standard library handling.
The Android Open Source Project88b60792009-03-03 19:28:42 -0800630###########################################################
The Android Open Source Project88b60792009-03-03 19:28:42 -0800631
632###########################################################
633# The list of libraries that this module will link against are in
634# these variables. Each is a list of bare module names like "libc libm".
635#
636# LOCAL_SHARED_LIBRARIES
637# LOCAL_STATIC_LIBRARIES
638# LOCAL_WHOLE_STATIC_LIBRARIES
639#
640# We need to convert the bare names into the dependencies that
641# we'll use for LOCAL_BUILT_MODULE and LOCAL_INSTALLED_MODULE.
642# LOCAL_BUILT_MODULE should depend on the BUILT versions of the
643# libraries, so that simply building this module doesn't force
644# an install of a library. Similarly, LOCAL_INSTALLED_MODULE
645# should depend on the INSTALLED versions of the libraries so
646# that they get installed when this module does.
647###########################################################
648# NOTE:
649# WHOLE_STATIC_LIBRARIES are libraries that are pulled into the
650# module without leaving anything out, which is useful for turning
651# a collection of .a files into a .so file. Linking against a
652# normal STATIC_LIBRARY will only pull in code/symbols that are
653# referenced by the module. (see gcc/ld's --whole-archive option)
654###########################################################
655
656# Get the list of BUILT libraries, which are under
657# various intermediates directories.
658so_suffix := $($(my_prefix)SHLIB_SUFFIX)
659a_suffix := $($(my_prefix)STATIC_LIB_SUFFIX)
660
Ying Wang848020f2012-08-14 10:13:16 -0700661ifdef LOCAL_SDK_VERSION
The Android Open Source Project88b60792009-03-03 19:28:42 -0800662built_shared_libraries := \
663 $(addprefix $($(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
664 $(addsuffix $(so_suffix), \
665 $(LOCAL_SHARED_LIBRARIES)))
666
Ying Wangcce4c972011-03-03 18:53:53 -0800667my_system_shared_libraries_fullpath := \
668 $(my_ndk_stl_shared_lib_fullpath) \
669 $(addprefix $(my_ndk_version_root)/usr/lib/, \
670 $(addsuffix $(so_suffix), $(LOCAL_SYSTEM_SHARED_LIBRARIES)))
Ying Wang1a081002010-07-13 14:55:47 -0700671
672built_shared_libraries += $(my_system_shared_libraries_fullpath)
673LOCAL_SHARED_LIBRARIES += $(LOCAL_SYSTEM_SHARED_LIBRARIES)
674else
675LOCAL_SHARED_LIBRARIES += $(LOCAL_SYSTEM_SHARED_LIBRARIES)
676built_shared_libraries := \
677 $(addprefix $($(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
678 $(addsuffix $(so_suffix), \
679 $(LOCAL_SHARED_LIBRARIES)))
Ying Wang1a081002010-07-13 14:55:47 -0700680endif
681
The Android Open Source Project88b60792009-03-03 19:28:42 -0800682built_static_libraries := \
683 $(foreach lib,$(LOCAL_STATIC_LIBRARIES), \
684 $(call intermediates-dir-for, \
685 STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE))/$(lib)$(a_suffix))
686
Ying Wang848020f2012-08-14 10:13:16 -0700687ifdef LOCAL_SDK_VERSION
Ying Wangcce4c972011-03-03 18:53:53 -0800688built_static_libraries += $(my_ndk_stl_static_lib)
689endif
690
The Android Open Source Project88b60792009-03-03 19:28:42 -0800691built_whole_libraries := \
692 $(foreach lib,$(LOCAL_WHOLE_STATIC_LIBRARIES), \
693 $(call intermediates-dir-for, \
694 STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE))/$(lib)$(a_suffix))
695
The Android Open Source Project88b60792009-03-03 19:28:42 -0800696# We don't care about installed static libraries, since the
697# libraries have already been linked into the module at that point.
698# We do, however, care about the NOTICE files for any static
Steve Blockd14d3b42012-03-01 11:34:41 +0000699# libraries that we use. (see notice_files.mk)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800700
701installed_static_library_notice_file_targets := \
702 $(foreach lib,$(LOCAL_STATIC_LIBRARIES) $(LOCAL_WHOLE_STATIC_LIBRARIES), \
703 NOTICE-$(if $(LOCAL_IS_HOST_MODULE),HOST,TARGET)-STATIC_LIBRARIES-$(lib))
704
Doug Kwan9a8ecf92011-05-10 21:50:58 -0700705# Default is -fno-rtti.
Doug Kwane3c3c6d2011-06-07 10:55:48 -0700706ifeq ($(strip $(LOCAL_RTTI_FLAG)),)
707LOCAL_RTTI_FLAG := -fno-rtti
708endif
Doug Kwan9a8ecf92011-05-10 21:50:58 -0700709
The Android Open Source Project88b60792009-03-03 19:28:42 -0800710###########################################################
711# Rule-specific variable definitions
712###########################################################
713$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_YACCFLAGS := $(LOCAL_YACCFLAGS)
714$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASFLAGS := $(LOCAL_ASFLAGS)
Ying Wang7429e212012-08-15 10:59:10 -0700715$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CONLYFLAGS := $(LOCAL_CONLYFLAGS)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800716$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CFLAGS := $(LOCAL_CFLAGS)
717$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CPPFLAGS := $(LOCAL_CPPFLAGS)
Doug Kwan9a8ecf92011-05-10 21:50:58 -0700718$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RTTI_FLAG := $(LOCAL_RTTI_FLAG)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800719$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEBUG_CFLAGS := $(debug_cflags)
720$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_C_INCLUDES := $(LOCAL_C_INCLUDES)
Ying Wang5f074802011-11-08 09:31:21 -0800721$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_IMPORT_INCLUDES := $(import_includes)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800722$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDFLAGS := $(LOCAL_LDFLAGS)
723$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDLIBS := $(LOCAL_LDLIBS)
Jeff Brown703e7c62011-02-04 20:15:00 -0800724$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_NO_CRT := $(LOCAL_NO_CRT)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800725
726# this is really the way to get the files onto the command line instead
727# of using $^, because then LOCAL_ADDITIONAL_DEPENDENCIES doesn't work
728$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_SHARED_LIBRARIES := $(built_shared_libraries)
729$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_STATIC_LIBRARIES := $(built_static_libraries)
730$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_WHOLE_STATIC_LIBRARIES := $(built_whole_libraries)
731$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_OBJECTS := $(all_objects)
732
733###########################################################
734# Define library dependencies.
735###########################################################
736# all_libraries is used for the dependencies on LOCAL_BUILT_MODULE.
737all_libraries := \
738 $(built_shared_libraries) \
739 $(built_static_libraries) \
740 $(built_whole_libraries)
741
The Android Open Source Project88b60792009-03-03 19:28:42 -0800742# Also depend on the notice files for any static libraries that
743# are linked into this module. This will force them to be installed
744# when this module is.
745$(LOCAL_INSTALLED_MODULE): | $(installed_static_library_notice_file_targets)
Ying Wang5f074802011-11-08 09:31:21 -0800746
747###########################################################
748# Export includes
749###########################################################
750export_includes := $(intermediates)/export_includes
751$(export_includes): PRIVATE_EXPORT_C_INCLUDE_DIRS := $(LOCAL_EXPORT_C_INCLUDE_DIRS)
Ying Wang68f1c772012-04-23 21:29:18 -0700752$(export_includes) : $(LOCAL_MODULE_MAKEFILE)
Ying Wang5f074802011-11-08 09:31:21 -0800753 @echo Export includes file: $< -- $@
754 $(hide) mkdir -p $(dir $@) && rm -f $@
755ifdef LOCAL_EXPORT_C_INCLUDE_DIRS
756 $(hide) for d in $(PRIVATE_EXPORT_C_INCLUDE_DIRS); do \
757 echo "-I $$d" >> $@; \
758 done
759else
760 $(hide) touch $@
761endif
Ying Wang616e5962012-04-18 17:35:55 -0700762
763# Make sure export_includes gets generated when you are running mm/mmm
764$(LOCAL_BUILT_MODULE) : | $(export_includes)