blob: 4126547bd874ccb574e7b39e03c85fd2ea05efd5 [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
37 my_prefix:=HOST_
38 my_host:=host-
39else
40 my_prefix:=TARGET_
41 my_host:=
42endif
43
44###########################################################
45## Validate and define fallbacks for input LOCAL_* variables.
46###########################################################
47
48## Dump a .csv file of all modules and their tags
49#ifneq ($(tag-list-first-time),false)
50#$(shell rm -f tag-list.csv)
51#tag-list-first-time := false
52#endif
53#comma := ,
54#empty :=
55#space := $(empty) $(empty)
56#$(shell echo $(lastword $(filter-out config/% out/%,$(MAKEFILE_LIST))),$(LOCAL_MODULE),$(strip $(LOCAL_MODULE_CLASS)),$(subst $(space),$(comma),$(sort $(LOCAL_MODULE_TAGS))) >> tag-list.csv)
57
58LOCAL_MODULE_TAGS := $(sort $(LOCAL_MODULE_TAGS))
59ifeq (,$(LOCAL_MODULE_TAGS))
60# Modules without tags fall back to user (which is changed to user eng below)
61LOCAL_MODULE_TAGS := user
62#$(warning default tags: $(lastword $(filter-out config/% out/%,$(MAKEFILE_LIST))))
63endif
64
Jean-Baptiste Querua831cbd2010-01-07 11:06:50 -080065# Only the tags mentioned in this test are expected to be set by module
66# makefiles. Anything else is either a typo or a source of unexpected
67# behaviors.
Thorsten Glaser2213aab2010-06-03 19:57:02 +020068ifneq ($(filter-out user debug eng tests optional samples shell_ash shell_mksh,$(LOCAL_MODULE_TAGS)),)
Jean-Baptiste Querua831cbd2010-01-07 11:06:50 -080069$(warning unusual tags $(LOCAL_MODULE_TAGS) on $(LOCAL_MODULE) at $(LOCAL_PATH))
70endif
71
The Android Open Source Project88b60792009-03-03 19:28:42 -080072# Add implicit tags.
73#
74# If the local directory or one of its parents contains a MODULE_LICENSE_GPL
75# file, tag the module as "gnu". Search for "*_GNU*" so that we can also
76# find files like MODULE_LICENSE_GPL_AND_AFL but exclude files like
77# MODULE_LICENSE_LGPL.
78#
79ifneq ($(call find-parent-file,$(LOCAL_PATH),MODULE_LICENSE*_GPL*),)
80 LOCAL_MODULE_TAGS += gnu
81endif
82
83#
84# If this module is listed on CUSTOM_MODULES, promote it to "user"
85# so that it will be installed in $(TARGET_OUT).
86#
87ifneq (,$(filter $(LOCAL_MODULE),$(CUSTOM_MODULES)))
88 LOCAL_MODULE_TAGS := $(sort $(LOCAL_MODULE_TAGS) user)
89endif
90
91# The definition of should-install-to-system will be different depending
The Android Open Source Project2f312932009-03-09 11:52:11 -070092# on which goal (e.g., sdk or just droid) is being built.
The Android Open Source Project88b60792009-03-03 19:28:42 -080093ifdef LOCAL_IS_HOST_MODULE
94 use_data :=
95else
96 use_data := $(if $(call should-install-to-system,$(LOCAL_MODULE_TAGS)),,_DATA)
97endif
98
99LOCAL_MODULE_CLASS := $(strip $(LOCAL_MODULE_CLASS))
100ifneq ($(words $(LOCAL_MODULE_CLASS)),1)
101 $(error $(LOCAL_PATH): LOCAL_MODULE_CLASS must contain exactly one word, not "$(LOCAL_MODULE_CLASS)")
102endif
103
Jean-Baptiste Queru6907cfe2010-01-07 11:19:39 -0800104# Those used to be implicitly ignored, but aren't any more.
105# As of 20100110 there are no apps with the user tag.
106ifeq ($(LOCAL_MODULE_CLASS),APPS)
107 ifneq ($(filter $(LOCAL_MODULE_TAGS),user),)
108 $(warning user tag on app $(LOCAL_MODULE) at $(LOCAL_PATH) - add your app to core.mk instead)
109 endif
110endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800111
112LOCAL_MODULE_PATH := $(strip $(LOCAL_MODULE_PATH))
113ifeq ($(LOCAL_MODULE_PATH),)
114 LOCAL_MODULE_PATH := $($(my_prefix)OUT$(use_data)_$(LOCAL_MODULE_CLASS))
115 ifeq ($(strip $(LOCAL_MODULE_PATH)),)
116 $(error $(LOCAL_PATH): unhandled LOCAL_MODULE_CLASS "$(LOCAL_MODULE_CLASS)")
117 endif
118endif
119
120ifneq ($(strip $(LOCAL_BUILT_MODULE)$(LOCAL_INSTALLED_MODULE)),)
121 $(error $(LOCAL_PATH): LOCAL_BUILT_MODULE and LOCAL_INSTALLED_MODULE must not be defined by component makefiles)
122endif
123
124# Make sure that this IS_HOST/CLASS/MODULE combination is unique.
125module_id := MODULE.$(if \
126 $(LOCAL_IS_HOST_MODULE),HOST,TARGET).$(LOCAL_MODULE_CLASS).$(LOCAL_MODULE)
127ifdef $(module_id)
128$(error $(LOCAL_PATH): $(module_id) already defined by $($(module_id)))
129endif
130$(module_id) := $(LOCAL_PATH)
131
132intermediates := $(call local-intermediates-dir)
133intermediates.COMMON := $(call local-intermediates-dir,COMMON)
134
135###########################################################
136# Pick a name for the intermediate and final targets
137###########################################################
138LOCAL_MODULE_STEM := $(strip $(LOCAL_MODULE_STEM))
139ifeq ($(LOCAL_MODULE_STEM),)
140 LOCAL_MODULE_STEM := $(LOCAL_MODULE)
141endif
142LOCAL_INSTALLED_MODULE_STEM := $(LOCAL_MODULE_STEM)$(LOCAL_MODULE_SUFFIX)
143
144LOCAL_BUILT_MODULE_STEM := $(strip $(LOCAL_BUILT_MODULE_STEM))
145ifeq ($(LOCAL_BUILT_MODULE_STEM),)
146 LOCAL_BUILT_MODULE_STEM := $(LOCAL_INSTALLED_MODULE_STEM)
147endif
148
149# OVERRIDE_BUILT_MODULE_PATH is only allowed to be used by the
150# internal SHARED_LIBRARIES build files.
151OVERRIDE_BUILT_MODULE_PATH := $(strip $(OVERRIDE_BUILT_MODULE_PATH))
152ifdef OVERRIDE_BUILT_MODULE_PATH
153 ifneq ($(LOCAL_MODULE_CLASS),SHARED_LIBRARIES)
154 $(error $(LOCAL_PATH): Illegal use of OVERRIDE_BUILT_MODULE_PATH)
155 endif
156 built_module_path := $(OVERRIDE_BUILT_MODULE_PATH)
157else
158 built_module_path := $(intermediates)
159endif
160LOCAL_BUILT_MODULE := $(built_module_path)/$(LOCAL_BUILT_MODULE_STEM)
161built_module_path :=
162
163# LOCAL_UNINSTALLABLE_MODULE is only allowed to be used by the
164# internal STATIC_LIBRARIES build files.
165LOCAL_UNINSTALLABLE_MODULE := $(strip $(LOCAL_UNINSTALLABLE_MODULE))
166ifdef LOCAL_UNINSTALLABLE_MODULE
167 ifeq (,$(filter $(LOCAL_MODULE_CLASS),JAVA_LIBRARIES STATIC_LIBRARIES))
168 $(error $(LOCAL_PATH): Illegal use of LOCAL_UNINSTALLABLE_MODULE)
169 endif
170else
171 LOCAL_INSTALLED_MODULE := $(LOCAL_MODULE_PATH)/$(LOCAL_MODULE_SUBDIR)$(LOCAL_INSTALLED_MODULE_STEM)
172endif
173
174# Assemble the list of targets to create PRIVATE_ variables for.
175LOCAL_INTERMEDIATE_TARGETS += $(LOCAL_BUILT_MODULE)
176
177
178###########################################################
179## AIDL: Compile .aidl files to .java
180###########################################################
181
182aidl_sources := $(filter %.aidl,$(LOCAL_SRC_FILES))
183
184ifneq ($(strip $(aidl_sources)),)
185
186aidl_java_sources := $(patsubst %.aidl,%.java,$(addprefix $(intermediates.COMMON)/src/, $(aidl_sources)))
187aidl_sources := $(addprefix $(TOP_DIR)$(LOCAL_PATH)/, $(aidl_sources))
188
Ying Wange3265fb2010-01-25 09:56:41 -0800189aidl_preprocess_import :=
190LOCAL_SDK_VERSION:=$(strip $(LOCAL_SDK_VERSION))
191ifdef LOCAL_SDK_VERSION
Ying Wanga07d37b2010-06-09 11:43:33 -0700192ifeq ($(LOCAL_SDK_VERSION),current)
193 aidl_preprocess_import := $(TARGET_OUT_COMMON_INTERMEDIATES)/framework.aidl
194else
195 aidl_preprocess_import := $(HISTORICAL_SDK_VERSIONS_ROOT)/$(LOCAL_SDK_VERSION)/framework.aidl
Ying Wange3265fb2010-01-25 09:56:41 -0800196endif # !current
197endif # LOCAL_SDK_VERSION
Ying Wanga07d37b2010-06-09 11:43:33 -0700198$(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 -0800199
Ying Wanga07d37b2010-06-09 11:43:33 -0700200$(aidl_java_sources): $(intermediates.COMMON)/src/%.java: $(TOPDIR)$(LOCAL_PATH)/%.aidl $(PRIVATE_ADDITIONAL_DEPENDENCIES) $(AIDL) $(aidl_preprocess_import)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800201 $(transform-aidl-to-java)
202-include $(aidl_java_sources:%.java=%.P)
203
204else
205aidl_java_sources :=
206endif
207
208###########################################################
Doug Zongker9bd49622009-11-30 14:28:59 -0800209## logtags: Add .logtags files to global list, emit java source
210###########################################################
211
212logtags_sources := $(filter %.logtags,$(LOCAL_SRC_FILES))
213
214ifneq ($(strip $(logtags_sources)),)
215
216event_log_tags := $(addprefix $(LOCAL_PATH)/,$(logtags_sources))
217
218# Emit a java source file with constants for the tags, if
219# LOCAL_MODULE_CLASS is "APPS" or "JAVA_LIBRARIES".
220ifneq ($(strip $(filter $(LOCAL_MODULE_CLASS),APPS JAVA_LIBRARIES)),)
221
222logtags_java_sources := $(patsubst %.logtags,%.java,$(addprefix $(intermediates.COMMON)/src/, $(logtags_sources)))
223logtags_sources := $(addprefix $(TOP_DIR)$(LOCAL_PATH)/, $(logtags_sources))
224
Joe Onoratob7510532010-07-14 10:22:54 -0700225$(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 -0800226 $(transform-logtags-to-java)
227
228endif
229
230else
231logtags_java_sources :=
232event_log_tags :=
233endif
234
235###########################################################
The Android Open Source Project88b60792009-03-03 19:28:42 -0800236## Java: Compile .java files to .class
237###########################################################
238#TODO: pull this into java.make once host and target are combined
239
Ying Wang52911302010-05-26 13:13:56 -0700240java_sources := $(addprefix $(TOP_DIR)$(LOCAL_PATH)/, $(filter %.java,$(LOCAL_SRC_FILES))) $(aidl_java_sources) $(logtags_java_sources) \
241 $(filter %.java,$(LOCAL_GENERATED_SOURCES))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800242all_java_sources := $(java_sources) $(addprefix $($(my_prefix)OUT_COMMON_INTERMEDIATES)/, $(filter %.java,$(LOCAL_INTERMEDIATE_SOURCES)))
243
244## Java resources #########################################
245
246# Look for resource files in any specified directories.
247# Non-java and non-doc files will be picked up as resources
248# and included in the output jar file.
249java_resource_file_groups :=
250
251LOCAL_JAVA_RESOURCE_DIRS := $(strip $(LOCAL_JAVA_RESOURCE_DIRS))
252ifneq ($(LOCAL_JAVA_RESOURCE_DIRS),)
253 # This makes a list of words like
254 # <dir1>::<file1>:<file2> <dir2>::<file1> <dir3>:
255 # where each of the files is relative to the directory it's grouped with.
256 # Directories that don't contain any resource files will result in groups
257 # that end with a colon, and they are stripped out in the next step.
258 java_resource_file_groups += \
259 $(foreach dir,$(LOCAL_JAVA_RESOURCE_DIRS), \
260 $(subst $(space),:,$(strip \
261 $(TOP_DIR)$(LOCAL_PATH)/$(dir): \
262 $(patsubst ./%,%,$(shell cd $(TOP_DIR)$(LOCAL_PATH)/$(dir) && \
263 find . \
264 -type d -a -name ".svn" -prune -o \
265 -type f \
266 -a \! -name "*.java" \
267 -a \! -name "package.html" \
268 -a \! -name "overview.html" \
269 -a \! -name ".*.swp" \
270 -a \! -name ".DS_Store" \
271 -a \! -name "*~" \
272 -print \
273 )) \
274 )) \
275 )
276 java_resource_file_groups := $(filter-out %:,$(java_resource_file_groups))
277endif # LOCAL_JAVA_RESOURCE_DIRS
278
279LOCAL_JAVA_RESOURCE_FILES := $(strip $(LOCAL_JAVA_RESOURCE_FILES))
280ifneq ($(LOCAL_JAVA_RESOURCE_FILES),)
281 java_resource_file_groups += \
282 $(foreach f,$(LOCAL_JAVA_RESOURCE_FILES), \
283 $(patsubst %/,%,$(dir $(f)))::$(notdir $(f)) \
284 )
285endif # LOCAL_JAVA_RESOURCE_FILES
286
287ifdef java_resource_file_groups
288 # The full paths to all resources, used for dependencies.
289 java_resource_sources := \
290 $(foreach group,$(java_resource_file_groups), \
291 $(addprefix $(word 1,$(subst :,$(space),$(group)))/, \
292 $(wordlist 2,9999,$(subst :,$(space),$(group))) \
293 ) \
294 )
295 # The arguments to jar that will include these files in a jar file.
296 extra_jar_args := \
297 $(foreach group,$(java_resource_file_groups), \
298 $(addprefix -C $(word 1,$(subst :,$(space),$(group))) , \
299 $(wordlist 2,9999,$(subst :,$(space),$(group))) \
300 ) \
301 )
302 java_resource_file_groups :=
303else
304 java_resource_sources :=
305 extra_jar_args :=
306endif # java_resource_file_groups
307
308## PRIVATE java vars ######################################
309
310ifneq ($(strip $(all_java_sources)$(all_res_assets)),)
311
312full_static_java_libs := \
313 $(foreach lib,$(LOCAL_STATIC_JAVA_LIBRARIES), \
314 $(call intermediates-dir-for, \
315 JAVA_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE))/javalib.jar)
316
317$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_INSTALL_DIR := $(dir $(LOCAL_INSTALLED_MODULE))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800318$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CLASS_INTERMEDIATES_DIR := $(intermediates)/classes
319$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SOURCE_INTERMEDIATES_DIR := $(intermediates)/src
320$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAVA_SOURCES := $(all_java_sources)
321$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAVA_OBJECTS := $(patsubst %.java,%.class,$(LOCAL_SRC_FILES))
322ifeq ($(my_prefix),TARGET_)
Joe Onoratoe62902c2009-09-23 15:28:12 -0700323ifeq ($(LOCAL_SDK_VERSION),)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800324$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,core)
Ying Wanga07d37b2010-06-09 11:43:33 -0700325else
326ifeq ($(LOCAL_SDK_VERSION),current)
327$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,android_stubs_current)
328else
329$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,sdk_v$(LOCAL_SDK_VERSION))
330endif # current
331endif # LOCAL_SDK_VERSION
332endif # TARGET_
The Android Open Source Project88b60792009-03-03 19:28:42 -0800333$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RESOURCE_DIR := $(LOCAL_RESOURCE_DIR)
334$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_EXTRA_JAR_ARGS := $(extra_jar_args)
335$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASSET_DIR := $(LOCAL_ASSET_DIR)
336$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_STATIC_JAVA_LIBRARIES := $(full_static_java_libs)
337
338# full_java_libs: The list of files that should be used as the classpath.
339# Using this list as a dependency list WILL NOT WORK.
340# full_java_lib_deps: Should be specified as a prerequisite of this module
341# to guarantee that the files in full_java_libs will
342# be up-to-date.
343ifdef LOCAL_IS_HOST_MODULE
344# TODO: make prebuilt java libraries use the same
345# intermediates path pattern as target java libraries.
346full_java_libs := $(addprefix $(HOST_OUT_JAVA_LIBRARIES)/,$(addsuffix $(COMMON_JAVA_PACKAGE_SUFFIX),$(LOCAL_JAVA_LIBRARIES)))
347full_java_lib_deps := $(full_java_libs)
348else
Ying Wange3265fb2010-01-25 09:56:41 -0800349ifdef LOCAL_SDK_VERSION
350ifneq ($(LOCAL_SDK_VERSION),current)
351full_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
352# For prebuilt sdk versions, we can't depend on the javalib.jar but classes.jar.
353full_java_lib_deps := $(call java-lib-deps,$(filter-out sdk_v$(LOCAL_SDK_VERSION),$(LOCAL_JAVA_LIBRARIES)),$(LOCAL_IS_HOST_MODULE))
354full_java_lib_deps += $(call java-lib-files,sdk_v$(LOCAL_SDK_VERSION),$(LOCAL_IS_HOST_MODULE))
355else
The Android Open Source Project88b60792009-03-03 19:28:42 -0800356full_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
357full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
Ying Wange3265fb2010-01-25 09:56:41 -0800358endif # !current
359else
360full_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
361full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
362endif # LOCAL_SDK_VERSION
363endif # !LOCAL_IS_HOST_MODULE
The Android Open Source Project88b60792009-03-03 19:28:42 -0800364full_java_libs += $(full_static_java_libs) $(LOCAL_CLASSPATH)
365full_java_lib_deps += $(full_static_java_libs) $(LOCAL_CLASSPATH)
366
367# This is set by packages that contain instrumentation, allowing them to
368# link against the package they are instrumenting. Currently only one such
369# package is allowed.
370LOCAL_INSTRUMENTATION_FOR := $(strip $(LOCAL_INSTRUMENTATION_FOR))
371ifdef LOCAL_INSTRUMENTATION_FOR
372 ifneq ($(words $(LOCAL_INSTRUMENTATION_FOR)),1)
373 $(error \
374 $(LOCAL_PATH): Multiple LOCAL_INSTRUMENTATION_FOR members defined)
375 endif
376
377 link_instr_intermediates_dir := $(call intermediates-dir-for, \
378 APPS,$(LOCAL_INSTRUMENTATION_FOR))
379 link_instr_intermediates_dir.COMMON := $(call intermediates-dir-for, \
380 APPS,$(LOCAL_INSTRUMENTATION_FOR),,COMMON)
381
Ying Wang3b2bdf12010-02-01 09:51:23 -0800382 # link against the jar with full original names (before proguard processing).
383 full_java_libs += $(link_instr_intermediates_dir.COMMON)/classes-full-names.jar
Joe Onorato14d95152010-07-14 19:49:05 -0700384 full_java_lib_deps += $(link_instr_intermediates_dir.COMMON)/classes-full-names.jar
The Android Open Source Project88b60792009-03-03 19:28:42 -0800385endif
386
387ifneq ($(strip $(LOCAL_JAR_MANIFEST)),)
388$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAR_MANIFEST := $(LOCAL_PATH)/$(LOCAL_JAR_MANIFEST)
389else
390$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAR_MANIFEST :=
391endif
392
393endif
394
395
396###########################################################
397## make clean- targets
398###########################################################
399cleantarget := clean-$(LOCAL_MODULE)
400$(cleantarget) : PRIVATE_MODULE := $(LOCAL_MODULE)
401$(cleantarget) : PRIVATE_CLEAN_FILES := \
402 $(PRIVATE_CLEAN_FILES) \
403 $(LOCAL_BUILT_MODULE) \
404 $(LOCAL_INSTALLED_MODULE) \
405 $(intermediates)
406$(cleantarget)::
407 @echo "Clean: $(PRIVATE_MODULE)"
408 $(hide) rm -rf $(PRIVATE_CLEAN_FILES)
409
410###########################################################
411## Common definitions for module.
412###########################################################
413
414# Propagate local configuration options to this target.
415$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_PATH:=$(LOCAL_PATH)
416$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_POST_PROCESS_COMMAND:= $(LOCAL_POST_PROCESS_COMMAND)
417$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_AAPT_FLAGS:= $(LOCAL_AAPT_FLAGS)
418$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_JAVA_LIBRARIES:= $(LOCAL_JAVA_LIBRARIES)
Jeff Hamiltonbb67d212010-02-05 22:36:42 -0600419$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_MANIFEST_PACKAGE_NAME:= $(LOCAL_MANIFEST_PACKAGE_NAME)
Ying Wang8c254822010-03-16 16:13:56 -0700420$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_INSTRUMENTATION_FOR_PACKAGE_NAME:= $(LOCAL_INSTRUMENTATION_FOR_PACKAGE_NAME)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800421
422$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_ALL_JAVA_LIBRARIES:= $(full_java_libs)
423$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_IS_HOST_MODULE := $(LOCAL_IS_HOST_MODULE)
424$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_HOST:= $(my_host)
425
Dima Zavin46e9bec2009-05-27 19:41:07 -0700426$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_INTERMEDIATES_DIR:= $(intermediates)
427
The Android Open Source Project88b60792009-03-03 19:28:42 -0800428# Tell the module and all of its sub-modules who it is.
429$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_MODULE:= $(LOCAL_MODULE)
430
431# Provide a short-hand for building this module.
432# We name both BUILT and INSTALLED in case
433# LOCAL_UNINSTALLABLE_MODULE is set.
434.PHONY: $(LOCAL_MODULE)
435$(LOCAL_MODULE): $(LOCAL_BUILT_MODULE) $(LOCAL_INSTALLED_MODULE)
436
437###########################################################
438## Module installation rule
439###########################################################
440
441# Some hosts do not have ACP; override the LOCAL version if that's the case.
442ifneq ($(strip $(HOST_ACP_UNAVAILABLE)),)
443 LOCAL_ACP_UNAVAILABLE := $(strip $(HOST_ACP_UNAVAILABLE))
444endif
445
446ifndef LOCAL_UNINSTALLABLE_MODULE
447 # Define a copy rule to install the module.
448 # acp and libraries that it uses can't use acp for
449 # installation; hence, LOCAL_ACP_UNAVAILABLE.
450ifneq ($(LOCAL_ACP_UNAVAILABLE),true)
451$(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE) | $(ACP)
452 @echo "Install: $@"
453 $(copy-file-to-target)
454else
455$(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE)
456 @echo "Install: $@"
457 $(copy-file-to-target-with-cp)
458endif
459
460endif # !LOCAL_UNINSTALLABLE_MODULE
461
Joe Onoratoe334d252009-07-17 15:33:40 -0400462
463###########################################################
464## CHECK_BUILD goals
465###########################################################
466
467# If nobody has defined a more specific module for the
468# checked modules, use LOCAL_BUILT_MODULE. This was old
469# behavior, so it should be a safe default.
470ifndef LOCAL_CHECKED_MODULE
Joe Onorato05c7f612010-01-05 12:47:14 -0800471 ifndef LOCAL_SDK_VERSION
472 LOCAL_CHECKED_MODULE := $(LOCAL_BUILT_MODULE)
473 endif
Joe Onoratoe334d252009-07-17 15:33:40 -0400474endif
475
476# If they request that this module not be checked, then don't.
477# PLEASE DON'T SET THIS. ANY PLACES THAT SET THIS WITHOUT
478# GOOD REASON WILL HAVE IT REMOVED.
479ifdef LOCAL_DONT_CHECK_MODULE
480 LOCAL_CHECKED_MODULE :=
481endif
482
The Android Open Source Project88b60792009-03-03 19:28:42 -0800483###########################################################
484## Register with ALL_MODULES
485###########################################################
486
487ALL_MODULES += $(LOCAL_MODULE)
488
489# Don't use += on subvars, or else they'll end up being
490# recursively expanded.
Joe Onorato8a06bac2010-05-21 14:29:29 -0700491ALL_MODULES.$(LOCAL_MODULE).CLASS := \
492 $(ALL_MODULES.$(LOCAL_MODULE).CLASS) $(LOCAL_MODULE_CLASS)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800493ALL_MODULES.$(LOCAL_MODULE).PATH := \
494 $(ALL_MODULES.$(LOCAL_MODULE).PATH) $(LOCAL_PATH)
495ALL_MODULES.$(LOCAL_MODULE).TAGS := \
496 $(ALL_MODULES.$(LOCAL_MODULE).TAGS) $(LOCAL_MODULE_TAGS)
Joe Onoratoe334d252009-07-17 15:33:40 -0400497ALL_MODULES.$(LOCAL_MODULE).CHECKED := \
498 $(ALL_MODULES.$(LOCAL_MODULE).CHECKED) $(LOCAL_CHECKED_MODULE)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800499ALL_MODULES.$(LOCAL_MODULE).BUILT := \
500 $(ALL_MODULES.$(LOCAL_MODULE).BUILT) $(LOCAL_BUILT_MODULE)
501ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \
502 $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(LOCAL_INSTALLED_MODULE)
503ALL_MODULES.$(LOCAL_MODULE).REQUIRED := \
504 $(ALL_MODULES.$(LOCAL_MODULE).REQUIRED) $(LOCAL_REQUIRED_MODULES)
Doug Zongker9bd49622009-11-30 14:28:59 -0800505ALL_MODULES.$(LOCAL_MODULE).EVENT_LOG_TAGS := \
506 $(ALL_MODULES.$(LOCAL_MODULE).EVENT_LOG_TAGS) $(event_log_tags)
Joe Onorato77dc0a52010-05-17 18:16:11 -0700507ALL_MODULES.$(LOCAL_MODULE).INTERMEDIATE_SOURCE_DIR := \
Ying Wang01c35172010-05-17 19:07:21 -0700508 $(ALL_MODULES.$(LOCAL_MODULE).INTERMEDIATE_SOURCE_DIR) $(LOCAL_INTERMEDIATE_SOURCE_DIR)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800509
Joe Onorato8a06bac2010-05-21 14:29:29 -0700510INSTALLABLE_FILES.$(LOCAL_INSTALLED_MODULE).MODULE := $(LOCAL_MODULE)
511
The Android Open Source Project88b60792009-03-03 19:28:42 -0800512###########################################################
513## Take care of LOCAL_MODULE_TAGS
514###########################################################
515
516# Keep track of all the tags we've seen.
517ALL_MODULE_TAGS := $(sort $(ALL_MODULE_TAGS) $(LOCAL_MODULE_TAGS))
518
519# Add this module to the tag list of each specified tag.
520# Don't use "+=". If the variable hasn't been set with ":=",
521# it will default to recursive expansion.
522$(foreach tag,$(LOCAL_MODULE_TAGS),\
523 $(eval ALL_MODULE_TAGS.$(tag) := \
524 $(ALL_MODULE_TAGS.$(tag)) \
525 $(LOCAL_INSTALLED_MODULE)))
526
527# Add this module name to the tag list of each specified tag.
528$(foreach tag,$(LOCAL_MODULE_TAGS),\
529 $(eval ALL_MODULE_NAME_TAGS.$(tag) += $(LOCAL_MODULE)))
530
The Android Open Source Project88b60792009-03-03 19:28:42 -0800531###########################################################
532## NOTICE files
533###########################################################
534
535include $(BUILD_SYSTEM)/notice_files.mk
536
537#:vi noexpandtab