blob: f40c4448d5baa2a65c3ff189bd998259892c919e [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####################################################
synergydev7c467422013-08-13 17:41:52 -0700117ifneq ($(strip $(LOCAL_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
Andrew Hsieh6cea59a2013-08-27 17:33:06 +0800173ifeq ($(strip $(WITH_SYNTAX_CHECK)),)
174 LOCAL_NO_SYNTAX_CHECK := true
175endif
176
Andrew Hsieh906cb782013-09-10 17:37:14 +0800177ifeq ($(strip $(WITH_STATIC_ANALYZER)),)
178 LOCAL_NO_STATIC_ANALYZER := true
179endif
180
Andrew Hsieh6cea59a2013-08-27 17:33:06 +0800181ifneq ($(strip $(LOCAL_IS_HOST_MODULE)),)
182 my_syntax_arch := host
183else
184 my_syntax_arch := $(TARGET_ARCH)
185endif
186
The Android Open Source Project88b60792009-03-03 19:28:42 -0800187ifeq ($(strip $(LOCAL_CC)),)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400188 ifeq ($(strip $(LOCAL_CLANG)),true)
189 LOCAL_CC := $(CLANG)
190 else
191 LOCAL_CC := $($(my_prefix)CC)
192 endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800193endif
Andrew Hsieh906cb782013-09-10 17:37:14 +0800194ifneq ($(LOCAL_NO_STATIC_ANALYZER),true)
195 LOCAL_CC := $(SYNTAX_TOOLS_PREFIX)/ccc-analyzer $(my_syntax_arch) "$(LOCAL_CC)"
196else
Andrew Hsieh6cea59a2013-08-27 17:33:06 +0800197ifneq ($(LOCAL_NO_SYNTAX_CHECK),true)
198 LOCAL_CC := $(SYNTAX_TOOLS_PREFIX)/ccc-syntax $(my_syntax_arch) "$(LOCAL_CC)"
199endif
Andrew Hsieh906cb782013-09-10 17:37:14 +0800200endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800201$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CC := $(LOCAL_CC)
202
203ifeq ($(strip $(LOCAL_CXX)),)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400204 ifeq ($(strip $(LOCAL_CLANG)),true)
205 LOCAL_CXX := $(CLANG_CXX)
206 else
207 LOCAL_CXX := $($(my_prefix)CXX)
208 endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800209endif
Andrew Hsieh906cb782013-09-10 17:37:14 +0800210ifneq ($(LOCAL_NO_STATIC_ANALYZER),true)
211 LOCAL_CXX := $(SYNTAX_TOOLS_PREFIX)/cxx-analyzer $(my_syntax_arch) "$(LOCAL_CXX)"
212else
Andrew Hsieh6cea59a2013-08-27 17:33:06 +0800213ifneq ($(LOCAL_NO_SYNTAX_CHECK),true)
214 LOCAL_CXX := $(SYNTAX_TOOLS_PREFIX)/cxx-syntax $(my_syntax_arch) "$(LOCAL_CXX)"
215endif
Andrew Hsieh906cb782013-09-10 17:37:14 +0800216endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800217$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CXX := $(LOCAL_CXX)
218
219# TODO: support a mix of standard extensions so that this isn't necessary
220LOCAL_CPP_EXTENSION := $(strip $(LOCAL_CPP_EXTENSION))
221ifeq ($(LOCAL_CPP_EXTENSION),)
222 LOCAL_CPP_EXTENSION := .cpp
223endif
224$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CPP_EXTENSION := $(LOCAL_CPP_EXTENSION)
225
226# Certain modules like libdl have to have symbols resolved at runtime and blow
227# up if --no-undefined is passed to the linker.
228ifeq ($(strip $(LOCAL_NO_DEFAULT_COMPILER_FLAGS)),)
229ifeq ($(strip $(LOCAL_ALLOW_UNDEFINED_SYMBOLS)),)
230 LOCAL_LDFLAGS := $(LOCAL_LDFLAGS) $($(my_prefix)NO_UNDEFINED_LDFLAGS)
231endif
232endif
233
Ying Wangfcdabd42011-04-25 14:22:41 -0700234ifeq (true,$(LOCAL_GROUP_STATIC_LIBRARIES))
235$(LOCAL_BUILT_MODULE): PRIVATE_GROUP_STATIC_LIBRARIES := true
236else
237$(LOCAL_BUILT_MODULE): PRIVATE_GROUP_STATIC_LIBRARIES :=
238endif
239
The Android Open Source Project88b60792009-03-03 19:28:42 -0800240###########################################################
241## Define arm-vs-thumb-mode flags.
242###########################################################
243LOCAL_ARM_MODE := $(strip $(LOCAL_ARM_MODE))
Chih-Wei Huang0d09e582010-07-09 10:07:52 +0800244ifeq ($(TARGET_ARCH),arm)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800245arm_objects_mode := $(if $(LOCAL_ARM_MODE),$(LOCAL_ARM_MODE),arm)
246normal_objects_mode := $(if $(LOCAL_ARM_MODE),$(LOCAL_ARM_MODE),thumb)
247
Dave Bort95282482009-04-23 18:44:55 -0700248# Read the values from something like TARGET_arm_CFLAGS or
249# TARGET_thumb_CFLAGS. HOST_(arm|thumb)_CFLAGS values aren't
250# actually used (although they are usually empty).
Evgeniy Stepanovf50f4c52012-04-05 11:44:37 +0400251ifeq ($(strip $(LOCAL_CLANG)),true)
252arm_objects_cflags := $($(my_prefix)$(arm_objects_mode)_CLANG_CFLAGS)
253normal_objects_cflags := $($(my_prefix)$(normal_objects_mode)_CLANG_CFLAGS)
254else
Dave Bort95282482009-04-23 18:44:55 -0700255arm_objects_cflags := $($(my_prefix)$(arm_objects_mode)_CFLAGS)
256normal_objects_cflags := $($(my_prefix)$(normal_objects_mode)_CFLAGS)
Evgeniy Stepanovf50f4c52012-04-05 11:44:37 +0400257endif
258
Chih-Wei Huang0d09e582010-07-09 10:07:52 +0800259else
260arm_objects_mode :=
261normal_objects_mode :=
262arm_objects_cflags :=
263normal_objects_cflags :=
264endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800265
266###########################################################
267## Define per-module debugging flags. Users can turn on
268## debugging for a particular module by setting DEBUG_MODULE_ModuleName
269## to a non-empty value in their environment or buildspec.mk,
270## and setting HOST_/TARGET_CUSTOM_DEBUG_CFLAGS to the
271## debug flags that they want to use.
272###########################################################
273ifdef DEBUG_MODULE_$(strip $(LOCAL_MODULE))
274 debug_cflags := $($(my_prefix)CUSTOM_DEBUG_CFLAGS)
275else
276 debug_cflags :=
277endif
278
Tim Murraya7aa8002012-10-29 16:06:00 -0700279####################################################
280## Compile RenderScript with reflected C++
281####################################################
282
283renderscript_sources := $(filter %.rs %.fs,$(LOCAL_SRC_FILES))
284
285ifneq (,$(renderscript_sources))
286
287renderscript_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(renderscript_sources))
288RenderScript_file_stamp := $(intermediates)/RenderScriptCPP.stamp
289renderscript_intermediate := $(intermediates)/renderscript
290
291ifeq ($(LOCAL_RENDERSCRIPT_CC),)
292LOCAL_RENDERSCRIPT_CC := $(LLVM_RS_CC)
293endif
294
295# Turn on all warnings and warnings as errors for RS compiles.
296# This can be disabled with LOCAL_RENDERSCRIPT_FLAGS := -Wno-error
297renderscript_flags := -Wall -Werror
298renderscript_flags += $(LOCAL_RENDERSCRIPT_FLAGS)
299
300LOCAL_RENDERSCRIPT_INCLUDES := \
301 $(TOPDIR)external/clang/lib/Headers \
302 $(TOPDIR)frameworks/rs/scriptc \
303 $(LOCAL_RENDERSCRIPT_INCLUDES)
304
305ifneq ($(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE),)
306LOCAL_RENDERSCRIPT_INCLUDES := $(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE)
307endif
308
309$(RenderScript_file_stamp): PRIVATE_RS_INCLUDES := $(LOCAL_RENDERSCRIPT_INCLUDES)
310$(RenderScript_file_stamp): PRIVATE_RS_CC := $(LOCAL_RENDERSCRIPT_CC)
311$(RenderScript_file_stamp): PRIVATE_RS_FLAGS := $(renderscript_flags)
312$(RenderScript_file_stamp): PRIVATE_RS_SOURCE_FILES := $(renderscript_sources_fullpath)
313$(RenderScript_file_stamp): PRIVATE_RS_OUTPUT_DIR := $(renderscript_intermediate)
314$(RenderScript_file_stamp): $(renderscript_sources_fullpath) $(LOCAL_RENDERSCRIPT_CC)
315 $(transform-renderscripts-to-cpp-and-bc)
316
317# include the dependency files (.d) generated by llvm-rs-cc.
318renderscript_generated_dep_files := $(addprefix $(renderscript_intermediate)/, \
319 $(patsubst %.fs,%.d, $(patsubst %.rs,%.d, $(notdir $(renderscript_sources)))))
320-include $(renderscript_generated_dep_files)
321
322LOCAL_INTERMEDIATE_TARGETS += $(RenderScript_file_stamp)
323
324rs_generated_cpps := $(addprefix \
325 $(renderscript_intermediate)/ScriptC_,$(patsubst %.fs,%.cpp, $(patsubst %.rs,%.cpp, \
326 $(notdir $(renderscript_sources)))))
327
328$(rs_generated_cpps) : $(RenderScript_file_stamp)
329
330LOCAL_C_INCLUDES += $(renderscript_intermediate)
331LOCAL_GENERATED_SOURCES += $(rs_generated_cpps)
332
333endif
334
335
The Android Open Source Project88b60792009-03-03 19:28:42 -0800336###########################################################
337## Stuff source generated from one-off tools
338###########################################################
339$(LOCAL_GENERATED_SOURCES): PRIVATE_MODULE := $(LOCAL_MODULE)
340
341ALL_GENERATED_SOURCES += $(LOCAL_GENERATED_SOURCES)
342
343
344###########################################################
Ying Wanga5fc87a2010-11-02 18:43:16 -0700345## Compile the .proto files to .cc and then to .o
346###########################################################
347proto_sources := $(filter %.proto,$(LOCAL_SRC_FILES))
348proto_generated_objects :=
349proto_generated_headers :=
350ifneq ($(proto_sources),)
351proto_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(proto_sources))
352proto_generated_cc_sources_dir := $(intermediates)/proto
353proto_generated_cc_sources := $(addprefix $(proto_generated_cc_sources_dir)/, \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700354 $(patsubst %.proto,%.pb.cc,$(proto_sources_fullpath)))
Ying Wanga5fc87a2010-11-02 18:43:16 -0700355proto_generated_objects := $(patsubst %.cc,%.o, $(proto_generated_cc_sources))
356
357$(proto_generated_cc_sources): PRIVATE_PROTO_INCLUDES := $(TOP)
358$(proto_generated_cc_sources): PRIVATE_PROTO_CC_OUTPUT_DIR := $(proto_generated_cc_sources_dir)
Ying Wang33c0d952010-11-05 11:30:58 -0700359$(proto_generated_cc_sources): PRIVATE_PROTOC_FLAGS := $(LOCAL_PROTOC_FLAGS)
Ying Wanga5fc87a2010-11-02 18:43:16 -0700360$(proto_generated_cc_sources): $(proto_generated_cc_sources_dir)/%.pb.cc: %.proto $(PROTOC)
361 $(transform-proto-to-cc)
362
363proto_generated_headers := $(patsubst %.pb.cc,%.pb.h, $(proto_generated_cc_sources))
364$(proto_generated_headers): $(proto_generated_cc_sources_dir)/%.pb.h: $(proto_generated_cc_sources_dir)/%.pb.cc
365
Ying Wang022a7b32012-06-13 11:38:10 -0700366$(proto_generated_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
367$(proto_generated_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
Narayan Kamath21094872012-04-02 18:19:31 +0100368$(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 -0700369 $(transform-$(PRIVATE_HOST)cpp-to-o)
370-include $(proto_generated_objects:%.o=%.P)
371
372LOCAL_C_INCLUDES += external/protobuf/src $(proto_generated_cc_sources_dir)
373LOCAL_CFLAGS += -DGOOGLE_PROTOBUF_NO_RTTI
374ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),full)
375LOCAL_STATIC_LIBRARIES += libprotobuf-cpp-2.3.0-full
376else
377LOCAL_STATIC_LIBRARIES += libprotobuf-cpp-2.3.0-lite
378endif
379endif
380
381
382###########################################################
The Android Open Source Project88b60792009-03-03 19:28:42 -0800383## YACC: Compile .y files to .cpp and the to .o.
384###########################################################
385
386yacc_sources := $(filter %.y,$(LOCAL_SRC_FILES))
387yacc_cpps := $(addprefix \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700388 $(intermediates)/,$(yacc_sources:.y=$(LOCAL_CPP_EXTENSION)))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800389yacc_headers := $(yacc_cpps:$(LOCAL_CPP_EXTENSION)=.h)
390yacc_objects := $(yacc_cpps:$(LOCAL_CPP_EXTENSION)=.o)
391
392ifneq ($(strip $(yacc_cpps)),)
393$(yacc_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700394 $(TOPDIR)$(LOCAL_PATH)/%.y \
395 $(lex_cpps) $(LOCAL_ADDITIONAL_DEPENDENCIES)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800396 $(call transform-y-to-cpp,$(PRIVATE_CPP_EXTENSION))
397$(yacc_headers): $(intermediates)/%.h: $(intermediates)/%$(LOCAL_CPP_EXTENSION)
398
399$(yacc_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
400$(yacc_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
401$(yacc_objects): $(intermediates)/%.o: $(intermediates)/%$(LOCAL_CPP_EXTENSION)
402 $(transform-$(PRIVATE_HOST)cpp-to-o)
403endif
404
405###########################################################
406## LEX: Compile .l files to .cpp and then to .o.
407###########################################################
408
409lex_sources := $(filter %.l,$(LOCAL_SRC_FILES))
410lex_cpps := $(addprefix \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700411 $(intermediates)/,$(lex_sources:.l=$(LOCAL_CPP_EXTENSION)))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800412lex_objects := $(lex_cpps:$(LOCAL_CPP_EXTENSION)=.o)
413
414ifneq ($(strip $(lex_cpps)),)
415$(lex_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700416 $(TOPDIR)$(LOCAL_PATH)/%.l
The Android Open Source Project88b60792009-03-03 19:28:42 -0800417 $(transform-l-to-cpp)
418
419$(lex_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
420$(lex_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
421$(lex_objects): $(intermediates)/%.o: \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700422 $(intermediates)/%$(LOCAL_CPP_EXTENSION) \
423 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
424 $(yacc_headers)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800425 $(transform-$(PRIVATE_HOST)cpp-to-o)
426endif
427
428###########################################################
429## C++: Compile .cpp files to .o.
430###########################################################
431
Jeff Browne33ba4c2011-07-11 22:11:46 -0700432# we also do this on host modules, even though
The Android Open Source Project88b60792009-03-03 19:28:42 -0800433# it's not really arm, because there are files that are shared.
434cpp_arm_sources := $(patsubst %$(LOCAL_CPP_EXTENSION).arm,%$(LOCAL_CPP_EXTENSION),$(filter %$(LOCAL_CPP_EXTENSION).arm,$(LOCAL_SRC_FILES)))
435cpp_arm_objects := $(addprefix $(intermediates)/,$(cpp_arm_sources:$(LOCAL_CPP_EXTENSION)=.o))
436
437cpp_normal_sources := $(filter %$(LOCAL_CPP_EXTENSION),$(LOCAL_SRC_FILES))
438cpp_normal_objects := $(addprefix $(intermediates)/,$(cpp_normal_sources:$(LOCAL_CPP_EXTENSION)=.o))
439
440$(cpp_arm_objects): PRIVATE_ARM_MODE := $(arm_objects_mode)
441$(cpp_arm_objects): PRIVATE_ARM_CFLAGS := $(arm_objects_cflags)
442$(cpp_normal_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
443$(cpp_normal_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
444
445cpp_objects := $(cpp_arm_objects) $(cpp_normal_objects)
446
447ifneq ($(strip $(cpp_objects)),)
448$(cpp_objects): $(intermediates)/%.o: \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700449 $(TOPDIR)$(LOCAL_PATH)/%$(LOCAL_CPP_EXTENSION) \
Ying Wang9c3aa052013-02-20 13:34:05 -0800450 $(yacc_cpps) $(proto_generated_headers) \
451 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
452 | $(my_compiler_dependencies)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800453 $(transform-$(PRIVATE_HOST)cpp-to-o)
454-include $(cpp_objects:%.o=%.P)
455endif
456
457###########################################################
458## C++: Compile generated .cpp files to .o.
459###########################################################
460
461gen_cpp_sources := $(filter %$(LOCAL_CPP_EXTENSION),$(LOCAL_GENERATED_SOURCES))
462gen_cpp_objects := $(gen_cpp_sources:%$(LOCAL_CPP_EXTENSION)=%.o)
463
464ifneq ($(strip $(gen_cpp_objects)),)
465# Compile all generated files as thumb.
466# TODO: support compiling certain generated files as arm.
467$(gen_cpp_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
468$(gen_cpp_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400469$(gen_cpp_objects): $(intermediates)/%.o: \
470 $(intermediates)/%$(LOCAL_CPP_EXTENSION) $(yacc_cpps) \
Ying Wang9c3aa052013-02-20 13:34:05 -0800471 $(proto_generated_headers) \
472 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
473 | $(my_compiler_dependencies)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800474 $(transform-$(PRIVATE_HOST)cpp-to-o)
475-include $(gen_cpp_objects:%.o=%.P)
476endif
477
478###########################################################
479## S: Compile generated .S and .s files to .o.
480###########################################################
481
482gen_S_sources := $(filter %.S,$(LOCAL_GENERATED_SOURCES))
483gen_S_objects := $(gen_S_sources:%.S=%.o)
484
485ifneq ($(strip $(gen_S_sources)),)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400486$(gen_S_objects): $(intermediates)/%.o: $(intermediates)/%.S \
Ying Wang9c3aa052013-02-20 13:34:05 -0800487 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
488 | $(my_compiler_dependencies)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800489 $(transform-$(PRIVATE_HOST)s-to-o)
490-include $(gen_S_objects:%.o=%.P)
491endif
492
493gen_s_sources := $(filter %.s,$(LOCAL_GENERATED_SOURCES))
494gen_s_objects := $(gen_s_sources:%.s=%.o)
495
496ifneq ($(strip $(gen_s_objects)),)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400497$(gen_s_objects): $(intermediates)/%.o: $(intermediates)/%.s \
Ying Wang9c3aa052013-02-20 13:34:05 -0800498 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
499 | $(my_compiler_dependencies)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800500 $(transform-$(PRIVATE_HOST)s-to-o-no-deps)
501-include $(gen_s_objects:%.o=%.P)
502endif
503
504gen_asm_objects := $(gen_S_objects) $(gen_s_objects)
505
506###########################################################
Torne (Richard Coles)aace2022013-02-21 14:01:35 +0000507## o: Include generated .o files in output.
508###########################################################
509
510gen_o_objects := $(filter %.o,$(LOCAL_GENERATED_SOURCES))
511
512###########################################################
The Android Open Source Project88b60792009-03-03 19:28:42 -0800513## C: Compile .c files to .o.
514###########################################################
515
516c_arm_sources := $(patsubst %.c.arm,%.c,$(filter %.c.arm,$(LOCAL_SRC_FILES)))
517c_arm_objects := $(addprefix $(intermediates)/,$(c_arm_sources:.c=.o))
518
519c_normal_sources := $(filter %.c,$(LOCAL_SRC_FILES))
520c_normal_objects := $(addprefix $(intermediates)/,$(c_normal_sources:.c=.o))
521
522$(c_arm_objects): PRIVATE_ARM_MODE := $(arm_objects_mode)
523$(c_arm_objects): PRIVATE_ARM_CFLAGS := $(arm_objects_cflags)
524$(c_normal_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
525$(c_normal_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
526
527c_objects := $(c_arm_objects) $(c_normal_objects)
528
529ifneq ($(strip $(c_objects)),)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400530$(c_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.c $(yacc_cpps) $(proto_generated_headers) \
Ying Wang9c3aa052013-02-20 13:34:05 -0800531 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
532 | $(my_compiler_dependencies)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800533 $(transform-$(PRIVATE_HOST)c-to-o)
534-include $(c_objects:%.o=%.P)
535endif
536
537###########################################################
Jack Paleviche7b3e2c2009-05-04 14:32:44 -0700538## C: Compile generated .c files to .o.
539###########################################################
540
541gen_c_sources := $(filter %.c,$(LOCAL_GENERATED_SOURCES))
542gen_c_objects := $(gen_c_sources:%.c=%.o)
543
544ifneq ($(strip $(gen_c_objects)),)
545# Compile all generated files as thumb.
546# TODO: support compiling certain generated files as arm.
547$(gen_c_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
548$(gen_c_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400549$(gen_c_objects): $(intermediates)/%.o: $(intermediates)/%.c $(yacc_cpps) $(proto_generated_headers) \
Ying Wang9c3aa052013-02-20 13:34:05 -0800550 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
551 | $(my_compiler_dependencies)
Jack Paleviche7b3e2c2009-05-04 14:32:44 -0700552 $(transform-$(PRIVATE_HOST)c-to-o)
553-include $(gen_c_objects:%.o=%.P)
554endif
555
556###########################################################
David 'Digit' Turner5dbb5292009-05-14 16:00:09 +0200557## ObjC: Compile .m files to .o
558###########################################################
559
560objc_sources := $(filter %.m,$(LOCAL_SRC_FILES))
561objc_objects := $(addprefix $(intermediates)/,$(objc_sources:.m=.o))
562
563ifneq ($(strip $(objc_objects)),)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400564$(objc_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.m $(yacc_cpps) $(proto_generated_headers) \
Ying Wang9c3aa052013-02-20 13:34:05 -0800565 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
566 | $(my_compiler_dependencies)
David 'Digit' Turner5dbb5292009-05-14 16:00:09 +0200567 $(transform-$(PRIVATE_HOST)m-to-o)
568-include $(objc_objects:%.o=%.P)
569endif
570
571###########################################################
The Android Open Source Project88b60792009-03-03 19:28:42 -0800572## AS: Compile .S files to .o.
573###########################################################
574
575asm_sources_S := $(filter %.S,$(LOCAL_SRC_FILES))
576asm_objects_S := $(addprefix $(intermediates)/,$(asm_sources_S:.S=.o))
577
578ifneq ($(strip $(asm_objects_S)),)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400579$(asm_objects_S): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.S \
Ying Wang9c3aa052013-02-20 13:34:05 -0800580 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
581 | $(my_compiler_dependencies)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800582 $(transform-$(PRIVATE_HOST)s-to-o)
583-include $(asm_objects_S:%.o=%.P)
584endif
585
586asm_sources_s := $(filter %.s,$(LOCAL_SRC_FILES))
587asm_objects_s := $(addprefix $(intermediates)/,$(asm_sources_s:.s=.o))
588
589ifneq ($(strip $(asm_objects_s)),)
Evgeniy Stepanovb71e2df2012-03-20 18:00:16 +0400590$(asm_objects_s): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.s \
Ying Wang9c3aa052013-02-20 13:34:05 -0800591 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
592 | $(my_compiler_dependencies)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800593 $(transform-$(PRIVATE_HOST)s-to-o-no-deps)
594-include $(asm_objects_s:%.o=%.P)
595endif
596
597asm_objects := $(asm_objects_S) $(asm_objects_s)
598
599
Ying Wang5f074802011-11-08 09:31:21 -0800600####################################################
601## Import includes
602####################################################
603import_includes := $(intermediates)/import_includes
604import_includes_deps := $(strip \
605 $(foreach l, $(installed_shared_library_module_names), \
606 $(call intermediates-dir-for,SHARED_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE))/export_includes) \
607 $(foreach l, $(LOCAL_STATIC_LIBRARIES) $(LOCAL_WHOLE_STATIC_LIBRARIES), \
608 $(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE))/export_includes))
609$(import_includes) : $(import_includes_deps)
610 @echo Import includes file: $@
611 $(hide) mkdir -p $(dir $@) && rm -f $@
612ifdef import_includes_deps
613 $(hide) for f in $^; do \
614 cat $$f >> $@; \
615 done
616else
617 $(hide) touch $@
618endif
619
The Android Open Source Project88b60792009-03-03 19:28:42 -0800620###########################################################
621## Common object handling.
622###########################################################
623
624# some rules depend on asm_objects being first. If your code depends on
625# being first, it's reasonable to require it to be assembly
626all_objects := \
Ying Wangdfbe79b2012-03-22 11:26:22 -0700627 $(asm_objects) \
628 $(cpp_objects) \
629 $(gen_cpp_objects) \
630 $(gen_asm_objects) \
631 $(c_objects) \
632 $(gen_c_objects) \
633 $(objc_objects) \
634 $(yacc_objects) \
635 $(lex_objects) \
636 $(proto_generated_objects) \
Torne (Richard Coles)aace2022013-02-21 14:01:35 +0000637 $(addprefix $(TOPDIR)$(LOCAL_PATH)/,$(LOCAL_PREBUILT_OBJ_FILES)) \
638 $(gen_o_objects)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800639
Colin Cross9ad36ef2012-03-30 19:31:00 -0700640LOCAL_C_INCLUDES += $(TOPDIR)$(LOCAL_PATH) $(intermediates)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800641
Ying Wang848020f2012-08-14 10:13:16 -0700642ifndef LOCAL_SDK_VERSION
Ying Wangbce4b752010-07-22 15:51:56 -0700643 LOCAL_C_INCLUDES += $(JNI_H_INCLUDE)
644endif
645
Torne (Richard Coles)aace2022013-02-21 14:01:35 +0000646# .o files need to be filtered out of LOCAL_GENERATED_SOURCES
647# to avoid creating circular dependencies.
648$(all_objects) : | $(filter-out %.o,$(LOCAL_GENERATED_SOURCES)) $(import_includes)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800649ALL_C_CPP_ETC_OBJECTS += $(all_objects)
650
651###########################################################
652## Copy headers to the install tree
653###########################################################
654include $(BUILD_COPY_HEADERS)
655
656###########################################################
657# Standard library handling.
The Android Open Source Project88b60792009-03-03 19:28:42 -0800658###########################################################
The Android Open Source Project88b60792009-03-03 19:28:42 -0800659
660###########################################################
661# The list of libraries that this module will link against are in
662# these variables. Each is a list of bare module names like "libc libm".
663#
664# LOCAL_SHARED_LIBRARIES
665# LOCAL_STATIC_LIBRARIES
666# LOCAL_WHOLE_STATIC_LIBRARIES
667#
668# We need to convert the bare names into the dependencies that
669# we'll use for LOCAL_BUILT_MODULE and LOCAL_INSTALLED_MODULE.
670# LOCAL_BUILT_MODULE should depend on the BUILT versions of the
671# libraries, so that simply building this module doesn't force
672# an install of a library. Similarly, LOCAL_INSTALLED_MODULE
673# should depend on the INSTALLED versions of the libraries so
674# that they get installed when this module does.
675###########################################################
676# NOTE:
677# WHOLE_STATIC_LIBRARIES are libraries that are pulled into the
678# module without leaving anything out, which is useful for turning
679# a collection of .a files into a .so file. Linking against a
680# normal STATIC_LIBRARY will only pull in code/symbols that are
681# referenced by the module. (see gcc/ld's --whole-archive option)
682###########################################################
683
684# Get the list of BUILT libraries, which are under
685# various intermediates directories.
686so_suffix := $($(my_prefix)SHLIB_SUFFIX)
687a_suffix := $($(my_prefix)STATIC_LIB_SUFFIX)
688
Ying Wang848020f2012-08-14 10:13:16 -0700689ifdef LOCAL_SDK_VERSION
The Android Open Source Project88b60792009-03-03 19:28:42 -0800690built_shared_libraries := \
691 $(addprefix $($(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
692 $(addsuffix $(so_suffix), \
693 $(LOCAL_SHARED_LIBRARIES)))
694
Ying Wangcce4c972011-03-03 18:53:53 -0800695my_system_shared_libraries_fullpath := \
696 $(my_ndk_stl_shared_lib_fullpath) \
697 $(addprefix $(my_ndk_version_root)/usr/lib/, \
698 $(addsuffix $(so_suffix), $(LOCAL_SYSTEM_SHARED_LIBRARIES)))
Ying Wang1a081002010-07-13 14:55:47 -0700699
700built_shared_libraries += $(my_system_shared_libraries_fullpath)
701LOCAL_SHARED_LIBRARIES += $(LOCAL_SYSTEM_SHARED_LIBRARIES)
702else
703LOCAL_SHARED_LIBRARIES += $(LOCAL_SYSTEM_SHARED_LIBRARIES)
704built_shared_libraries := \
705 $(addprefix $($(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
706 $(addsuffix $(so_suffix), \
707 $(LOCAL_SHARED_LIBRARIES)))
Ying Wang1a081002010-07-13 14:55:47 -0700708endif
709
The Android Open Source Project88b60792009-03-03 19:28:42 -0800710built_static_libraries := \
711 $(foreach lib,$(LOCAL_STATIC_LIBRARIES), \
712 $(call intermediates-dir-for, \
713 STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE))/$(lib)$(a_suffix))
714
Ying Wang848020f2012-08-14 10:13:16 -0700715ifdef LOCAL_SDK_VERSION
Ying Wangcce4c972011-03-03 18:53:53 -0800716built_static_libraries += $(my_ndk_stl_static_lib)
717endif
718
The Android Open Source Project88b60792009-03-03 19:28:42 -0800719built_whole_libraries := \
720 $(foreach lib,$(LOCAL_WHOLE_STATIC_LIBRARIES), \
721 $(call intermediates-dir-for, \
722 STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE))/$(lib)$(a_suffix))
723
The Android Open Source Project88b60792009-03-03 19:28:42 -0800724# We don't care about installed static libraries, since the
725# libraries have already been linked into the module at that point.
726# We do, however, care about the NOTICE files for any static
Steve Blockd14d3b42012-03-01 11:34:41 +0000727# libraries that we use. (see notice_files.mk)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800728
729installed_static_library_notice_file_targets := \
730 $(foreach lib,$(LOCAL_STATIC_LIBRARIES) $(LOCAL_WHOLE_STATIC_LIBRARIES), \
731 NOTICE-$(if $(LOCAL_IS_HOST_MODULE),HOST,TARGET)-STATIC_LIBRARIES-$(lib))
732
Doug Kwan9a8ecf92011-05-10 21:50:58 -0700733# Default is -fno-rtti.
Doug Kwane3c3c6d2011-06-07 10:55:48 -0700734ifeq ($(strip $(LOCAL_RTTI_FLAG)),)
735LOCAL_RTTI_FLAG := -fno-rtti
736endif
Doug Kwan9a8ecf92011-05-10 21:50:58 -0700737
The Android Open Source Project88b60792009-03-03 19:28:42 -0800738###########################################################
739# Rule-specific variable definitions
740###########################################################
741$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_YACCFLAGS := $(LOCAL_YACCFLAGS)
742$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASFLAGS := $(LOCAL_ASFLAGS)
Ying Wang7429e212012-08-15 10:59:10 -0700743$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CONLYFLAGS := $(LOCAL_CONLYFLAGS)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800744$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CFLAGS := $(LOCAL_CFLAGS)
745$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CPPFLAGS := $(LOCAL_CPPFLAGS)
Doug Kwan9a8ecf92011-05-10 21:50:58 -0700746$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RTTI_FLAG := $(LOCAL_RTTI_FLAG)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800747$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEBUG_CFLAGS := $(debug_cflags)
748$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_C_INCLUDES := $(LOCAL_C_INCLUDES)
Ying Wang5f074802011-11-08 09:31:21 -0800749$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_IMPORT_INCLUDES := $(import_includes)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800750$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDFLAGS := $(LOCAL_LDFLAGS)
751$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDLIBS := $(LOCAL_LDLIBS)
Jeff Brown703e7c62011-02-04 20:15:00 -0800752$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_NO_CRT := $(LOCAL_NO_CRT)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800753
754# this is really the way to get the files onto the command line instead
755# of using $^, because then LOCAL_ADDITIONAL_DEPENDENCIES doesn't work
756$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_SHARED_LIBRARIES := $(built_shared_libraries)
757$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_STATIC_LIBRARIES := $(built_static_libraries)
758$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_WHOLE_STATIC_LIBRARIES := $(built_whole_libraries)
759$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_OBJECTS := $(all_objects)
760
761###########################################################
762# Define library dependencies.
763###########################################################
764# all_libraries is used for the dependencies on LOCAL_BUILT_MODULE.
765all_libraries := \
766 $(built_shared_libraries) \
767 $(built_static_libraries) \
768 $(built_whole_libraries)
769
The Android Open Source Project88b60792009-03-03 19:28:42 -0800770# Also depend on the notice files for any static libraries that
771# are linked into this module. This will force them to be installed
772# when this module is.
773$(LOCAL_INSTALLED_MODULE): | $(installed_static_library_notice_file_targets)
Ying Wang5f074802011-11-08 09:31:21 -0800774
775###########################################################
776# Export includes
777###########################################################
778export_includes := $(intermediates)/export_includes
779$(export_includes): PRIVATE_EXPORT_C_INCLUDE_DIRS := $(LOCAL_EXPORT_C_INCLUDE_DIRS)
Ying Wang68f1c772012-04-23 21:29:18 -0700780$(export_includes) : $(LOCAL_MODULE_MAKEFILE)
Ying Wang5f074802011-11-08 09:31:21 -0800781 @echo Export includes file: $< -- $@
782 $(hide) mkdir -p $(dir $@) && rm -f $@
783ifdef LOCAL_EXPORT_C_INCLUDE_DIRS
784 $(hide) for d in $(PRIVATE_EXPORT_C_INCLUDE_DIRS); do \
785 echo "-I $$d" >> $@; \
786 done
787else
788 $(hide) touch $@
789endif
Ying Wang616e5962012-04-18 17:35:55 -0700790
791# Make sure export_includes gets generated when you are running mm/mmm
792$(LOCAL_BUILT_MODULE) : | $(export_includes)