blob: 87ef414bd0d8969d5a9aa8666cca0177a7aa9550 [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 Wang4540a852015-03-12 18:30:39 -0700120 else ifeq (true,$(LOCAL_ODM_MODULE))
121 partition_tag := _ODM
Ying Wang5338fbf2013-05-08 15:49:08 -0700122 else
123 # The definition of should-install-to-system will be different depending
124 # on which goal (e.g., sdk or just droid) is being built.
Ying Wang37bd1f22014-01-27 15:19:09 -0800125 partition_tag := $(if $(call should-install-to-system,$(my_module_tags)),,_DATA)
Ying Wang5338fbf2013-05-08 15:49:08 -0700126 endif
127 endif
Ying Wang6ef65192014-01-15 16:02:16 -0800128 install_path_var := $(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT$(partition_tag)_$(LOCAL_MODULE_CLASS)
Ying Wang5338fbf2013-05-08 15:49:08 -0700129 ifeq (true,$(LOCAL_PRIVILEGED_MODULE))
130 install_path_var := $(install_path_var)_PRIVILEGED
131 endif
132
Colin Crossb34911c2014-01-22 17:34:28 -0800133 my_module_path := $($(install_path_var))
Ying Wangb8e01852014-01-23 15:09:04 -0800134 ifeq ($(strip $(my_module_path)),)
135 $(error $(LOCAL_PATH): unhandled install path "$(install_path_var) for $(LOCAL_MODULE)")
The Android Open Source Project88b60792009-03-03 19:28:42 -0800136 endif
137endif
Colin Cross639c3362014-01-24 19:23:40 -0800138ifneq ($(my_module_relative_path),)
139 my_module_path := $(my_module_path)/$(my_module_relative_path)
140endif
Ying Wang6e371e42012-05-15 14:31:26 -0700141endif # not LOCAL_UNINSTALLABLE_MODULE
The Android Open Source Project88b60792009-03-03 19:28:42 -0800142
143ifneq ($(strip $(LOCAL_BUILT_MODULE)$(LOCAL_INSTALLED_MODULE)),)
144 $(error $(LOCAL_PATH): LOCAL_BUILT_MODULE and LOCAL_INSTALLED_MODULE must not be defined by component makefiles)
145endif
146
Ying Wang6ef65192014-01-15 16:02:16 -0800147my_register_name := $(LOCAL_MODULE)
148ifdef LOCAL_2ND_ARCH_VAR_PREFIX
Colin Crossaee1e772014-02-04 11:16:16 -0800149ifndef LOCAL_NO_2ND_ARCH_MODULE_SUFFIX
Ying Wang6feb6d52014-04-17 10:03:35 -0700150my_register_name := $(LOCAL_MODULE)$($(my_prefix)2ND_ARCH_MODULE_SUFFIX)
Ying Wang6ef65192014-01-15 16:02:16 -0800151endif
Colin Crossaee1e772014-02-04 11:16:16 -0800152endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800153# Make sure that this IS_HOST/CLASS/MODULE combination is unique.
154module_id := MODULE.$(if \
Ying Wang6ef65192014-01-15 16:02:16 -0800155 $(LOCAL_IS_HOST_MODULE),HOST,TARGET).$(LOCAL_MODULE_CLASS).$(my_register_name)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800156ifdef $(module_id)
157$(error $(LOCAL_PATH): $(module_id) already defined by $($(module_id)))
158endif
159$(module_id) := $(LOCAL_PATH)
160
Ying Wang6ef65192014-01-15 16:02:16 -0800161intermediates := $(call local-intermediates-dir,,$(LOCAL_2ND_ARCH_VAR_PREFIX))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800162intermediates.COMMON := $(call local-intermediates-dir,COMMON)
Colin Crossd8262642014-01-24 23:17:21 -0800163generated_sources_dir := $(call local-generated-sources-dir)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800164
165###########################################################
166# Pick a name for the intermediate and final targets
167###########################################################
Colin Cross5a9db902014-03-21 12:27:37 -0700168include $(BUILD_SYSTEM)/configure_module_stem.mk
The Android Open Source Project88b60792009-03-03 19:28:42 -0800169
170# OVERRIDE_BUILT_MODULE_PATH is only allowed to be used by the
171# internal SHARED_LIBRARIES build files.
172OVERRIDE_BUILT_MODULE_PATH := $(strip $(OVERRIDE_BUILT_MODULE_PATH))
173ifdef OVERRIDE_BUILT_MODULE_PATH
174 ifneq ($(LOCAL_MODULE_CLASS),SHARED_LIBRARIES)
175 $(error $(LOCAL_PATH): Illegal use of OVERRIDE_BUILT_MODULE_PATH)
176 endif
177 built_module_path := $(OVERRIDE_BUILT_MODULE_PATH)
178else
179 built_module_path := $(intermediates)
180endif
Ying Wang966c1e02014-05-20 14:43:51 -0700181LOCAL_BUILT_MODULE := $(built_module_path)/$(my_built_module_stem)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800182
Ying Wang162991b2011-09-07 10:21:42 -0700183ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
Ying Wangaf9757e2014-07-17 21:24:42 -0700184 # Apk and its attachments reside in its own subdir.
185 ifeq ($(LOCAL_MODULE_CLASS),APPS)
186 # framework-res.apk doesn't like the additional layer.
187 ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
188 my_module_path := $(my_module_path)/$(LOCAL_MODULE)
189 endif
190 endif
Ying Wang966c1e02014-05-20 14:43:51 -0700191 LOCAL_INSTALLED_MODULE := $(my_module_path)/$(my_installed_module_stem)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800192endif
193
194# Assemble the list of targets to create PRIVATE_ variables for.
195LOCAL_INTERMEDIATE_TARGETS += $(LOCAL_BUILT_MODULE)
196
Yasuhiro Matsudaff82e822015-09-04 16:23:49 +0900197###########################################################
198## logtags: Add .logtags files to global list
199###########################################################
200
201logtags_sources := $(filter %.logtags,$(LOCAL_SRC_FILES))
202
203ifneq ($(strip $(logtags_sources)),)
204event_log_tags := $(addprefix $(LOCAL_PATH)/,$(logtags_sources))
205else
206event_log_tags :=
207endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800208
209###########################################################
The Android Open Source Project88b60792009-03-03 19:28:42 -0800210## make clean- targets
211###########################################################
Ying Wang6ef65192014-01-15 16:02:16 -0800212cleantarget := clean-$(my_register_name)
213$(cleantarget) : PRIVATE_MODULE := $(my_register_name)
Ying Wang4d063412013-03-22 18:52:57 -0700214$(cleantarget) : PRIVATE_CLEAN_FILES := \
Ying Wang95221ca2012-11-07 14:07:34 -0800215 $(LOCAL_BUILT_MODULE) \
216 $(LOCAL_INSTALLED_MODULE) \
217 $(intermediates)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800218$(cleantarget)::
219 @echo "Clean: $(PRIVATE_MODULE)"
220 $(hide) rm -rf $(PRIVATE_CLEAN_FILES)
221
222###########################################################
223## Common definitions for module.
224###########################################################
The Android Open Source Project88b60792009-03-03 19:28:42 -0800225$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_PATH:=$(LOCAL_PATH)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800226$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_IS_HOST_MODULE := $(LOCAL_IS_HOST_MODULE)
227$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_HOST:= $(my_host)
Dima Zavin46e9bec2009-05-27 19:41:07 -0700228$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_INTERMEDIATES_DIR:= $(intermediates)
Ying Wang6feb6d52014-04-17 10:03:35 -0700229$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_2ND_ARCH_VAR_PREFIX := $(LOCAL_2ND_ARCH_VAR_PREFIX)
230
The Android Open Source Project88b60792009-03-03 19:28:42 -0800231# Tell the module and all of its sub-modules who it is.
Ying Wang6ef65192014-01-15 16:02:16 -0800232$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_MODULE:= $(my_register_name)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800233
234# Provide a short-hand for building this module.
235# We name both BUILT and INSTALLED in case
236# LOCAL_UNINSTALLABLE_MODULE is set.
Ying Wang6ef65192014-01-15 16:02:16 -0800237.PHONY: $(my_register_name)
238$(my_register_name): $(LOCAL_BUILT_MODULE) $(LOCAL_INSTALLED_MODULE)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800239
240###########################################################
241## Module installation rule
242###########################################################
243
244# Some hosts do not have ACP; override the LOCAL version if that's the case.
245ifneq ($(strip $(HOST_ACP_UNAVAILABLE)),)
246 LOCAL_ACP_UNAVAILABLE := $(strip $(HOST_ACP_UNAVAILABLE))
247endif
248
249ifndef LOCAL_UNINSTALLABLE_MODULE
250 # Define a copy rule to install the module.
251 # acp and libraries that it uses can't use acp for
252 # installation; hence, LOCAL_ACP_UNAVAILABLE.
Ying Wange56605a2013-02-06 11:44:41 -0800253$(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := $(LOCAL_POST_INSTALL_CMD)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800254ifneq ($(LOCAL_ACP_UNAVAILABLE),true)
255$(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE) | $(ACP)
256 @echo "Install: $@"
Ying Wang84ed6fa2011-01-18 17:21:20 -0800257 $(copy-file-to-new-target)
Ying Wange56605a2013-02-06 11:44:41 -0800258 $(PRIVATE_POST_INSTALL_CMD)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800259else
260$(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE)
261 @echo "Install: $@"
262 $(copy-file-to-target-with-cp)
263endif
264
Ying Wang9fe15ac2015-08-20 12:02:10 -0700265# Rule to install the module's companion init.rc.
266my_init_rc := $(LOCAL_INIT_RC_$(my_32_64_bit_suffix))
267my_init_rc_src :=
268my_init_rc_installed :=
269ifndef my_init_rc
270my_init_rc := $(LOCAL_INIT_RC)
271# Make sure we don't define the rule twice in multilib module.
272LOCAL_INIT_RC :=
273endif
274ifdef my_init_rc
275my_init_rc_src := $(LOCAL_PATH)/$(my_init_rc)
276my_init_rc_installed := $(TARGET_OUT$(partition_tag)_ETC)/init/$(notdir $(my_init_rc_src))
277$(my_init_rc_installed) : $(my_init_rc_src) | $(ACP)
278 @echo "Install: $@"
279 $(copy-file-to-new-target)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800280
Ying Wang9fe15ac2015-08-20 12:02:10 -0700281$(my_register_name) : $(my_init_rc_installed)
282endif # my_init_rc
283endif # !LOCAL_UNINSTALLABLE_MODULE
Joe Onoratoe334d252009-07-17 15:33:40 -0400284
285###########################################################
286## CHECK_BUILD goals
287###########################################################
Ying Wang6c1d1cc2014-09-29 14:34:32 -0700288my_checked_module :=
Joe Onoratoe334d252009-07-17 15:33:40 -0400289# If nobody has defined a more specific module for the
Ying Wang5a8d3452013-01-30 14:43:05 -0800290# checked modules, use LOCAL_BUILT_MODULE.
Ying Wang6c1d1cc2014-09-29 14:34:32 -0700291ifdef LOCAL_CHECKED_MODULE
292 my_checked_module := $(LOCAL_CHECKED_MODULE)
293else
294 my_checked_module := $(LOCAL_BUILT_MODULE)
Joe Onoratoe334d252009-07-17 15:33:40 -0400295endif
296
297# If they request that this module not be checked, then don't.
298# PLEASE DON'T SET THIS. ANY PLACES THAT SET THIS WITHOUT
299# GOOD REASON WILL HAVE IT REMOVED.
300ifdef LOCAL_DONT_CHECK_MODULE
Ying Wang6c1d1cc2014-09-29 14:34:32 -0700301 my_checked_module :=
Joe Onoratoe334d252009-07-17 15:33:40 -0400302endif
Ying Wang966c1e02014-05-20 14:43:51 -0700303# Don't check build target module defined for the 2nd arch
304ifndef LOCAL_IS_HOST_MODULE
Ying Wang6ef65192014-01-15 16:02:16 -0800305ifdef LOCAL_2ND_ARCH_VAR_PREFIX
Ying Wang6c1d1cc2014-09-29 14:34:32 -0700306 my_checked_module :=
Ying Wang6ef65192014-01-15 16:02:16 -0800307endif
Ying Wang966c1e02014-05-20 14:43:51 -0700308endif
Joe Onoratoe334d252009-07-17 15:33:40 -0400309
The Android Open Source Project88b60792009-03-03 19:28:42 -0800310###########################################################
311## Register with ALL_MODULES
312###########################################################
313
Ying Wang6ef65192014-01-15 16:02:16 -0800314ALL_MODULES += $(my_register_name)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800315
316# Don't use += on subvars, or else they'll end up being
317# recursively expanded.
Ying Wang6ef65192014-01-15 16:02:16 -0800318ALL_MODULES.$(my_register_name).CLASS := \
319 $(ALL_MODULES.$(my_register_name).CLASS) $(LOCAL_MODULE_CLASS)
320ALL_MODULES.$(my_register_name).PATH := \
321 $(ALL_MODULES.$(my_register_name).PATH) $(LOCAL_PATH)
322ALL_MODULES.$(my_register_name).TAGS := \
Ying Wang37bd1f22014-01-27 15:19:09 -0800323 $(ALL_MODULES.$(my_register_name).TAGS) $(my_module_tags)
Ying Wang6ef65192014-01-15 16:02:16 -0800324ALL_MODULES.$(my_register_name).CHECKED := \
Ying Wang6c1d1cc2014-09-29 14:34:32 -0700325 $(ALL_MODULES.$(my_register_name).CHECKED) $(my_checked_module)
Ying Wang6ef65192014-01-15 16:02:16 -0800326ALL_MODULES.$(my_register_name).BUILT := \
327 $(ALL_MODULES.$(my_register_name).BUILT) $(LOCAL_BUILT_MODULE)
Ying Wang3380d3a2014-05-19 13:03:36 -0700328ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
Ying Wang6ef65192014-01-15 16:02:16 -0800329ALL_MODULES.$(my_register_name).INSTALLED := \
Ying Wang9fe15ac2015-08-20 12:02:10 -0700330 $(strip $(ALL_MODULES.$(my_register_name).INSTALLED) \
331 $(LOCAL_INSTALLED_MODULE) $(my_init_rc_installed))
Ying Wang3380d3a2014-05-19 13:03:36 -0700332ALL_MODULES.$(my_register_name).BUILT_INSTALLED := \
Ying Wang9fe15ac2015-08-20 12:02:10 -0700333 $(strip $(ALL_MODULES.$(my_register_name).BUILT_INSTALLED) \
334 $(LOCAL_BUILT_MODULE):$(LOCAL_INSTALLED_MODULE) \
335 $(addprefix $(my_init_rc_src):,$(my_init_rc_installed)))
Ying Wang3380d3a2014-05-19 13:03:36 -0700336endif
Ying Wang3b81aab2014-05-05 16:46:52 -0700337ifdef LOCAL_PICKUP_FILES
338# Files or directories ready to pick up by the build system
339# when $(LOCAL_BUILT_MODULE) is done.
340ALL_MODULES.$(my_register_name).PICKUP_FILES := \
341 $(ALL_MODULES.$(my_register_name).PICKUP_FILES) $(LOCAL_PICKUP_FILES)
342endif
Dan Willemsen7a549852015-08-13 17:51:40 -0700343my_required_modules := $(LOCAL_REQUIRED_MODULES) \
344 $(LOCAL_REQUIRED_MODULES_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
345ifdef LOCAL_IS_HOST_MODULE
346my_required_modules += $(LOCAL_REQUIRED_MODULES_$($(my_prefix)OS))
347endif
Ying Wang6ef65192014-01-15 16:02:16 -0800348ALL_MODULES.$(my_register_name).REQUIRED := \
Dan Willemsen7a549852015-08-13 17:51:40 -0700349 $(strip $(ALL_MODULES.$(my_register_name).REQUIRED) $(my_required_modules))
Yasuhiro Matsudaff82e822015-09-04 16:23:49 +0900350ALL_MODULES.$(my_register_name).EVENT_LOG_TAGS := \
351 $(ALL_MODULES.$(my_register_name).EVENT_LOG_TAGS) $(event_log_tags)
Ying Wang6ef65192014-01-15 16:02:16 -0800352ALL_MODULES.$(my_register_name).MAKEFILE := \
353 $(ALL_MODULES.$(my_register_name).MAKEFILE) $(LOCAL_MODULE_MAKEFILE)
Ying Wangdbb31be2011-12-09 15:11:57 -0800354ifdef LOCAL_MODULE_OWNER
Ying Wang6ef65192014-01-15 16:02:16 -0800355ALL_MODULES.$(my_register_name).OWNER := \
356 $(sort $(ALL_MODULES.$(my_register_name).OWNER) $(LOCAL_MODULE_OWNER))
Ying Wangdbb31be2011-12-09 15:11:57 -0800357endif
Ying Wang14a6cbd2014-02-10 22:26:23 -0800358ifdef LOCAL_2ND_ARCH_VAR_PREFIX
359ALL_MODULES.$(my_register_name).FOR_2ND_ARCH := true
360endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800361
Ying Wang6ef65192014-01-15 16:02:16 -0800362INSTALLABLE_FILES.$(LOCAL_INSTALLED_MODULE).MODULE := $(my_register_name)
Joe Onorato8a06bac2010-05-21 14:29:29 -0700363
Ying Wang39b9b692015-05-07 12:08:53 -0700364##########################################################
365# Track module-level dependencies.
366# Use $(LOCAL_MODULE) instead of $(my_register_name) to ignore module's bitness.
367ALL_DEPS.MODULES := $(sort $(ALL_DEPS.MODULES) $(LOCAL_MODULE))
368ALL_DEPS.$(LOCAL_MODULE).ALL_DEPS := $(sort \
369 $(ALL_MODULES.$(LOCAL_MODULE).ALL_DEPS) \
370 $(LOCAL_STATIC_LIBRARIES) \
371 $(LOCAL_WHOLE_STATIC_LIBRARIES) \
372 $(LOCAL_SHARED_LIBRARIES) \
373 $(LOCAL_STATIC_JAVA_LIBRARIES) \
374 $(LOCAL_JAVA_LIBRARIES)\
375 $(LOCAL_JNI_SHARED_LIBRARIES))
376
377ALL_DEPS.$(LOCAL_MODULE).LICENSE := $(sort $(ALL_DEPS.$(LOCAL_MODULE).LICENSE) $(license_files))
378
The Android Open Source Project88b60792009-03-03 19:28:42 -0800379###########################################################
Ying Wang37bd1f22014-01-27 15:19:09 -0800380## Take care of my_module_tags
The Android Open Source Project88b60792009-03-03 19:28:42 -0800381###########################################################
382
383# Keep track of all the tags we've seen.
Ying Wang37bd1f22014-01-27 15:19:09 -0800384ALL_MODULE_TAGS := $(sort $(ALL_MODULE_TAGS) $(my_module_tags))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800385
The Android Open Source Project88b60792009-03-03 19:28:42 -0800386# Add this module name to the tag list of each specified tag.
Ying Wang37bd1f22014-01-27 15:19:09 -0800387$(foreach tag,$(my_module_tags),\
Ying Wang6ef65192014-01-15 16:02:16 -0800388 $(eval ALL_MODULE_NAME_TAGS.$(tag) += $(my_register_name)))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800389
The Android Open Source Project88b60792009-03-03 19:28:42 -0800390###########################################################
Ying Wangef4d82f2013-01-29 16:59:18 -0800391## umbrella targets used to verify builds
392###########################################################
Ying Wangef4d82f2013-01-29 16:59:18 -0800393j_or_n :=
394ifneq (,$(filter EXECUTABLES SHARED_LIBRARIES STATIC_LIBRARIES,$(LOCAL_MODULE_CLASS)))
395j_or_n := native
396else
397ifneq (,$(filter JAVA_LIBRARIES APPS,$(LOCAL_MODULE_CLASS)))
398j_or_n := java
Ying Wangef4d82f2013-01-29 16:59:18 -0800399endif
400endif
401ifdef LOCAL_IS_HOST_MODULE
402h_or_t := host
403else
404h_or_t := target
405endif
406
407ifdef j_or_n
Ying Wang6c1d1cc2014-09-29 14:34:32 -0700408$(j_or_n) $(h_or_t) $(j_or_n)-$(h_or_t) : $(my_checked_module)
Ying Wang37bd1f22014-01-27 15:19:09 -0800409ifneq (,$(filter $(my_module_tags),tests))
Ying Wang6c1d1cc2014-09-29 14:34:32 -0700410$(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 -0800411endif
412endif
413
414###########################################################
The Android Open Source Project88b60792009-03-03 19:28:42 -0800415## NOTICE files
416###########################################################
417
Ying Wang13d69502012-11-01 17:22:33 -0700418include $(BUILD_NOTICE_FILE)