blob: 0294cf208f87c6c61a714e14ee557c24cc8f1c9c [file] [log] [blame]
The Android Open Source Project88b60792009-03-03 19:28:42 -08001#
2# Copyright (C) 2008 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17# Users can define base-rules-hook in their buildspec.mk to perform
18# arbitrary operations as each module is included.
19ifdef base-rules-hook
20$(if $(base-rules-hook),)
21endif
22
23###########################################################
24## Common instructions for a generic module.
25###########################################################
26
27LOCAL_MODULE := $(strip $(LOCAL_MODULE))
28ifeq ($(LOCAL_MODULE),)
29 $(error $(LOCAL_PATH): LOCAL_MODULE is not defined)
30endif
31
32LOCAL_IS_HOST_MODULE := $(strip $(LOCAL_IS_HOST_MODULE))
33ifdef LOCAL_IS_HOST_MODULE
34 ifneq ($(LOCAL_IS_HOST_MODULE),true)
35 $(error $(LOCAL_PATH): LOCAL_IS_HOST_MODULE must be "true" or empty, not "$(LOCAL_IS_HOST_MODULE)")
36 endif
Ying Wang13d69502012-11-01 17:22:33 -070037 my_prefix := HOST_
38 my_host := host-
The Android Open Source Project88b60792009-03-03 19:28:42 -080039else
Ying Wang13d69502012-11-01 17:22:33 -070040 my_prefix := TARGET_
41 my_host :=
The Android Open Source Project88b60792009-03-03 19:28:42 -080042endif
43
Ying Wang37bd1f22014-01-27 15:19:09 -080044my_module_tags := $(LOCAL_MODULE_TAGS)
45
The Android Open Source Project88b60792009-03-03 19:28:42 -080046###########################################################
47## Validate and define fallbacks for input LOCAL_* variables.
48###########################################################
49
50## Dump a .csv file of all modules and their tags
51#ifneq ($(tag-list-first-time),false)
52#$(shell rm -f tag-list.csv)
53#tag-list-first-time := false
54#endif
Ying Wang37bd1f22014-01-27 15:19:09 -080055#$(shell echo $(lastword $(filter-out config/% out/%,$(MAKEFILE_LIST))),$(LOCAL_MODULE),$(strip $(LOCAL_MODULE_CLASS)),$(subst $(space),$(comma),$(sort $(my_module_tags))) >> tag-list.csv)
The Android Open Source Project88b60792009-03-03 19:28:42 -080056
Ying Wang6e371e42012-05-15 14:31:26 -070057LOCAL_UNINSTALLABLE_MODULE := $(strip $(LOCAL_UNINSTALLABLE_MODULE))
Ying Wang37bd1f22014-01-27 15:19:09 -080058my_module_tags := $(sort $(my_module_tags))
59ifeq (,$(my_module_tags))
60 my_module_tags := optional
Ying Wang2fd81cf2010-12-10 11:17:28 -080061endif
Joe Onorato918ee312012-05-18 20:43:14 -070062
Joe Onorato6a185e42012-05-22 14:08:50 -070063# User tags are not allowed anymore. Fail early because it will not be installed
64# like it used to be.
Ying Wang37bd1f22014-01-27 15:19:09 -080065ifneq ($(filter $(my_module_tags),user),)
Joe Onorato6a185e42012-05-22 14:08:50 -070066 $(warning *** Module name: $(LOCAL_MODULE))
67 $(warning *** Makefile location: $(LOCAL_MODULE_MAKEFILE))
68 $(warning * )
69 $(warning * Module is attempting to use the 'user' tag. This)
70 $(warning * used to cause the module to be installed automatically.)
71 $(warning * Now, the module must be listed in the PRODUCT_PACKAGES)
72 $(warning * section of a product makefile to have it installed.)
73 $(warning * )
74 $(error user tag detected on module.)
75endif
The Android Open Source Project88b60792009-03-03 19:28:42 -080076
Jean-Baptiste Querua831cbd2010-01-07 11:06:50 -080077# Only the tags mentioned in this test are expected to be set by module
78# makefiles. Anything else is either a typo or a source of unexpected
79# behaviors.
Ying Wang37bd1f22014-01-27 15:19:09 -080080ifneq ($(filter-out debug eng tests optional samples,$(my_module_tags)),)
81$(warning unusual tags $(my_module_tags) on $(LOCAL_MODULE) at $(LOCAL_PATH))
Jean-Baptiste Querua831cbd2010-01-07 11:06:50 -080082endif
83
The Android Open Source Project88b60792009-03-03 19:28:42 -080084# Add implicit tags.
85#
86# If the local directory or one of its parents contains a MODULE_LICENSE_GPL
Andrew Boie08a943b2013-12-10 13:52:00 -080087# file, tag the module as "gnu". Search for "*_GPL*", "*_LGPL*" and "*_MPL*"
88# so that we can also find files like MODULE_LICENSE_GPL_AND_AFL
The Android Open Source Project88b60792009-03-03 19:28:42 -080089#
Ying Wang39b9b692015-05-07 12:08:53 -070090license_files := $(call find-parent-file,$(LOCAL_PATH),MODULE_LICENSE*)
Andrew Boie08a943b2013-12-10 13:52:00 -080091gpl_license_file := $(call find-parent-file,$(LOCAL_PATH),MODULE_LICENSE*_GPL* MODULE_LICENSE*_MPL* MODULE_LICENSE*_LGPL*)
Ying Wangfd626f22011-12-12 12:57:38 -080092ifneq ($(gpl_license_file),)
Ying Wang37bd1f22014-01-27 15:19:09 -080093 my_module_tags += gnu
Ying Wangfd626f22011-12-12 12:57:38 -080094 ALL_GPL_MODULE_LICENSE_FILES := $(sort $(ALL_GPL_MODULE_LICENSE_FILES) $(gpl_license_file))
The Android Open Source Project88b60792009-03-03 19:28:42 -080095endif
96
The Android Open Source Project88b60792009-03-03 19:28:42 -080097LOCAL_MODULE_CLASS := $(strip $(LOCAL_MODULE_CLASS))
98ifneq ($(words $(LOCAL_MODULE_CLASS)),1)
99 $(error $(LOCAL_PATH): LOCAL_MODULE_CLASS must contain exactly one word, not "$(LOCAL_MODULE_CLASS)")
100endif
101
Ying Wang6feb6d52014-04-17 10:03:35 -0700102my_32_64_bit_suffix := $(if $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)IS_64_BIT),64,32)
Colin Cross87974052014-03-21 12:25:44 -0700103
Ying Wang6e371e42012-05-15 14:31:26 -0700104ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
Colin Cross87974052014-03-21 12:25:44 -0700105my_multilib_module_path := $(strip $(LOCAL_MODULE_PATH_$(my_32_64_bit_suffix)))
Colin Cross87974052014-03-21 12:25:44 -0700106ifdef my_multilib_module_path
107my_module_path := $(my_multilib_module_path)
108else
Ying Wangb8e01852014-01-23 15:09:04 -0800109my_module_path := $(strip $(LOCAL_MODULE_PATH))
Colin Cross87974052014-03-21 12:25:44 -0700110endif
Colin Cross639c3362014-01-24 19:23:40 -0800111my_module_relative_path := $(strip $(LOCAL_MODULE_RELATIVE_PATH))
Ying Wangb8e01852014-01-23 15:09:04 -0800112ifeq ($(my_module_path),)
Ying Wang5338fbf2013-05-08 15:49:08 -0700113 ifdef LOCAL_IS_HOST_MODULE
114 partition_tag :=
115 else
116 ifeq (true,$(LOCAL_PROPRIETARY_MODULE))
117 partition_tag := _VENDOR
Ying Wangb8888432014-03-11 17:13:27 -0700118 else ifeq (true,$(LOCAL_OEM_MODULE))
119 partition_tag := _OEM
Ying Wang5338fbf2013-05-08 15:49:08 -0700120 else
121 # The definition of should-install-to-system will be different depending
122 # on which goal (e.g., sdk or just droid) is being built.
Ying Wang37bd1f22014-01-27 15:19:09 -0800123 partition_tag := $(if $(call should-install-to-system,$(my_module_tags)),,_DATA)
Ying Wang5338fbf2013-05-08 15:49:08 -0700124 endif
125 endif
Ying Wang6ef65192014-01-15 16:02:16 -0800126 install_path_var := $(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT$(partition_tag)_$(LOCAL_MODULE_CLASS)
Ying Wang5338fbf2013-05-08 15:49:08 -0700127 ifeq (true,$(LOCAL_PRIVILEGED_MODULE))
128 install_path_var := $(install_path_var)_PRIVILEGED
129 endif
130
Colin Crossb34911c2014-01-22 17:34:28 -0800131 my_module_path := $($(install_path_var))
Ying Wangb8e01852014-01-23 15:09:04 -0800132 ifeq ($(strip $(my_module_path)),)
133 $(error $(LOCAL_PATH): unhandled install path "$(install_path_var) for $(LOCAL_MODULE)")
The Android Open Source Project88b60792009-03-03 19:28:42 -0800134 endif
135endif
Colin Cross639c3362014-01-24 19:23:40 -0800136ifneq ($(my_module_relative_path),)
137 my_module_path := $(my_module_path)/$(my_module_relative_path)
138endif
Ying Wang6e371e42012-05-15 14:31:26 -0700139endif # not LOCAL_UNINSTALLABLE_MODULE
The Android Open Source Project88b60792009-03-03 19:28:42 -0800140
141ifneq ($(strip $(LOCAL_BUILT_MODULE)$(LOCAL_INSTALLED_MODULE)),)
142 $(error $(LOCAL_PATH): LOCAL_BUILT_MODULE and LOCAL_INSTALLED_MODULE must not be defined by component makefiles)
143endif
144
Ying Wang6ef65192014-01-15 16:02:16 -0800145my_register_name := $(LOCAL_MODULE)
146ifdef LOCAL_2ND_ARCH_VAR_PREFIX
Colin Crossaee1e772014-02-04 11:16:16 -0800147ifndef LOCAL_NO_2ND_ARCH_MODULE_SUFFIX
Ying Wang6feb6d52014-04-17 10:03:35 -0700148my_register_name := $(LOCAL_MODULE)$($(my_prefix)2ND_ARCH_MODULE_SUFFIX)
Ying Wang6ef65192014-01-15 16:02:16 -0800149endif
Colin Crossaee1e772014-02-04 11:16:16 -0800150endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800151# Make sure that this IS_HOST/CLASS/MODULE combination is unique.
152module_id := MODULE.$(if \
Ying Wang6ef65192014-01-15 16:02:16 -0800153 $(LOCAL_IS_HOST_MODULE),HOST,TARGET).$(LOCAL_MODULE_CLASS).$(my_register_name)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800154ifdef $(module_id)
155$(error $(LOCAL_PATH): $(module_id) already defined by $($(module_id)))
156endif
157$(module_id) := $(LOCAL_PATH)
158
Ying Wang6ef65192014-01-15 16:02:16 -0800159intermediates := $(call local-intermediates-dir,,$(LOCAL_2ND_ARCH_VAR_PREFIX))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800160intermediates.COMMON := $(call local-intermediates-dir,COMMON)
Colin Crossd8262642014-01-24 23:17:21 -0800161generated_sources_dir := $(call local-generated-sources-dir)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800162
163###########################################################
164# Pick a name for the intermediate and final targets
165###########################################################
Colin Cross5a9db902014-03-21 12:27:37 -0700166include $(BUILD_SYSTEM)/configure_module_stem.mk
The Android Open Source Project88b60792009-03-03 19:28:42 -0800167
168# OVERRIDE_BUILT_MODULE_PATH is only allowed to be used by the
169# internal SHARED_LIBRARIES build files.
170OVERRIDE_BUILT_MODULE_PATH := $(strip $(OVERRIDE_BUILT_MODULE_PATH))
171ifdef OVERRIDE_BUILT_MODULE_PATH
172 ifneq ($(LOCAL_MODULE_CLASS),SHARED_LIBRARIES)
173 $(error $(LOCAL_PATH): Illegal use of OVERRIDE_BUILT_MODULE_PATH)
174 endif
175 built_module_path := $(OVERRIDE_BUILT_MODULE_PATH)
176else
177 built_module_path := $(intermediates)
178endif
Ying Wang966c1e02014-05-20 14:43:51 -0700179LOCAL_BUILT_MODULE := $(built_module_path)/$(my_built_module_stem)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800180
Ying Wang162991b2011-09-07 10:21:42 -0700181ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
Ying Wangaf9757e2014-07-17 21:24:42 -0700182 # Apk and its attachments reside in its own subdir.
183 ifeq ($(LOCAL_MODULE_CLASS),APPS)
184 # framework-res.apk doesn't like the additional layer.
185 ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
186 my_module_path := $(my_module_path)/$(LOCAL_MODULE)
187 endif
188 endif
Ying Wang966c1e02014-05-20 14:43:51 -0700189 LOCAL_INSTALLED_MODULE := $(my_module_path)/$(my_installed_module_stem)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800190endif
191
192# Assemble the list of targets to create PRIVATE_ variables for.
193LOCAL_INTERMEDIATE_TARGETS += $(LOCAL_BUILT_MODULE)
194
195
196###########################################################
197## AIDL: Compile .aidl files to .java
198###########################################################
199
200aidl_sources := $(filter %.aidl,$(LOCAL_SRC_FILES))
201
202ifneq ($(strip $(aidl_sources)),)
203
204aidl_java_sources := $(patsubst %.aidl,%.java,$(addprefix $(intermediates.COMMON)/src/, $(aidl_sources)))
205aidl_sources := $(addprefix $(TOP_DIR)$(LOCAL_PATH)/, $(aidl_sources))
206
Ying Wange3265fb2010-01-25 09:56:41 -0800207aidl_preprocess_import :=
208LOCAL_SDK_VERSION:=$(strip $(LOCAL_SDK_VERSION))
209ifdef LOCAL_SDK_VERSION
Ying Wangefb93582014-07-19 17:00:50 -0700210ifneq ($(filter current system_current, $(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS)),)
Ying Wang0ec188f2012-05-10 17:25:51 -0700211 # LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS
Ying Wanga07d37b2010-06-09 11:43:33 -0700212 aidl_preprocess_import := $(TARGET_OUT_COMMON_INTERMEDIATES)/framework.aidl
213else
214 aidl_preprocess_import := $(HISTORICAL_SDK_VERSIONS_ROOT)/$(LOCAL_SDK_VERSION)/framework.aidl
Ying Wangefb93582014-07-19 17:00:50 -0700215endif # not current or system_current
Ying Wangd74b5382013-10-01 18:16:45 -0700216else
217# build against the platform.
218LOCAL_AIDL_INCLUDES += $(FRAMEWORKS_BASE_JAVA_SRC_DIRS)
Ying Wange3265fb2010-01-25 09:56:41 -0800219endif # LOCAL_SDK_VERSION
Ying Wanga07d37b2010-06-09 11:43:33 -0700220$(aidl_java_sources): PRIVATE_AIDL_FLAGS := -b $(addprefix -p,$(aidl_preprocess_import)) -I$(LOCAL_PATH) -I$(LOCAL_PATH)/src $(addprefix -I,$(LOCAL_AIDL_INCLUDES))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800221
Dan Albert954b5bd2014-11-08 22:20:03 -0800222$(aidl_java_sources): $(intermediates.COMMON)/src/%.java: \
223 $(TOPDIR)$(LOCAL_PATH)/%.aidl \
224 $(LOCAL_MODULE_MAKEFILE) \
225 $(LOCAL_ADDITIONAL_DEPENDENCIES) \
226 $(AIDL) \
227 $(aidl_preprocess_import)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800228 $(transform-aidl-to-java)
229-include $(aidl_java_sources:%.java=%.P)
230
231else
232aidl_java_sources :=
233endif
234
235###########################################################
Doug Zongker9bd49622009-11-30 14:28:59 -0800236## logtags: Add .logtags files to global list, emit java source
237###########################################################
238
239logtags_sources := $(filter %.logtags,$(LOCAL_SRC_FILES))
240
241ifneq ($(strip $(logtags_sources)),)
242
243event_log_tags := $(addprefix $(LOCAL_PATH)/,$(logtags_sources))
244
245# Emit a java source file with constants for the tags, if
246# LOCAL_MODULE_CLASS is "APPS" or "JAVA_LIBRARIES".
Ying Wang1a5ada12014-07-07 15:01:15 -0700247ifneq ($(filter $(LOCAL_MODULE_CLASS),APPS JAVA_LIBRARIES),)
Doug Zongker9bd49622009-11-30 14:28:59 -0800248
249logtags_java_sources := $(patsubst %.logtags,%.java,$(addprefix $(intermediates.COMMON)/src/, $(logtags_sources)))
250logtags_sources := $(addprefix $(TOP_DIR)$(LOCAL_PATH)/, $(logtags_sources))
251
Joe Onoratob7510532010-07-14 10:22:54 -0700252$(logtags_java_sources): $(intermediates.COMMON)/src/%.java: $(TOPDIR)$(LOCAL_PATH)/%.logtags $(TARGET_OUT_COMMON_INTERMEDIATES)/all-event-log-tags.txt
Doug Zongker9bd49622009-11-30 14:28:59 -0800253 $(transform-logtags-to-java)
254
255endif
256
257else
258logtags_java_sources :=
259event_log_tags :=
260endif
261
262###########################################################
Ying Wanga5fc87a2010-11-02 18:43:16 -0700263## .proto files: Compile proto files to .java
264###########################################################
265proto_sources := $(filter %.proto,$(LOCAL_SRC_FILES))
266# Because names of the .java files compiled from .proto files are unknown until the
267# .proto files are compiled, we use a timestamp file as depedency.
268proto_java_sources_file_stamp :=
269ifneq ($(proto_sources),)
270proto_sources_fullpath := $(addprefix $(TOP_DIR)$(LOCAL_PATH)/, $(proto_sources))
271# By putting the generated java files into $(LOCAL_INTERMEDIATE_SOURCE_DIR), they will be
272# automatically found by the java compiling function transform-java-to-classes.jar.
Ying Wang60293912010-11-05 11:20:03 -0700273ifneq ($(LOCAL_INTERMEDIATE_SOURCE_DIR),)
Ying Wanga5fc87a2010-11-02 18:43:16 -0700274proto_java_intemediate_dir := $(LOCAL_INTERMEDIATE_SOURCE_DIR)/proto
Ying Wang60293912010-11-05 11:20:03 -0700275else
276# LOCAL_INTERMEDIATE_SOURCE_DIR may be not defined in non-java modules.
277proto_java_intemediate_dir := $(intermediates)/proto
278endif
Ying Wanga5fc87a2010-11-02 18:43:16 -0700279proto_java_sources_file_stamp := $(proto_java_intemediate_dir)/Proto.stamp
280proto_java_sources_dir := $(proto_java_intemediate_dir)/src
281
282$(proto_java_sources_file_stamp): PRIVATE_PROTO_INCLUDES := $(TOP)
283$(proto_java_sources_file_stamp): PRIVATE_PROTO_SRC_FILES := $(proto_sources_fullpath)
284$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_DIR := $(proto_java_sources_dir)
285ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),micro)
286$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --javamicro_out
287else
Ulas Kirazci76e3a392013-03-28 14:02:14 -0700288 ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nano)
289$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --javanano_out
290 else
Ying Wanga5fc87a2010-11-02 18:43:16 -0700291$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --java_out
Ulas Kirazci76e3a392013-03-28 14:02:14 -0700292 endif
Ying Wanga5fc87a2010-11-02 18:43:16 -0700293endif
Ying Wang33c0d952010-11-05 11:30:58 -0700294$(proto_java_sources_file_stamp): PRIVATE_PROTOC_FLAGS := $(LOCAL_PROTOC_FLAGS)
Ulas Kirazci6e485b52013-07-25 12:28:19 -0700295$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_PARAMS := $(LOCAL_PROTO_JAVA_OUTPUT_PARAMS)
Ying Wanga5fc87a2010-11-02 18:43:16 -0700296$(proto_java_sources_file_stamp) : $(proto_sources_fullpath) $(PROTOC)
297 $(call transform-proto-to-java)
298
299#TODO: protoc should output the dependencies introduced by imports.
300
301LOCAL_INTERMEDIATE_TARGETS += $(proto_java_sources_file_stamp)
302endif # proto_sources
303
304
305###########################################################
The Android Open Source Project88b60792009-03-03 19:28:42 -0800306## Java: Compile .java files to .class
307###########################################################
308#TODO: pull this into java.make once host and target are combined
309
Ying Wang52911302010-05-26 13:13:56 -0700310java_sources := $(addprefix $(TOP_DIR)$(LOCAL_PATH)/, $(filter %.java,$(LOCAL_SRC_FILES))) $(aidl_java_sources) $(logtags_java_sources) \
311 $(filter %.java,$(LOCAL_GENERATED_SOURCES))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800312all_java_sources := $(java_sources) $(addprefix $($(my_prefix)OUT_COMMON_INTERMEDIATES)/, $(filter %.java,$(LOCAL_INTERMEDIATE_SOURCES)))
313
314## Java resources #########################################
315
316# Look for resource files in any specified directories.
317# Non-java and non-doc files will be picked up as resources
318# and included in the output jar file.
319java_resource_file_groups :=
320
321LOCAL_JAVA_RESOURCE_DIRS := $(strip $(LOCAL_JAVA_RESOURCE_DIRS))
322ifneq ($(LOCAL_JAVA_RESOURCE_DIRS),)
323 # This makes a list of words like
324 # <dir1>::<file1>:<file2> <dir2>::<file1> <dir3>:
325 # where each of the files is relative to the directory it's grouped with.
326 # Directories that don't contain any resource files will result in groups
327 # that end with a colon, and they are stripped out in the next step.
328 java_resource_file_groups += \
329 $(foreach dir,$(LOCAL_JAVA_RESOURCE_DIRS), \
330 $(subst $(space),:,$(strip \
331 $(TOP_DIR)$(LOCAL_PATH)/$(dir): \
332 $(patsubst ./%,%,$(shell cd $(TOP_DIR)$(LOCAL_PATH)/$(dir) && \
333 find . \
334 -type d -a -name ".svn" -prune -o \
335 -type f \
336 -a \! -name "*.java" \
337 -a \! -name "package.html" \
338 -a \! -name "overview.html" \
339 -a \! -name ".*.swp" \
340 -a \! -name ".DS_Store" \
341 -a \! -name "*~" \
342 -print \
343 )) \
344 )) \
345 )
346 java_resource_file_groups := $(filter-out %:,$(java_resource_file_groups))
347endif # LOCAL_JAVA_RESOURCE_DIRS
348
349LOCAL_JAVA_RESOURCE_FILES := $(strip $(LOCAL_JAVA_RESOURCE_FILES))
350ifneq ($(LOCAL_JAVA_RESOURCE_FILES),)
351 java_resource_file_groups += \
352 $(foreach f,$(LOCAL_JAVA_RESOURCE_FILES), \
353 $(patsubst %/,%,$(dir $(f)))::$(notdir $(f)) \
354 )
355endif # LOCAL_JAVA_RESOURCE_FILES
356
357ifdef java_resource_file_groups
358 # The full paths to all resources, used for dependencies.
359 java_resource_sources := \
360 $(foreach group,$(java_resource_file_groups), \
361 $(addprefix $(word 1,$(subst :,$(space),$(group)))/, \
362 $(wordlist 2,9999,$(subst :,$(space),$(group))) \
363 ) \
364 )
365 # The arguments to jar that will include these files in a jar file.
Ying Wang194a8ec2011-06-06 14:34:52 -0700366 # Quote the file name to handle special characters (such as #) correctly.
The Android Open Source Project88b60792009-03-03 19:28:42 -0800367 extra_jar_args := \
368 $(foreach group,$(java_resource_file_groups), \
Ying Wang194a8ec2011-06-06 14:34:52 -0700369 $(addprefix -C "$(word 1,$(subst :,$(space),$(group)))" , \
370 $(foreach w, $(wordlist 2,9999,$(subst :,$(space),$(group))), "$(w)" ) \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800371 ) \
372 )
373 java_resource_file_groups :=
374else
375 java_resource_sources :=
376 extra_jar_args :=
377endif # java_resource_file_groups
378
379## PRIVATE java vars ######################################
Ying Wang990cf5e2013-08-28 13:04:46 -0700380# LOCAL_SOURCE_FILES_ALL_GENERATED is set only if the module does not have static source files,
381# but generated source files in its LOCAL_INTERMEDIATE_SOURCE_DIR.
382# You have to set up the dependency in some other way.
383need_compile_java := $(strip $(all_java_sources)$(all_res_assets))$(LOCAL_STATIC_JAVA_LIBRARIES)$(filter true,$(LOCAL_SOURCE_FILES_ALL_GENERATED))
384ifdef need_compile_java
The Android Open Source Project88b60792009-03-03 19:28:42 -0800385
386full_static_java_libs := \
387 $(foreach lib,$(LOCAL_STATIC_JAVA_LIBRARIES), \
388 $(call intermediates-dir-for, \
Ying Wanga83940f2010-09-24 18:09:04 -0700389 JAVA_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),COMMON)/javalib.jar)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800390
391$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_INSTALL_DIR := $(dir $(LOCAL_INSTALLED_MODULE))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800392$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CLASS_INTERMEDIATES_DIR := $(intermediates)/classes
393$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SOURCE_INTERMEDIATES_DIR := $(intermediates)/src
394$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAVA_SOURCES := $(all_java_sources)
395$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAVA_OBJECTS := $(patsubst %.java,%.class,$(LOCAL_SRC_FILES))
396ifeq ($(my_prefix),TARGET_)
Joe Onoratoe62902c2009-09-23 15:28:12 -0700397ifeq ($(LOCAL_SDK_VERSION),)
Brian Carlstrom074151b2014-06-23 15:34:17 -0700398$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,core-libart)
Ying Wanga07d37b2010-06-09 11:43:33 -0700399else
Ying Wang0ec188f2012-05-10 17:25:51 -0700400ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),current)
401# LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS.
Ying Wanga07d37b2010-06-09 11:43:33 -0700402$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,android_stubs_current)
Ying Wangefb93582014-07-19 17:00:50 -0700403else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),system_current)
404$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,android_system_stubs_current)
Ying Wanga07d37b2010-06-09 11:43:33 -0700405else
406$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,sdk_v$(LOCAL_SDK_VERSION))
Ying Wangefb93582014-07-19 17:00:50 -0700407endif # current or system_current
Ying Wanga07d37b2010-06-09 11:43:33 -0700408endif # LOCAL_SDK_VERSION
409endif # TARGET_
The Android Open Source Project88b60792009-03-03 19:28:42 -0800410$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RESOURCE_DIR := $(LOCAL_RESOURCE_DIR)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800411$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASSET_DIR := $(LOCAL_ASSET_DIR)
412$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_STATIC_JAVA_LIBRARIES := $(full_static_java_libs)
413
414# full_java_libs: The list of files that should be used as the classpath.
415# Using this list as a dependency list WILL NOT WORK.
416# full_java_lib_deps: Should be specified as a prerequisite of this module
417# to guarantee that the files in full_java_libs will
418# be up-to-date.
419ifdef LOCAL_IS_HOST_MODULE
Narayan Kamath40dae1f2013-10-28 13:20:52 +0000420ifeq ($(USE_CORE_LIB_BOOTCLASSPATH),true)
Brian Carlstromb1dafb12014-06-18 15:11:01 -0700421$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-deps,core-libart-hostdex,$(LOCAL_IS_HOST_MODULE))
Ying Wang015edd22011-01-20 15:01:56 -0800422
Ying Wang7311a342013-08-21 18:32:49 -0700423full_shared_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
Ying Wang73ca57f2010-09-10 18:38:10 -0700424full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
425else
Ying Wang015edd22011-01-20 15:01:56 -0800426$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH :=
427
Ying Wang7311a342013-08-21 18:32:49 -0700428full_shared_java_libs := $(addprefix $(HOST_OUT_JAVA_LIBRARIES)/,\
429 $(addsuffix $(COMMON_JAVA_PACKAGE_SUFFIX),$(LOCAL_JAVA_LIBRARIES)))
430full_java_lib_deps := $(full_shared_java_libs)
Ying Wangf25318a2014-07-07 17:15:38 -0700431endif # USE_CORE_LIB_BOOTCLASSPATH
432else # !LOCAL_IS_HOST_MODULE
Ying Wang7311a342013-08-21 18:32:49 -0700433full_shared_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800434full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
Ying Wange3265fb2010-01-25 09:56:41 -0800435endif # !LOCAL_IS_HOST_MODULE
Ying Wang7311a342013-08-21 18:32:49 -0700436full_java_libs := $(full_shared_java_libs) $(full_static_java_libs) $(LOCAL_CLASSPATH)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800437full_java_lib_deps += $(full_static_java_libs) $(LOCAL_CLASSPATH)
438
Dianne Hackborna1fece02013-03-11 18:04:55 -0700439# This is set by packages that are linking to other packages that export
440# shared libraries, allowing them to make use of the code in the linked apk.
Adam Lesinski5eebe0f2014-03-25 15:45:34 -0700441apk_libraries := $(sort $(LOCAL_APK_LIBRARIES) $(LOCAL_RES_LIBRARIES))
442ifneq ($(apk_libraries),)
Dianne Hackborna1fece02013-03-11 18:04:55 -0700443 link_apk_libraries := \
Adam Lesinski5eebe0f2014-03-25 15:45:34 -0700444 $(foreach lib,$(apk_libraries), \
Dianne Hackborna1fece02013-03-11 18:04:55 -0700445 $(call intermediates-dir-for, \
446 APPS,$(lib),,COMMON)/classes.jar)
447
448 # link against the jar with full original names (before proguard processing).
Ying Wang638ce572013-08-23 11:59:49 -0700449 full_shared_java_libs += $(link_apk_libraries)
Dianne Hackborna1fece02013-03-11 18:04:55 -0700450 full_java_libs += $(link_apk_libraries)
451 full_java_lib_deps += $(link_apk_libraries)
452endif
453
The Android Open Source Project88b60792009-03-03 19:28:42 -0800454# This is set by packages that contain instrumentation, allowing them to
455# link against the package they are instrumenting. Currently only one such
456# package is allowed.
457LOCAL_INSTRUMENTATION_FOR := $(strip $(LOCAL_INSTRUMENTATION_FOR))
458ifdef LOCAL_INSTRUMENTATION_FOR
459 ifneq ($(words $(LOCAL_INSTRUMENTATION_FOR)),1)
460 $(error \
461 $(LOCAL_PATH): Multiple LOCAL_INSTRUMENTATION_FOR members defined)
462 endif
463
The Android Open Source Project88b60792009-03-03 19:28:42 -0800464 link_instr_intermediates_dir.COMMON := $(call intermediates-dir-for, \
465 APPS,$(LOCAL_INSTRUMENTATION_FOR),,COMMON)
Ying Wang3b2bdf12010-02-01 09:51:23 -0800466 # link against the jar with full original names (before proguard processing).
Ying Wang7311a342013-08-21 18:32:49 -0700467 link_instr_classes_jar := $(link_instr_intermediates_dir.COMMON)/classes.jar
468 full_java_libs += $(link_instr_classes_jar)
469 full_java_lib_deps += $(link_instr_classes_jar)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800470endif
471
Ying Wangfc6d5b62014-09-30 17:32:58 -0700472endif # need_compile_java
473
474# We may want to add jar manifest or jar resource files even if there is no java code at all.
475$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_EXTRA_JAR_ARGS := $(extra_jar_args)
Ying Wangc06243d2010-04-26 20:09:56 -0700476jar_manifest_file :=
The Android Open Source Project88b60792009-03-03 19:28:42 -0800477ifneq ($(strip $(LOCAL_JAR_MANIFEST)),)
Ying Wangc06243d2010-04-26 20:09:56 -0700478jar_manifest_file := $(LOCAL_PATH)/$(LOCAL_JAR_MANIFEST)
479$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAR_MANIFEST := $(jar_manifest_file)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800480else
481$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAR_MANIFEST :=
482endif
483
The Android Open Source Project88b60792009-03-03 19:28:42 -0800484###########################################################
485## make clean- targets
486###########################################################
Ying Wang6ef65192014-01-15 16:02:16 -0800487cleantarget := clean-$(my_register_name)
488$(cleantarget) : PRIVATE_MODULE := $(my_register_name)
Ying Wang4d063412013-03-22 18:52:57 -0700489$(cleantarget) : PRIVATE_CLEAN_FILES := \
Ying Wang95221ca2012-11-07 14:07:34 -0800490 $(LOCAL_BUILT_MODULE) \
491 $(LOCAL_INSTALLED_MODULE) \
492 $(intermediates)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800493$(cleantarget)::
494 @echo "Clean: $(PRIVATE_MODULE)"
495 $(hide) rm -rf $(PRIVATE_CLEAN_FILES)
496
497###########################################################
498## Common definitions for module.
499###########################################################
500
Ying Wang95221ca2012-11-07 14:07:34 -0800501# aapt doesn't accept multiple --extra-packages flags.
502# We have to collapse them into a single --extra-packages flag here.
503LOCAL_AAPT_FLAGS := $(strip $(LOCAL_AAPT_FLAGS))
504ifdef LOCAL_AAPT_FLAGS
505ifeq ($(filter 0 1,$(words $(filter --extra-packages,$(LOCAL_AAPT_FLAGS)))),)
506aapt_flags := $(subst --extra-packages$(space),--extra-packages@,$(LOCAL_AAPT_FLAGS))
507aapt_flags_extra_packages := $(patsubst --extra-packages@%,%,$(filter --extra-packages@%,$(aapt_flags)))
508aapt_flags_extra_packages := $(sort $(subst :,$(space),$(aapt_flags_extra_packages)))
509LOCAL_AAPT_FLAGS := $(filter-out --extra-packages@%,$(aapt_flags)) \
510 --extra-packages $(subst $(space),:,$(aapt_flags_extra_packages))
511aapt_flags_extra_packages :=
512aapt_flags :=
513endif
514endif
515
The Android Open Source Project88b60792009-03-03 19:28:42 -0800516# Propagate local configuration options to this target.
517$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_PATH:=$(LOCAL_PATH)
Igor Viarheichykc4dfe6e2014-06-26 14:56:21 -0700518$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_AAPT_FLAGS:= $(LOCAL_AAPT_FLAGS) $(PRODUCT_AAPT_FLAGS)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800519$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_JAVA_LIBRARIES:= $(LOCAL_JAVA_LIBRARIES)
Jeff Hamiltonbb67d212010-02-05 22:36:42 -0600520$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_MANIFEST_PACKAGE_NAME:= $(LOCAL_MANIFEST_PACKAGE_NAME)
Ying Wang3dae0ee2010-09-02 15:41:01 -0700521$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_MANIFEST_INSTRUMENTATION_FOR:= $(LOCAL_MANIFEST_INSTRUMENTATION_FOR)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800522
523$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_ALL_JAVA_LIBRARIES:= $(full_java_libs)
524$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_IS_HOST_MODULE := $(LOCAL_IS_HOST_MODULE)
525$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_HOST:= $(my_host)
526
Dima Zavin46e9bec2009-05-27 19:41:07 -0700527$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_INTERMEDIATES_DIR:= $(intermediates)
528
Ying Wang6feb6d52014-04-17 10:03:35 -0700529$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_2ND_ARCH_VAR_PREFIX := $(LOCAL_2ND_ARCH_VAR_PREFIX)
530
The Android Open Source Project88b60792009-03-03 19:28:42 -0800531# Tell the module and all of its sub-modules who it is.
Ying Wang6ef65192014-01-15 16:02:16 -0800532$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_MODULE:= $(my_register_name)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800533
534# Provide a short-hand for building this module.
535# We name both BUILT and INSTALLED in case
536# LOCAL_UNINSTALLABLE_MODULE is set.
Ying Wang6ef65192014-01-15 16:02:16 -0800537.PHONY: $(my_register_name)
538$(my_register_name): $(LOCAL_BUILT_MODULE) $(LOCAL_INSTALLED_MODULE)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800539
540###########################################################
541## Module installation rule
542###########################################################
543
544# Some hosts do not have ACP; override the LOCAL version if that's the case.
545ifneq ($(strip $(HOST_ACP_UNAVAILABLE)),)
546 LOCAL_ACP_UNAVAILABLE := $(strip $(HOST_ACP_UNAVAILABLE))
547endif
548
549ifndef LOCAL_UNINSTALLABLE_MODULE
550 # Define a copy rule to install the module.
551 # acp and libraries that it uses can't use acp for
552 # installation; hence, LOCAL_ACP_UNAVAILABLE.
Ying Wange56605a2013-02-06 11:44:41 -0800553$(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := $(LOCAL_POST_INSTALL_CMD)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800554ifneq ($(LOCAL_ACP_UNAVAILABLE),true)
555$(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE) | $(ACP)
556 @echo "Install: $@"
Ying Wang84ed6fa2011-01-18 17:21:20 -0800557 $(copy-file-to-new-target)
Ying Wange56605a2013-02-06 11:44:41 -0800558 $(PRIVATE_POST_INSTALL_CMD)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800559else
560$(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE)
561 @echo "Install: $@"
562 $(copy-file-to-target-with-cp)
563endif
564
565endif # !LOCAL_UNINSTALLABLE_MODULE
566
Joe Onoratoe334d252009-07-17 15:33:40 -0400567
568###########################################################
569## CHECK_BUILD goals
570###########################################################
Ying Wang6c1d1cc2014-09-29 14:34:32 -0700571my_checked_module :=
Joe Onoratoe334d252009-07-17 15:33:40 -0400572# If nobody has defined a more specific module for the
Ying Wang5a8d3452013-01-30 14:43:05 -0800573# checked modules, use LOCAL_BUILT_MODULE.
Ying Wang6c1d1cc2014-09-29 14:34:32 -0700574ifdef LOCAL_CHECKED_MODULE
575 my_checked_module := $(LOCAL_CHECKED_MODULE)
Ying Wang82605622014-09-29 17:10:34 -0700576else ifdef java_alternative_checked_module
577 my_checked_module := $(java_alternative_checked_module)
Ying Wang6c1d1cc2014-09-29 14:34:32 -0700578else
579 my_checked_module := $(LOCAL_BUILT_MODULE)
Joe Onoratoe334d252009-07-17 15:33:40 -0400580endif
581
582# If they request that this module not be checked, then don't.
583# PLEASE DON'T SET THIS. ANY PLACES THAT SET THIS WITHOUT
584# GOOD REASON WILL HAVE IT REMOVED.
585ifdef LOCAL_DONT_CHECK_MODULE
Ying Wang6c1d1cc2014-09-29 14:34:32 -0700586 my_checked_module :=
Joe Onoratoe334d252009-07-17 15:33:40 -0400587endif
Ying Wang966c1e02014-05-20 14:43:51 -0700588# Don't check build target module defined for the 2nd arch
589ifndef LOCAL_IS_HOST_MODULE
Ying Wang6ef65192014-01-15 16:02:16 -0800590ifdef LOCAL_2ND_ARCH_VAR_PREFIX
Ying Wang6c1d1cc2014-09-29 14:34:32 -0700591 my_checked_module :=
Ying Wang6ef65192014-01-15 16:02:16 -0800592endif
Ying Wang966c1e02014-05-20 14:43:51 -0700593endif
Joe Onoratoe334d252009-07-17 15:33:40 -0400594
The Android Open Source Project88b60792009-03-03 19:28:42 -0800595###########################################################
596## Register with ALL_MODULES
597###########################################################
598
Ying Wang6ef65192014-01-15 16:02:16 -0800599ALL_MODULES += $(my_register_name)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800600
601# Don't use += on subvars, or else they'll end up being
602# recursively expanded.
Ying Wang6ef65192014-01-15 16:02:16 -0800603ALL_MODULES.$(my_register_name).CLASS := \
604 $(ALL_MODULES.$(my_register_name).CLASS) $(LOCAL_MODULE_CLASS)
605ALL_MODULES.$(my_register_name).PATH := \
606 $(ALL_MODULES.$(my_register_name).PATH) $(LOCAL_PATH)
607ALL_MODULES.$(my_register_name).TAGS := \
Ying Wang37bd1f22014-01-27 15:19:09 -0800608 $(ALL_MODULES.$(my_register_name).TAGS) $(my_module_tags)
Ying Wang6ef65192014-01-15 16:02:16 -0800609ALL_MODULES.$(my_register_name).CHECKED := \
Ying Wang6c1d1cc2014-09-29 14:34:32 -0700610 $(ALL_MODULES.$(my_register_name).CHECKED) $(my_checked_module)
Ying Wang6ef65192014-01-15 16:02:16 -0800611ALL_MODULES.$(my_register_name).BUILT := \
612 $(ALL_MODULES.$(my_register_name).BUILT) $(LOCAL_BUILT_MODULE)
Ying Wang3380d3a2014-05-19 13:03:36 -0700613ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
Ying Wang6ef65192014-01-15 16:02:16 -0800614ALL_MODULES.$(my_register_name).INSTALLED := \
615 $(strip $(ALL_MODULES.$(my_register_name).INSTALLED) $(LOCAL_INSTALLED_MODULE))
Ying Wang3380d3a2014-05-19 13:03:36 -0700616ALL_MODULES.$(my_register_name).BUILT_INSTALLED := \
Ying Wang80b91d92014-05-20 16:20:44 -0700617 $(strip $(ALL_MODULES.$(my_register_name).BUILT_INSTALLED) $(LOCAL_BUILT_MODULE):$(LOCAL_INSTALLED_MODULE))
Ying Wang3380d3a2014-05-19 13:03:36 -0700618endif
Ying Wang3b81aab2014-05-05 16:46:52 -0700619ifdef LOCAL_PICKUP_FILES
620# Files or directories ready to pick up by the build system
621# when $(LOCAL_BUILT_MODULE) is done.
622ALL_MODULES.$(my_register_name).PICKUP_FILES := \
623 $(ALL_MODULES.$(my_register_name).PICKUP_FILES) $(LOCAL_PICKUP_FILES)
624endif
Ying Wang6ef65192014-01-15 16:02:16 -0800625ALL_MODULES.$(my_register_name).REQUIRED := \
Ying Wang14a6cbd2014-02-10 22:26:23 -0800626 $(strip $(ALL_MODULES.$(my_register_name).REQUIRED) $(LOCAL_REQUIRED_MODULES) \
627 $(LOCAL_REQUIRED_MODULES_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)))
Ying Wang6ef65192014-01-15 16:02:16 -0800628ALL_MODULES.$(my_register_name).EVENT_LOG_TAGS := \
629 $(ALL_MODULES.$(my_register_name).EVENT_LOG_TAGS) $(event_log_tags)
630ALL_MODULES.$(my_register_name).INTERMEDIATE_SOURCE_DIR := \
631 $(ALL_MODULES.$(my_register_name).INTERMEDIATE_SOURCE_DIR) $(LOCAL_INTERMEDIATE_SOURCE_DIR)
632ALL_MODULES.$(my_register_name).MAKEFILE := \
633 $(ALL_MODULES.$(my_register_name).MAKEFILE) $(LOCAL_MODULE_MAKEFILE)
Ying Wangdbb31be2011-12-09 15:11:57 -0800634ifdef LOCAL_MODULE_OWNER
Ying Wang6ef65192014-01-15 16:02:16 -0800635ALL_MODULES.$(my_register_name).OWNER := \
636 $(sort $(ALL_MODULES.$(my_register_name).OWNER) $(LOCAL_MODULE_OWNER))
Ying Wangdbb31be2011-12-09 15:11:57 -0800637endif
Ying Wang14a6cbd2014-02-10 22:26:23 -0800638ifdef LOCAL_2ND_ARCH_VAR_PREFIX
639ALL_MODULES.$(my_register_name).FOR_2ND_ARCH := true
640endif
Ying Wang1a5ada12014-07-07 15:01:15 -0700641ifdef aidl_sources
642ALL_MODULES.$(my_register_name).AIDL_FILES := $(aidl_sources)
643endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800644
Ying Wang6ef65192014-01-15 16:02:16 -0800645INSTALLABLE_FILES.$(LOCAL_INSTALLED_MODULE).MODULE := $(my_register_name)
Joe Onorato8a06bac2010-05-21 14:29:29 -0700646
Ying Wang39b9b692015-05-07 12:08:53 -0700647##########################################################
648# Track module-level dependencies.
649# Use $(LOCAL_MODULE) instead of $(my_register_name) to ignore module's bitness.
650ALL_DEPS.MODULES := $(sort $(ALL_DEPS.MODULES) $(LOCAL_MODULE))
651ALL_DEPS.$(LOCAL_MODULE).ALL_DEPS := $(sort \
652 $(ALL_MODULES.$(LOCAL_MODULE).ALL_DEPS) \
653 $(LOCAL_STATIC_LIBRARIES) \
654 $(LOCAL_WHOLE_STATIC_LIBRARIES) \
655 $(LOCAL_SHARED_LIBRARIES) \
656 $(LOCAL_STATIC_JAVA_LIBRARIES) \
657 $(LOCAL_JAVA_LIBRARIES)\
658 $(LOCAL_JNI_SHARED_LIBRARIES))
659
660ALL_DEPS.$(LOCAL_MODULE).LICENSE := $(sort $(ALL_DEPS.$(LOCAL_MODULE).LICENSE) $(license_files))
661
The Android Open Source Project88b60792009-03-03 19:28:42 -0800662###########################################################
Ying Wang37bd1f22014-01-27 15:19:09 -0800663## Take care of my_module_tags
The Android Open Source Project88b60792009-03-03 19:28:42 -0800664###########################################################
665
666# Keep track of all the tags we've seen.
Ying Wang37bd1f22014-01-27 15:19:09 -0800667ALL_MODULE_TAGS := $(sort $(ALL_MODULE_TAGS) $(my_module_tags))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800668
The Android Open Source Project88b60792009-03-03 19:28:42 -0800669# Add this module name to the tag list of each specified tag.
Ying Wang37bd1f22014-01-27 15:19:09 -0800670$(foreach tag,$(my_module_tags),\
Ying Wang6ef65192014-01-15 16:02:16 -0800671 $(eval ALL_MODULE_NAME_TAGS.$(tag) += $(my_register_name)))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800672
The Android Open Source Project88b60792009-03-03 19:28:42 -0800673###########################################################
Ying Wangef4d82f2013-01-29 16:59:18 -0800674## umbrella targets used to verify builds
675###########################################################
Ying Wangef4d82f2013-01-29 16:59:18 -0800676j_or_n :=
677ifneq (,$(filter EXECUTABLES SHARED_LIBRARIES STATIC_LIBRARIES,$(LOCAL_MODULE_CLASS)))
678j_or_n := native
679else
680ifneq (,$(filter JAVA_LIBRARIES APPS,$(LOCAL_MODULE_CLASS)))
681j_or_n := java
Ying Wangef4d82f2013-01-29 16:59:18 -0800682endif
683endif
684ifdef LOCAL_IS_HOST_MODULE
685h_or_t := host
686else
687h_or_t := target
688endif
689
690ifdef j_or_n
Ying Wang6c1d1cc2014-09-29 14:34:32 -0700691$(j_or_n) $(h_or_t) $(j_or_n)-$(h_or_t) : $(my_checked_module)
Ying Wang37bd1f22014-01-27 15:19:09 -0800692ifneq (,$(filter $(my_module_tags),tests))
Ying Wang6c1d1cc2014-09-29 14:34:32 -0700693$(j_or_n)-$(h_or_t)-tests $(j_or_n)-tests $(h_or_t)-tests : $(my_checked_module)
Ying Wangef4d82f2013-01-29 16:59:18 -0800694endif
695endif
696
697###########################################################
The Android Open Source Project88b60792009-03-03 19:28:42 -0800698## NOTICE files
699###########################################################
700
Ying Wang13d69502012-11-01 17:22:33 -0700701include $(BUILD_NOTICE_FILE)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800702
703#:vi noexpandtab