blob: 10d4927d8201273440ce75f8fc340e59dbda2895 [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)),)
118 LOCAL_CFLAGS += $(TARGET_FDO_CFLAGS)
119 LOCAL_CPPFLAGS += $(TARGET_FDO_CFLAGS)
120 LOCAL_LDFLAGS += $(TARGET_FDO_CFLAGS)
121endif
122
Kito Cheng70dc3e12012-06-15 15:15:50 +0800123####################################################
124## Add profiling flags if aprof is turned on
125####################################################
126ifeq ($(strip $(LOCAL_ENABLE_APROF)),true)
127 # -ffunction-sections and -fomit-frame-pointer are conflict with -pg
128 LOCAL_CFLAGS += -fno-omit-frame-pointer -fno-function-sections -pg
129 LOCAL_CPPFLAGS += -fno-omit-frame-pointer -fno-function-sections -pg
130endif
131
The Android Open Source Project88b60792009-03-03 19:28:42 -0800132###########################################################
Jim Huang20d1ba62010-10-14 16:15:56 +0800133## Explicitly declare assembly-only __ASSEMBLY__ macro for
134## assembly source
135###########################################################
136LOCAL_ASFLAGS += -D__ASSEMBLY__
137
138###########################################################
Ying Wang1a081002010-07-13 14:55:47 -0700139## Define PRIVATE_ variables from global vars
140###########################################################
Ying Wang848020f2012-08-14 10:13:16 -0700141ifdef LOCAL_SDK_VERSION
Ying Wang1a081002010-07-13 14:55:47 -0700142my_target_project_includes :=
Evgeniy Stepanova7095e92012-03-30 12:18:52 +0400143my_target_c_includes := $(my_ndk_stl_include_path) $(my_ndk_version_root)/usr/include
Ying Wangda4bf422012-08-16 16:45:01 -0700144
145# filter out including of AndroidConfig.h in system/core.
146TARGET_GLOBAL_CFLAGS_NO_ANDCONF ?= $(subst $(TARGET_ANDROID_CONFIG_CFLAGS),,\
147 $(TARGET_GLOBAL_CFLAGS))
148my_target_global_cflags := $(TARGET_GLOBAL_CFLAGS_NO_ANDCONF)
Ying Wang1a081002010-07-13 14:55:47 -0700149else
150my_target_project_includes := $(TARGET_PROJECT_INCLUDES)
Evgeniy Stepanova7095e92012-03-30 12:18:52 +0400151my_target_c_includes := $(TARGET_C_INCLUDES)
Evgeniy Stepanova7095e92012-03-30 12:18:52 +0400152ifeq ($(strip $(LOCAL_CLANG)),true)
Ying Wangda4bf422012-08-16 16:45:01 -0700153my_target_c_includes += $(CLANG_CONFIG_EXTRA_TARGET_C_INCLUDES)
154my_target_global_cflags := $(TARGET_GLOBAL_CLANG_FLAGS)
155else
156my_target_global_cflags := $(TARGET_GLOBAL_CFLAGS)
157endif # LOCAL_CLANG
158endif # LOCAL_SDK_VERSION
159
Ying Wang1a081002010-07-13 14:55:47 -0700160$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_PROJECT_INCLUDES := $(my_target_project_includes)
Evgeniy Stepanova7095e92012-03-30 12:18:52 +0400161$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_C_INCLUDES := $(my_target_c_includes)
Ying Wang1a081002010-07-13 14:55:47 -0700162$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CFLAGS := $(my_target_global_cflags)
Ying Wangda4bf422012-08-16 16:45:01 -0700163$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CPPFLAGS := $(TARGET_GLOBAL_CPPFLAGS)
Ying Wang1a081002010-07-13 14:55:47 -0700164
165###########################################################
The Android Open Source Project88b60792009-03-03 19:28:42 -0800166## Define PRIVATE_ variables used by multiple module types
167###########################################################
168$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_NO_DEFAULT_COMPILER_FLAGS := \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700169 $(strip $(LOCAL_NO_DEFAULT_COMPILER_FLAGS))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800170
171ifeq ($(strip $(LOCAL_CC)),)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400172 ifeq ($(strip $(LOCAL_CLANG)),true)
173 LOCAL_CC := $(CLANG)
174 else
175 LOCAL_CC := $($(my_prefix)CC)
176 endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800177endif
178$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CC := $(LOCAL_CC)
179
180ifeq ($(strip $(LOCAL_CXX)),)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400181 ifeq ($(strip $(LOCAL_CLANG)),true)
182 LOCAL_CXX := $(CLANG_CXX)
183 else
184 LOCAL_CXX := $($(my_prefix)CXX)
185 endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800186endif
187$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CXX := $(LOCAL_CXX)
188
189# TODO: support a mix of standard extensions so that this isn't necessary
190LOCAL_CPP_EXTENSION := $(strip $(LOCAL_CPP_EXTENSION))
191ifeq ($(LOCAL_CPP_EXTENSION),)
192 LOCAL_CPP_EXTENSION := .cpp
193endif
194$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CPP_EXTENSION := $(LOCAL_CPP_EXTENSION)
195
196# Certain modules like libdl have to have symbols resolved at runtime and blow
197# up if --no-undefined is passed to the linker.
198ifeq ($(strip $(LOCAL_NO_DEFAULT_COMPILER_FLAGS)),)
199ifeq ($(strip $(LOCAL_ALLOW_UNDEFINED_SYMBOLS)),)
200 LOCAL_LDFLAGS := $(LOCAL_LDFLAGS) $($(my_prefix)NO_UNDEFINED_LDFLAGS)
201endif
202endif
203
Ying Wangfcdabd42011-04-25 14:22:41 -0700204ifeq (true,$(LOCAL_GROUP_STATIC_LIBRARIES))
205$(LOCAL_BUILT_MODULE): PRIVATE_GROUP_STATIC_LIBRARIES := true
206else
207$(LOCAL_BUILT_MODULE): PRIVATE_GROUP_STATIC_LIBRARIES :=
208endif
209
The Android Open Source Project88b60792009-03-03 19:28:42 -0800210###########################################################
211## Define arm-vs-thumb-mode flags.
212###########################################################
213LOCAL_ARM_MODE := $(strip $(LOCAL_ARM_MODE))
Chih-Wei Huang0d09e582010-07-09 10:07:52 +0800214ifeq ($(TARGET_ARCH),arm)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800215arm_objects_mode := $(if $(LOCAL_ARM_MODE),$(LOCAL_ARM_MODE),arm)
216normal_objects_mode := $(if $(LOCAL_ARM_MODE),$(LOCAL_ARM_MODE),thumb)
217
Dave Bort95282482009-04-23 18:44:55 -0700218# Read the values from something like TARGET_arm_CFLAGS or
219# TARGET_thumb_CFLAGS. HOST_(arm|thumb)_CFLAGS values aren't
220# actually used (although they are usually empty).
Evgeniy Stepanovf50f4c52012-04-05 11:44:37 +0400221ifeq ($(strip $(LOCAL_CLANG)),true)
222arm_objects_cflags := $($(my_prefix)$(arm_objects_mode)_CLANG_CFLAGS)
223normal_objects_cflags := $($(my_prefix)$(normal_objects_mode)_CLANG_CFLAGS)
224else
Dave Bort95282482009-04-23 18:44:55 -0700225arm_objects_cflags := $($(my_prefix)$(arm_objects_mode)_CFLAGS)
226normal_objects_cflags := $($(my_prefix)$(normal_objects_mode)_CFLAGS)
Evgeniy Stepanovf50f4c52012-04-05 11:44:37 +0400227endif
228
Chih-Wei Huang0d09e582010-07-09 10:07:52 +0800229else
230arm_objects_mode :=
231normal_objects_mode :=
232arm_objects_cflags :=
233normal_objects_cflags :=
234endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800235
236###########################################################
237## Define per-module debugging flags. Users can turn on
238## debugging for a particular module by setting DEBUG_MODULE_ModuleName
239## to a non-empty value in their environment or buildspec.mk,
240## and setting HOST_/TARGET_CUSTOM_DEBUG_CFLAGS to the
241## debug flags that they want to use.
242###########################################################
243ifdef DEBUG_MODULE_$(strip $(LOCAL_MODULE))
244 debug_cflags := $($(my_prefix)CUSTOM_DEBUG_CFLAGS)
245else
246 debug_cflags :=
247endif
248
Tim Murraya7aa8002012-10-29 16:06:00 -0700249####################################################
250## Compile RenderScript with reflected C++
251####################################################
252
253renderscript_sources := $(filter %.rs %.fs,$(LOCAL_SRC_FILES))
254
255ifneq (,$(renderscript_sources))
256
257renderscript_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(renderscript_sources))
258RenderScript_file_stamp := $(intermediates)/RenderScriptCPP.stamp
259renderscript_intermediate := $(intermediates)/renderscript
260
261ifeq ($(LOCAL_RENDERSCRIPT_CC),)
262LOCAL_RENDERSCRIPT_CC := $(LLVM_RS_CC)
263endif
264
265# Turn on all warnings and warnings as errors for RS compiles.
266# This can be disabled with LOCAL_RENDERSCRIPT_FLAGS := -Wno-error
267renderscript_flags := -Wall -Werror
268renderscript_flags += $(LOCAL_RENDERSCRIPT_FLAGS)
269
270LOCAL_RENDERSCRIPT_INCLUDES := \
271 $(TOPDIR)external/clang/lib/Headers \
272 $(TOPDIR)frameworks/rs/scriptc \
273 $(LOCAL_RENDERSCRIPT_INCLUDES)
274
275ifneq ($(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE),)
276LOCAL_RENDERSCRIPT_INCLUDES := $(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE)
277endif
278
279$(RenderScript_file_stamp): PRIVATE_RS_INCLUDES := $(LOCAL_RENDERSCRIPT_INCLUDES)
280$(RenderScript_file_stamp): PRIVATE_RS_CC := $(LOCAL_RENDERSCRIPT_CC)
281$(RenderScript_file_stamp): PRIVATE_RS_FLAGS := $(renderscript_flags)
282$(RenderScript_file_stamp): PRIVATE_RS_SOURCE_FILES := $(renderscript_sources_fullpath)
283$(RenderScript_file_stamp): PRIVATE_RS_OUTPUT_DIR := $(renderscript_intermediate)
284$(RenderScript_file_stamp): $(renderscript_sources_fullpath) $(LOCAL_RENDERSCRIPT_CC)
285 $(transform-renderscripts-to-cpp-and-bc)
286
287# include the dependency files (.d) generated by llvm-rs-cc.
288renderscript_generated_dep_files := $(addprefix $(renderscript_intermediate)/, \
289 $(patsubst %.fs,%.d, $(patsubst %.rs,%.d, $(notdir $(renderscript_sources)))))
290-include $(renderscript_generated_dep_files)
291
292LOCAL_INTERMEDIATE_TARGETS += $(RenderScript_file_stamp)
293
294rs_generated_cpps := $(addprefix \
295 $(renderscript_intermediate)/ScriptC_,$(patsubst %.fs,%.cpp, $(patsubst %.rs,%.cpp, \
296 $(notdir $(renderscript_sources)))))
297
298$(rs_generated_cpps) : $(RenderScript_file_stamp)
299
300LOCAL_C_INCLUDES += $(renderscript_intermediate)
301LOCAL_GENERATED_SOURCES += $(rs_generated_cpps)
302
303endif
304
305
The Android Open Source Project88b60792009-03-03 19:28:42 -0800306###########################################################
307## Stuff source generated from one-off tools
308###########################################################
309$(LOCAL_GENERATED_SOURCES): PRIVATE_MODULE := $(LOCAL_MODULE)
310
311ALL_GENERATED_SOURCES += $(LOCAL_GENERATED_SOURCES)
312
313
314###########################################################
Ying Wanga5fc87a2010-11-02 18:43:16 -0700315## Compile the .proto files to .cc and then to .o
316###########################################################
317proto_sources := $(filter %.proto,$(LOCAL_SRC_FILES))
318proto_generated_objects :=
319proto_generated_headers :=
320ifneq ($(proto_sources),)
321proto_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(proto_sources))
322proto_generated_cc_sources_dir := $(intermediates)/proto
323proto_generated_cc_sources := $(addprefix $(proto_generated_cc_sources_dir)/, \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700324 $(patsubst %.proto,%.pb.cc,$(proto_sources_fullpath)))
Ying Wanga5fc87a2010-11-02 18:43:16 -0700325proto_generated_objects := $(patsubst %.cc,%.o, $(proto_generated_cc_sources))
326
327$(proto_generated_cc_sources): PRIVATE_PROTO_INCLUDES := $(TOP)
328$(proto_generated_cc_sources): PRIVATE_PROTO_CC_OUTPUT_DIR := $(proto_generated_cc_sources_dir)
Ying Wang33c0d952010-11-05 11:30:58 -0700329$(proto_generated_cc_sources): PRIVATE_PROTOC_FLAGS := $(LOCAL_PROTOC_FLAGS)
Ying Wanga5fc87a2010-11-02 18:43:16 -0700330$(proto_generated_cc_sources): $(proto_generated_cc_sources_dir)/%.pb.cc: %.proto $(PROTOC)
331 $(transform-proto-to-cc)
332
333proto_generated_headers := $(patsubst %.pb.cc,%.pb.h, $(proto_generated_cc_sources))
334$(proto_generated_headers): $(proto_generated_cc_sources_dir)/%.pb.h: $(proto_generated_cc_sources_dir)/%.pb.cc
335
Ying Wang022a7b32012-06-13 11:38:10 -0700336$(proto_generated_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
337$(proto_generated_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
Narayan Kamath21094872012-04-02 18:19:31 +0100338$(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 -0700339 $(transform-$(PRIVATE_HOST)cpp-to-o)
340-include $(proto_generated_objects:%.o=%.P)
341
342LOCAL_C_INCLUDES += external/protobuf/src $(proto_generated_cc_sources_dir)
343LOCAL_CFLAGS += -DGOOGLE_PROTOBUF_NO_RTTI
344ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),full)
345LOCAL_STATIC_LIBRARIES += libprotobuf-cpp-2.3.0-full
346else
347LOCAL_STATIC_LIBRARIES += libprotobuf-cpp-2.3.0-lite
348endif
349endif
350
351
352###########################################################
The Android Open Source Project88b60792009-03-03 19:28:42 -0800353## YACC: Compile .y files to .cpp and the to .o.
354###########################################################
355
356yacc_sources := $(filter %.y,$(LOCAL_SRC_FILES))
357yacc_cpps := $(addprefix \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700358 $(intermediates)/,$(yacc_sources:.y=$(LOCAL_CPP_EXTENSION)))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800359yacc_headers := $(yacc_cpps:$(LOCAL_CPP_EXTENSION)=.h)
360yacc_objects := $(yacc_cpps:$(LOCAL_CPP_EXTENSION)=.o)
361
362ifneq ($(strip $(yacc_cpps)),)
363$(yacc_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700364 $(TOPDIR)$(LOCAL_PATH)/%.y \
365 $(lex_cpps) $(LOCAL_ADDITIONAL_DEPENDENCIES)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800366 $(call transform-y-to-cpp,$(PRIVATE_CPP_EXTENSION))
367$(yacc_headers): $(intermediates)/%.h: $(intermediates)/%$(LOCAL_CPP_EXTENSION)
368
369$(yacc_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
370$(yacc_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
371$(yacc_objects): $(intermediates)/%.o: $(intermediates)/%$(LOCAL_CPP_EXTENSION)
372 $(transform-$(PRIVATE_HOST)cpp-to-o)
373endif
374
375###########################################################
376## LEX: Compile .l files to .cpp and then to .o.
377###########################################################
378
379lex_sources := $(filter %.l,$(LOCAL_SRC_FILES))
380lex_cpps := $(addprefix \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700381 $(intermediates)/,$(lex_sources:.l=$(LOCAL_CPP_EXTENSION)))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800382lex_objects := $(lex_cpps:$(LOCAL_CPP_EXTENSION)=.o)
383
384ifneq ($(strip $(lex_cpps)),)
385$(lex_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700386 $(TOPDIR)$(LOCAL_PATH)/%.l
The Android Open Source Project88b60792009-03-03 19:28:42 -0800387 $(transform-l-to-cpp)
388
389$(lex_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
390$(lex_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
391$(lex_objects): $(intermediates)/%.o: \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700392 $(intermediates)/%$(LOCAL_CPP_EXTENSION) \
393 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
394 $(yacc_headers)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800395 $(transform-$(PRIVATE_HOST)cpp-to-o)
396endif
397
398###########################################################
399## C++: Compile .cpp files to .o.
400###########################################################
401
Jeff Browne33ba4c2011-07-11 22:11:46 -0700402# we also do this on host modules, even though
The Android Open Source Project88b60792009-03-03 19:28:42 -0800403# it's not really arm, because there are files that are shared.
404cpp_arm_sources := $(patsubst %$(LOCAL_CPP_EXTENSION).arm,%$(LOCAL_CPP_EXTENSION),$(filter %$(LOCAL_CPP_EXTENSION).arm,$(LOCAL_SRC_FILES)))
405cpp_arm_objects := $(addprefix $(intermediates)/,$(cpp_arm_sources:$(LOCAL_CPP_EXTENSION)=.o))
406
407cpp_normal_sources := $(filter %$(LOCAL_CPP_EXTENSION),$(LOCAL_SRC_FILES))
408cpp_normal_objects := $(addprefix $(intermediates)/,$(cpp_normal_sources:$(LOCAL_CPP_EXTENSION)=.o))
409
410$(cpp_arm_objects): PRIVATE_ARM_MODE := $(arm_objects_mode)
411$(cpp_arm_objects): PRIVATE_ARM_CFLAGS := $(arm_objects_cflags)
412$(cpp_normal_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
413$(cpp_normal_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
414
415cpp_objects := $(cpp_arm_objects) $(cpp_normal_objects)
416
417ifneq ($(strip $(cpp_objects)),)
418$(cpp_objects): $(intermediates)/%.o: \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700419 $(TOPDIR)$(LOCAL_PATH)/%$(LOCAL_CPP_EXTENSION) \
Ying Wang9c3aa052013-02-20 13:34:05 -0800420 $(yacc_cpps) $(proto_generated_headers) \
421 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
422 | $(my_compiler_dependencies)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800423 $(transform-$(PRIVATE_HOST)cpp-to-o)
424-include $(cpp_objects:%.o=%.P)
425endif
426
427###########################################################
428## C++: Compile generated .cpp files to .o.
429###########################################################
430
431gen_cpp_sources := $(filter %$(LOCAL_CPP_EXTENSION),$(LOCAL_GENERATED_SOURCES))
432gen_cpp_objects := $(gen_cpp_sources:%$(LOCAL_CPP_EXTENSION)=%.o)
433
434ifneq ($(strip $(gen_cpp_objects)),)
435# Compile all generated files as thumb.
436# TODO: support compiling certain generated files as arm.
437$(gen_cpp_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
438$(gen_cpp_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400439$(gen_cpp_objects): $(intermediates)/%.o: \
440 $(intermediates)/%$(LOCAL_CPP_EXTENSION) $(yacc_cpps) \
Ying Wang9c3aa052013-02-20 13:34:05 -0800441 $(proto_generated_headers) \
442 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
443 | $(my_compiler_dependencies)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800444 $(transform-$(PRIVATE_HOST)cpp-to-o)
445-include $(gen_cpp_objects:%.o=%.P)
446endif
447
448###########################################################
449## S: Compile generated .S and .s files to .o.
450###########################################################
451
452gen_S_sources := $(filter %.S,$(LOCAL_GENERATED_SOURCES))
453gen_S_objects := $(gen_S_sources:%.S=%.o)
454
455ifneq ($(strip $(gen_S_sources)),)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400456$(gen_S_objects): $(intermediates)/%.o: $(intermediates)/%.S \
Ying Wang9c3aa052013-02-20 13:34:05 -0800457 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
458 | $(my_compiler_dependencies)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800459 $(transform-$(PRIVATE_HOST)s-to-o)
460-include $(gen_S_objects:%.o=%.P)
461endif
462
463gen_s_sources := $(filter %.s,$(LOCAL_GENERATED_SOURCES))
464gen_s_objects := $(gen_s_sources:%.s=%.o)
465
466ifneq ($(strip $(gen_s_objects)),)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400467$(gen_s_objects): $(intermediates)/%.o: $(intermediates)/%.s \
Ying Wang9c3aa052013-02-20 13:34:05 -0800468 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
469 | $(my_compiler_dependencies)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800470 $(transform-$(PRIVATE_HOST)s-to-o-no-deps)
471-include $(gen_s_objects:%.o=%.P)
472endif
473
474gen_asm_objects := $(gen_S_objects) $(gen_s_objects)
475
476###########################################################
Torne (Richard Coles)aace2022013-02-21 14:01:35 +0000477## o: Include generated .o files in output.
478###########################################################
479
480gen_o_objects := $(filter %.o,$(LOCAL_GENERATED_SOURCES))
481
482###########################################################
The Android Open Source Project88b60792009-03-03 19:28:42 -0800483## C: Compile .c files to .o.
484###########################################################
485
486c_arm_sources := $(patsubst %.c.arm,%.c,$(filter %.c.arm,$(LOCAL_SRC_FILES)))
487c_arm_objects := $(addprefix $(intermediates)/,$(c_arm_sources:.c=.o))
488
489c_normal_sources := $(filter %.c,$(LOCAL_SRC_FILES))
490c_normal_objects := $(addprefix $(intermediates)/,$(c_normal_sources:.c=.o))
491
492$(c_arm_objects): PRIVATE_ARM_MODE := $(arm_objects_mode)
493$(c_arm_objects): PRIVATE_ARM_CFLAGS := $(arm_objects_cflags)
494$(c_normal_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
495$(c_normal_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
496
497c_objects := $(c_arm_objects) $(c_normal_objects)
498
499ifneq ($(strip $(c_objects)),)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400500$(c_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.c $(yacc_cpps) $(proto_generated_headers) \
Ying Wang9c3aa052013-02-20 13:34:05 -0800501 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
502 | $(my_compiler_dependencies)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800503 $(transform-$(PRIVATE_HOST)c-to-o)
504-include $(c_objects:%.o=%.P)
505endif
506
507###########################################################
Jack Paleviche7b3e2c2009-05-04 14:32:44 -0700508## C: Compile generated .c files to .o.
509###########################################################
510
511gen_c_sources := $(filter %.c,$(LOCAL_GENERATED_SOURCES))
512gen_c_objects := $(gen_c_sources:%.c=%.o)
513
514ifneq ($(strip $(gen_c_objects)),)
515# Compile all generated files as thumb.
516# TODO: support compiling certain generated files as arm.
517$(gen_c_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
518$(gen_c_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400519$(gen_c_objects): $(intermediates)/%.o: $(intermediates)/%.c $(yacc_cpps) $(proto_generated_headers) \
Ying Wang9c3aa052013-02-20 13:34:05 -0800520 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
521 | $(my_compiler_dependencies)
Jack Paleviche7b3e2c2009-05-04 14:32:44 -0700522 $(transform-$(PRIVATE_HOST)c-to-o)
523-include $(gen_c_objects:%.o=%.P)
524endif
525
526###########################################################
David 'Digit' Turner5dbb5292009-05-14 16:00:09 +0200527## ObjC: Compile .m files to .o
528###########################################################
529
530objc_sources := $(filter %.m,$(LOCAL_SRC_FILES))
531objc_objects := $(addprefix $(intermediates)/,$(objc_sources:.m=.o))
532
533ifneq ($(strip $(objc_objects)),)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400534$(objc_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.m $(yacc_cpps) $(proto_generated_headers) \
Ying Wang9c3aa052013-02-20 13:34:05 -0800535 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
536 | $(my_compiler_dependencies)
David 'Digit' Turner5dbb5292009-05-14 16:00:09 +0200537 $(transform-$(PRIVATE_HOST)m-to-o)
538-include $(objc_objects:%.o=%.P)
539endif
540
541###########################################################
The Android Open Source Project88b60792009-03-03 19:28:42 -0800542## AS: Compile .S files to .o.
543###########################################################
544
545asm_sources_S := $(filter %.S,$(LOCAL_SRC_FILES))
546asm_objects_S := $(addprefix $(intermediates)/,$(asm_sources_S:.S=.o))
547
548ifneq ($(strip $(asm_objects_S)),)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400549$(asm_objects_S): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.S \
Ying Wang9c3aa052013-02-20 13:34:05 -0800550 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
551 | $(my_compiler_dependencies)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800552 $(transform-$(PRIVATE_HOST)s-to-o)
553-include $(asm_objects_S:%.o=%.P)
554endif
555
556asm_sources_s := $(filter %.s,$(LOCAL_SRC_FILES))
557asm_objects_s := $(addprefix $(intermediates)/,$(asm_sources_s:.s=.o))
558
559ifneq ($(strip $(asm_objects_s)),)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400560$(asm_objects_s): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.s \
Ying Wang9c3aa052013-02-20 13:34:05 -0800561 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
562 | $(my_compiler_dependencies)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800563 $(transform-$(PRIVATE_HOST)s-to-o-no-deps)
564-include $(asm_objects_s:%.o=%.P)
565endif
566
567asm_objects := $(asm_objects_S) $(asm_objects_s)
568
569
Ying Wang5f074802011-11-08 09:31:21 -0800570####################################################
571## Import includes
572####################################################
573import_includes := $(intermediates)/import_includes
574import_includes_deps := $(strip \
575 $(foreach l, $(installed_shared_library_module_names), \
576 $(call intermediates-dir-for,SHARED_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE))/export_includes) \
577 $(foreach l, $(LOCAL_STATIC_LIBRARIES) $(LOCAL_WHOLE_STATIC_LIBRARIES), \
578 $(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE))/export_includes))
579$(import_includes) : $(import_includes_deps)
580 @echo Import includes file: $@
581 $(hide) mkdir -p $(dir $@) && rm -f $@
582ifdef import_includes_deps
583 $(hide) for f in $^; do \
584 cat $$f >> $@; \
585 done
586else
587 $(hide) touch $@
588endif
589
The Android Open Source Project88b60792009-03-03 19:28:42 -0800590###########################################################
591## Common object handling.
592###########################################################
593
594# some rules depend on asm_objects being first. If your code depends on
595# being first, it's reasonable to require it to be assembly
596all_objects := \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700597 $(asm_objects) \
598 $(cpp_objects) \
599 $(gen_cpp_objects) \
600 $(gen_asm_objects) \
601 $(c_objects) \
602 $(gen_c_objects) \
603 $(objc_objects) \
604 $(yacc_objects) \
605 $(lex_objects) \
606 $(proto_generated_objects) \
Torne (Richard Coles)aace2022013-02-21 14:01:35 +0000607 $(addprefix $(TOPDIR)$(LOCAL_PATH)/,$(LOCAL_PREBUILT_OBJ_FILES)) \
608 $(gen_o_objects)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800609
Colin Cross9ad36ef2012-03-30 19:31:00 -0700610LOCAL_C_INCLUDES += $(TOPDIR)$(LOCAL_PATH) $(intermediates)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800611
Ying Wang848020f2012-08-14 10:13:16 -0700612ifndef LOCAL_SDK_VERSION
Ying Wangbce4b752010-07-22 15:51:56 -0700613 LOCAL_C_INCLUDES += $(JNI_H_INCLUDE)
614endif
615
Torne (Richard Coles)aace2022013-02-21 14:01:35 +0000616# .o files need to be filtered out of LOCAL_GENERATED_SOURCES
617# to avoid creating circular dependencies.
618$(all_objects) : | $(filter-out %.o,$(LOCAL_GENERATED_SOURCES)) $(import_includes)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800619ALL_C_CPP_ETC_OBJECTS += $(all_objects)
620
621###########################################################
622## Copy headers to the install tree
623###########################################################
624include $(BUILD_COPY_HEADERS)
625
626###########################################################
627# Standard library handling.
The Android Open Source Project88b60792009-03-03 19:28:42 -0800628###########################################################
The Android Open Source Project88b60792009-03-03 19:28:42 -0800629
630###########################################################
631# The list of libraries that this module will link against are in
632# these variables. Each is a list of bare module names like "libc libm".
633#
634# LOCAL_SHARED_LIBRARIES
635# LOCAL_STATIC_LIBRARIES
636# LOCAL_WHOLE_STATIC_LIBRARIES
637#
638# We need to convert the bare names into the dependencies that
639# we'll use for LOCAL_BUILT_MODULE and LOCAL_INSTALLED_MODULE.
640# LOCAL_BUILT_MODULE should depend on the BUILT versions of the
641# libraries, so that simply building this module doesn't force
642# an install of a library. Similarly, LOCAL_INSTALLED_MODULE
643# should depend on the INSTALLED versions of the libraries so
644# that they get installed when this module does.
645###########################################################
646# NOTE:
647# WHOLE_STATIC_LIBRARIES are libraries that are pulled into the
648# module without leaving anything out, which is useful for turning
649# a collection of .a files into a .so file. Linking against a
650# normal STATIC_LIBRARY will only pull in code/symbols that are
651# referenced by the module. (see gcc/ld's --whole-archive option)
652###########################################################
653
654# Get the list of BUILT libraries, which are under
655# various intermediates directories.
656so_suffix := $($(my_prefix)SHLIB_SUFFIX)
657a_suffix := $($(my_prefix)STATIC_LIB_SUFFIX)
658
Ying Wang848020f2012-08-14 10:13:16 -0700659ifdef LOCAL_SDK_VERSION
The Android Open Source Project88b60792009-03-03 19:28:42 -0800660built_shared_libraries := \
661 $(addprefix $($(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
662 $(addsuffix $(so_suffix), \
663 $(LOCAL_SHARED_LIBRARIES)))
664
Ying Wangcce4c972011-03-03 18:53:53 -0800665my_system_shared_libraries_fullpath := \
666 $(my_ndk_stl_shared_lib_fullpath) \
667 $(addprefix $(my_ndk_version_root)/usr/lib/, \
668 $(addsuffix $(so_suffix), $(LOCAL_SYSTEM_SHARED_LIBRARIES)))
Ying Wang1a081002010-07-13 14:55:47 -0700669
670built_shared_libraries += $(my_system_shared_libraries_fullpath)
671LOCAL_SHARED_LIBRARIES += $(LOCAL_SYSTEM_SHARED_LIBRARIES)
672else
673LOCAL_SHARED_LIBRARIES += $(LOCAL_SYSTEM_SHARED_LIBRARIES)
674built_shared_libraries := \
675 $(addprefix $($(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
676 $(addsuffix $(so_suffix), \
677 $(LOCAL_SHARED_LIBRARIES)))
Ying Wang1a081002010-07-13 14:55:47 -0700678endif
679
The Android Open Source Project88b60792009-03-03 19:28:42 -0800680built_static_libraries := \
681 $(foreach lib,$(LOCAL_STATIC_LIBRARIES), \
682 $(call intermediates-dir-for, \
683 STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE))/$(lib)$(a_suffix))
684
Ying Wang848020f2012-08-14 10:13:16 -0700685ifdef LOCAL_SDK_VERSION
Ying Wangcce4c972011-03-03 18:53:53 -0800686built_static_libraries += $(my_ndk_stl_static_lib)
687endif
688
The Android Open Source Project88b60792009-03-03 19:28:42 -0800689built_whole_libraries := \
690 $(foreach lib,$(LOCAL_WHOLE_STATIC_LIBRARIES), \
691 $(call intermediates-dir-for, \
692 STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE))/$(lib)$(a_suffix))
693
The Android Open Source Project88b60792009-03-03 19:28:42 -0800694# We don't care about installed static libraries, since the
695# libraries have already been linked into the module at that point.
696# We do, however, care about the NOTICE files for any static
Steve Blockd14d3b42012-03-01 11:34:41 +0000697# libraries that we use. (see notice_files.mk)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800698
699installed_static_library_notice_file_targets := \
700 $(foreach lib,$(LOCAL_STATIC_LIBRARIES) $(LOCAL_WHOLE_STATIC_LIBRARIES), \
701 NOTICE-$(if $(LOCAL_IS_HOST_MODULE),HOST,TARGET)-STATIC_LIBRARIES-$(lib))
702
Doug Kwan9a8ecf92011-05-10 21:50:58 -0700703# Default is -fno-rtti.
Doug Kwane3c3c6d2011-06-07 10:55:48 -0700704ifeq ($(strip $(LOCAL_RTTI_FLAG)),)
705LOCAL_RTTI_FLAG := -fno-rtti
706endif
Doug Kwan9a8ecf92011-05-10 21:50:58 -0700707
The Android Open Source Project88b60792009-03-03 19:28:42 -0800708###########################################################
709# Rule-specific variable definitions
710###########################################################
711$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_YACCFLAGS := $(LOCAL_YACCFLAGS)
712$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASFLAGS := $(LOCAL_ASFLAGS)
Ying Wang7429e212012-08-15 10:59:10 -0700713$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CONLYFLAGS := $(LOCAL_CONLYFLAGS)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800714$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CFLAGS := $(LOCAL_CFLAGS)
715$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CPPFLAGS := $(LOCAL_CPPFLAGS)
Doug Kwan9a8ecf92011-05-10 21:50:58 -0700716$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RTTI_FLAG := $(LOCAL_RTTI_FLAG)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800717$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEBUG_CFLAGS := $(debug_cflags)
718$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_C_INCLUDES := $(LOCAL_C_INCLUDES)
Ying Wang5f074802011-11-08 09:31:21 -0800719$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_IMPORT_INCLUDES := $(import_includes)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800720$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDFLAGS := $(LOCAL_LDFLAGS)
721$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDLIBS := $(LOCAL_LDLIBS)
Jeff Brown703e7c62011-02-04 20:15:00 -0800722$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_NO_CRT := $(LOCAL_NO_CRT)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800723
724# this is really the way to get the files onto the command line instead
725# of using $^, because then LOCAL_ADDITIONAL_DEPENDENCIES doesn't work
726$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_SHARED_LIBRARIES := $(built_shared_libraries)
727$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_STATIC_LIBRARIES := $(built_static_libraries)
728$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_WHOLE_STATIC_LIBRARIES := $(built_whole_libraries)
729$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_OBJECTS := $(all_objects)
730
731###########################################################
732# Define library dependencies.
733###########################################################
734# all_libraries is used for the dependencies on LOCAL_BUILT_MODULE.
735all_libraries := \
736 $(built_shared_libraries) \
737 $(built_static_libraries) \
738 $(built_whole_libraries)
739
The Android Open Source Project88b60792009-03-03 19:28:42 -0800740# Also depend on the notice files for any static libraries that
741# are linked into this module. This will force them to be installed
742# when this module is.
743$(LOCAL_INSTALLED_MODULE): | $(installed_static_library_notice_file_targets)
Ying Wang5f074802011-11-08 09:31:21 -0800744
745###########################################################
746# Export includes
747###########################################################
748export_includes := $(intermediates)/export_includes
749$(export_includes): PRIVATE_EXPORT_C_INCLUDE_DIRS := $(LOCAL_EXPORT_C_INCLUDE_DIRS)
Ying Wang68f1c772012-04-23 21:29:18 -0700750$(export_includes) : $(LOCAL_MODULE_MAKEFILE)
Ying Wang5f074802011-11-08 09:31:21 -0800751 @echo Export includes file: $< -- $@
752 $(hide) mkdir -p $(dir $@) && rm -f $@
753ifdef LOCAL_EXPORT_C_INCLUDE_DIRS
754 $(hide) for d in $(PRIVATE_EXPORT_C_INCLUDE_DIRS); do \
755 echo "-I $$d" >> $@; \
756 done
757else
758 $(hide) touch $@
759endif
Ying Wang616e5962012-04-18 17:35:55 -0700760
761# Make sure export_includes gets generated when you are running mm/mmm
762$(LOCAL_BUILT_MODULE) : | $(export_includes)