blob: 5bb6b77bb381d6d59b3e1cd5b607f4f35afe98ae [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
Jean-Baptiste Queru32afccc2010-09-14 13:25:42 -070062#$(warning default tags: $(lastword $(filter-out config/% out/%,$(MAKEFILE_LIST))))
The Android Open Source Project88b60792009-03-03 19:28:42 -080063endif
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.
68ifneq ($(filter-out user debug eng tests optional samples,$(LOCAL_MODULE_TAGS)),)
69$(warning unusual tags $(LOCAL_MODULE_TAGS) on $(LOCAL_MODULE) at $(LOCAL_PATH))
70endif
71
Jean-Baptiste Queru39de4322010-09-03 16:32:58 -070072ifneq ($(filter $(LOCAL_MODULE_TAGS),user),)
73 ifeq ($(filter $(GRANDFATHERED_USER_MODULES),$(LOCAL_MODULE)),)
Jean-Baptiste Queru6e8b2682010-09-14 08:59:21 -070074 $(warning *** Module name: $(LOCAL_MODULE))
75 $(warning *** Makefile location: $(LOCAL_PATH))
Jean-Baptiste Queru58906002010-09-15 13:59:29 -070076 $(warning * )
77 $(warning * Each module must use a LOCAL_MODULE_TAGS in its)
78 $(warning * Android.mk. Possible tags declared by a module:)
79 $(warning * )
80 $(warning * optional, debug, eng, tests, samples)
81 $(warning * )
82 $(warning * If the module is expected to be in all builds)
83 $(warning * of a product, then it should use the)
84 $(warning * "optional" tag: )
85 $(warning * )
86 $(warning * Add "LOCAL_MODULE_TAGS := optional" in the)
87 $(warning * Android.mk for the affected module, and add)
88 $(warning * the LOCAL_MODULE value for that component)
89 $(warning * into the PRODUCT_PACKAGES section of product)
90 $(warning * makefile(s) where it's necessary, if)
91 $(warning * appropriate.)
92 $(warning * )
93 $(warning * If the component should be in EVERY build of ALL)
94 $(warning * products, then add its LOCAL_MODULE value to the)
95 $(warning * PRODUCT_PACKAGES section of)
96 $(warning * build/target/product/core.mk)
97 $(warning * )
Jean-Baptiste Queru6e8b2682010-09-14 08:59:21 -070098 $(error user tag detected on new module - user tags are only supported on legacy modules)
Jean-Baptiste Queru39de4322010-09-03 16:32:58 -070099 endif
100endif
101
The Android Open Source Project88b60792009-03-03 19:28:42 -0800102# Add implicit tags.
103#
104# If the local directory or one of its parents contains a MODULE_LICENSE_GPL
105# file, tag the module as "gnu". Search for "*_GNU*" so that we can also
106# find files like MODULE_LICENSE_GPL_AND_AFL but exclude files like
107# MODULE_LICENSE_LGPL.
108#
109ifneq ($(call find-parent-file,$(LOCAL_PATH),MODULE_LICENSE*_GPL*),)
110 LOCAL_MODULE_TAGS += gnu
111endif
112
113#
114# If this module is listed on CUSTOM_MODULES, promote it to "user"
115# so that it will be installed in $(TARGET_OUT).
116#
117ifneq (,$(filter $(LOCAL_MODULE),$(CUSTOM_MODULES)))
118 LOCAL_MODULE_TAGS := $(sort $(LOCAL_MODULE_TAGS) user)
119endif
120
121# The definition of should-install-to-system will be different depending
The Android Open Source Project2f312932009-03-09 11:52:11 -0700122# on which goal (e.g., sdk or just droid) is being built.
The Android Open Source Project88b60792009-03-03 19:28:42 -0800123ifdef LOCAL_IS_HOST_MODULE
124 use_data :=
125else
126 use_data := $(if $(call should-install-to-system,$(LOCAL_MODULE_TAGS)),,_DATA)
127endif
128
129LOCAL_MODULE_CLASS := $(strip $(LOCAL_MODULE_CLASS))
130ifneq ($(words $(LOCAL_MODULE_CLASS)),1)
131 $(error $(LOCAL_PATH): LOCAL_MODULE_CLASS must contain exactly one word, not "$(LOCAL_MODULE_CLASS)")
132endif
133
Jean-Baptiste Queru6907cfe2010-01-07 11:19:39 -0800134# Those used to be implicitly ignored, but aren't any more.
135# As of 20100110 there are no apps with the user tag.
136ifeq ($(LOCAL_MODULE_CLASS),APPS)
137 ifneq ($(filter $(LOCAL_MODULE_TAGS),user),)
138 $(warning user tag on app $(LOCAL_MODULE) at $(LOCAL_PATH) - add your app to core.mk instead)
139 endif
140endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800141
142LOCAL_MODULE_PATH := $(strip $(LOCAL_MODULE_PATH))
143ifeq ($(LOCAL_MODULE_PATH),)
144 LOCAL_MODULE_PATH := $($(my_prefix)OUT$(use_data)_$(LOCAL_MODULE_CLASS))
145 ifeq ($(strip $(LOCAL_MODULE_PATH)),)
146 $(error $(LOCAL_PATH): unhandled LOCAL_MODULE_CLASS "$(LOCAL_MODULE_CLASS)")
147 endif
148endif
149
150ifneq ($(strip $(LOCAL_BUILT_MODULE)$(LOCAL_INSTALLED_MODULE)),)
151 $(error $(LOCAL_PATH): LOCAL_BUILT_MODULE and LOCAL_INSTALLED_MODULE must not be defined by component makefiles)
152endif
153
154# Make sure that this IS_HOST/CLASS/MODULE combination is unique.
155module_id := MODULE.$(if \
156 $(LOCAL_IS_HOST_MODULE),HOST,TARGET).$(LOCAL_MODULE_CLASS).$(LOCAL_MODULE)
157ifdef $(module_id)
158$(error $(LOCAL_PATH): $(module_id) already defined by $($(module_id)))
159endif
160$(module_id) := $(LOCAL_PATH)
161
162intermediates := $(call local-intermediates-dir)
163intermediates.COMMON := $(call local-intermediates-dir,COMMON)
164
165###########################################################
166# Pick a name for the intermediate and final targets
167###########################################################
168LOCAL_MODULE_STEM := $(strip $(LOCAL_MODULE_STEM))
169ifeq ($(LOCAL_MODULE_STEM),)
170 LOCAL_MODULE_STEM := $(LOCAL_MODULE)
171endif
172LOCAL_INSTALLED_MODULE_STEM := $(LOCAL_MODULE_STEM)$(LOCAL_MODULE_SUFFIX)
173
174LOCAL_BUILT_MODULE_STEM := $(strip $(LOCAL_BUILT_MODULE_STEM))
175ifeq ($(LOCAL_BUILT_MODULE_STEM),)
176 LOCAL_BUILT_MODULE_STEM := $(LOCAL_INSTALLED_MODULE_STEM)
177endif
178
179# OVERRIDE_BUILT_MODULE_PATH is only allowed to be used by the
180# internal SHARED_LIBRARIES build files.
181OVERRIDE_BUILT_MODULE_PATH := $(strip $(OVERRIDE_BUILT_MODULE_PATH))
182ifdef OVERRIDE_BUILT_MODULE_PATH
183 ifneq ($(LOCAL_MODULE_CLASS),SHARED_LIBRARIES)
184 $(error $(LOCAL_PATH): Illegal use of OVERRIDE_BUILT_MODULE_PATH)
185 endif
186 built_module_path := $(OVERRIDE_BUILT_MODULE_PATH)
187else
188 built_module_path := $(intermediates)
189endif
190LOCAL_BUILT_MODULE := $(built_module_path)/$(LOCAL_BUILT_MODULE_STEM)
191built_module_path :=
192
193# LOCAL_UNINSTALLABLE_MODULE is only allowed to be used by the
194# internal STATIC_LIBRARIES build files.
195LOCAL_UNINSTALLABLE_MODULE := $(strip $(LOCAL_UNINSTALLABLE_MODULE))
196ifdef LOCAL_UNINSTALLABLE_MODULE
197 ifeq (,$(filter $(LOCAL_MODULE_CLASS),JAVA_LIBRARIES STATIC_LIBRARIES))
198 $(error $(LOCAL_PATH): Illegal use of LOCAL_UNINSTALLABLE_MODULE)
199 endif
200else
201 LOCAL_INSTALLED_MODULE := $(LOCAL_MODULE_PATH)/$(LOCAL_MODULE_SUBDIR)$(LOCAL_INSTALLED_MODULE_STEM)
202endif
203
204# Assemble the list of targets to create PRIVATE_ variables for.
205LOCAL_INTERMEDIATE_TARGETS += $(LOCAL_BUILT_MODULE)
206
207
208###########################################################
209## AIDL: Compile .aidl files to .java
210###########################################################
211
212aidl_sources := $(filter %.aidl,$(LOCAL_SRC_FILES))
213
214ifneq ($(strip $(aidl_sources)),)
215
216aidl_java_sources := $(patsubst %.aidl,%.java,$(addprefix $(intermediates.COMMON)/src/, $(aidl_sources)))
217aidl_sources := $(addprefix $(TOP_DIR)$(LOCAL_PATH)/, $(aidl_sources))
218
Ying Wange3265fb2010-01-25 09:56:41 -0800219aidl_preprocess_import :=
220LOCAL_SDK_VERSION:=$(strip $(LOCAL_SDK_VERSION))
221ifdef LOCAL_SDK_VERSION
Ying Wanga07d37b2010-06-09 11:43:33 -0700222ifeq ($(LOCAL_SDK_VERSION),current)
223 aidl_preprocess_import := $(TARGET_OUT_COMMON_INTERMEDIATES)/framework.aidl
224else
225 aidl_preprocess_import := $(HISTORICAL_SDK_VERSIONS_ROOT)/$(LOCAL_SDK_VERSION)/framework.aidl
Ying Wange3265fb2010-01-25 09:56:41 -0800226endif # !current
227endif # LOCAL_SDK_VERSION
Ying Wanga07d37b2010-06-09 11:43:33 -0700228$(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 -0800229
Ying Wanga07d37b2010-06-09 11:43:33 -0700230$(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 -0800231 $(transform-aidl-to-java)
232-include $(aidl_java_sources:%.java=%.P)
233
234else
235aidl_java_sources :=
236endif
237
238###########################################################
Doug Zongker9bd49622009-11-30 14:28:59 -0800239## logtags: Add .logtags files to global list, emit java source
240###########################################################
241
242logtags_sources := $(filter %.logtags,$(LOCAL_SRC_FILES))
243
244ifneq ($(strip $(logtags_sources)),)
245
246event_log_tags := $(addprefix $(LOCAL_PATH)/,$(logtags_sources))
247
248# Emit a java source file with constants for the tags, if
249# LOCAL_MODULE_CLASS is "APPS" or "JAVA_LIBRARIES".
250ifneq ($(strip $(filter $(LOCAL_MODULE_CLASS),APPS JAVA_LIBRARIES)),)
251
252logtags_java_sources := $(patsubst %.logtags,%.java,$(addprefix $(intermediates.COMMON)/src/, $(logtags_sources)))
253logtags_sources := $(addprefix $(TOP_DIR)$(LOCAL_PATH)/, $(logtags_sources))
254
Joe Onoratob7510532010-07-14 10:22:54 -0700255$(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 -0800256 $(transform-logtags-to-java)
257
258endif
259
260else
261logtags_java_sources :=
262event_log_tags :=
263endif
264
265###########################################################
The Android Open Source Project88b60792009-03-03 19:28:42 -0800266## Java: Compile .java files to .class
267###########################################################
268#TODO: pull this into java.make once host and target are combined
269
Ying Wang52911302010-05-26 13:13:56 -0700270java_sources := $(addprefix $(TOP_DIR)$(LOCAL_PATH)/, $(filter %.java,$(LOCAL_SRC_FILES))) $(aidl_java_sources) $(logtags_java_sources) \
271 $(filter %.java,$(LOCAL_GENERATED_SOURCES))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800272all_java_sources := $(java_sources) $(addprefix $($(my_prefix)OUT_COMMON_INTERMEDIATES)/, $(filter %.java,$(LOCAL_INTERMEDIATE_SOURCES)))
273
274## Java resources #########################################
275
276# Look for resource files in any specified directories.
277# Non-java and non-doc files will be picked up as resources
278# and included in the output jar file.
279java_resource_file_groups :=
280
281LOCAL_JAVA_RESOURCE_DIRS := $(strip $(LOCAL_JAVA_RESOURCE_DIRS))
282ifneq ($(LOCAL_JAVA_RESOURCE_DIRS),)
283 # This makes a list of words like
284 # <dir1>::<file1>:<file2> <dir2>::<file1> <dir3>:
285 # where each of the files is relative to the directory it's grouped with.
286 # Directories that don't contain any resource files will result in groups
287 # that end with a colon, and they are stripped out in the next step.
288 java_resource_file_groups += \
289 $(foreach dir,$(LOCAL_JAVA_RESOURCE_DIRS), \
290 $(subst $(space),:,$(strip \
291 $(TOP_DIR)$(LOCAL_PATH)/$(dir): \
292 $(patsubst ./%,%,$(shell cd $(TOP_DIR)$(LOCAL_PATH)/$(dir) && \
293 find . \
294 -type d -a -name ".svn" -prune -o \
295 -type f \
296 -a \! -name "*.java" \
297 -a \! -name "package.html" \
298 -a \! -name "overview.html" \
299 -a \! -name ".*.swp" \
300 -a \! -name ".DS_Store" \
301 -a \! -name "*~" \
302 -print \
303 )) \
304 )) \
305 )
306 java_resource_file_groups := $(filter-out %:,$(java_resource_file_groups))
307endif # LOCAL_JAVA_RESOURCE_DIRS
308
309LOCAL_JAVA_RESOURCE_FILES := $(strip $(LOCAL_JAVA_RESOURCE_FILES))
310ifneq ($(LOCAL_JAVA_RESOURCE_FILES),)
311 java_resource_file_groups += \
312 $(foreach f,$(LOCAL_JAVA_RESOURCE_FILES), \
313 $(patsubst %/,%,$(dir $(f)))::$(notdir $(f)) \
314 )
315endif # LOCAL_JAVA_RESOURCE_FILES
316
317ifdef java_resource_file_groups
318 # The full paths to all resources, used for dependencies.
319 java_resource_sources := \
320 $(foreach group,$(java_resource_file_groups), \
321 $(addprefix $(word 1,$(subst :,$(space),$(group)))/, \
322 $(wordlist 2,9999,$(subst :,$(space),$(group))) \
323 ) \
324 )
325 # The arguments to jar that will include these files in a jar file.
326 extra_jar_args := \
327 $(foreach group,$(java_resource_file_groups), \
328 $(addprefix -C $(word 1,$(subst :,$(space),$(group))) , \
329 $(wordlist 2,9999,$(subst :,$(space),$(group))) \
330 ) \
331 )
332 java_resource_file_groups :=
333else
334 java_resource_sources :=
335 extra_jar_args :=
336endif # java_resource_file_groups
337
338## PRIVATE java vars ######################################
339
340ifneq ($(strip $(all_java_sources)$(all_res_assets)),)
341
342full_static_java_libs := \
343 $(foreach lib,$(LOCAL_STATIC_JAVA_LIBRARIES), \
344 $(call intermediates-dir-for, \
Ying Wanga83940f2010-09-24 18:09:04 -0700345 JAVA_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),COMMON)/javalib.jar)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800346
347$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_INSTALL_DIR := $(dir $(LOCAL_INSTALLED_MODULE))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800348$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CLASS_INTERMEDIATES_DIR := $(intermediates)/classes
349$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SOURCE_INTERMEDIATES_DIR := $(intermediates)/src
350$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAVA_SOURCES := $(all_java_sources)
351$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAVA_OBJECTS := $(patsubst %.java,%.class,$(LOCAL_SRC_FILES))
352ifeq ($(my_prefix),TARGET_)
Joe Onoratoe62902c2009-09-23 15:28:12 -0700353ifeq ($(LOCAL_SDK_VERSION),)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800354$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,core)
Ying Wanga07d37b2010-06-09 11:43:33 -0700355else
356ifeq ($(LOCAL_SDK_VERSION),current)
357$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,android_stubs_current)
358else
359$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,sdk_v$(LOCAL_SDK_VERSION))
360endif # current
361endif # LOCAL_SDK_VERSION
362endif # TARGET_
The Android Open Source Project88b60792009-03-03 19:28:42 -0800363$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RESOURCE_DIR := $(LOCAL_RESOURCE_DIR)
364$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_EXTRA_JAR_ARGS := $(extra_jar_args)
365$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASSET_DIR := $(LOCAL_ASSET_DIR)
366$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_STATIC_JAVA_LIBRARIES := $(full_static_java_libs)
367
368# full_java_libs: The list of files that should be used as the classpath.
369# Using this list as a dependency list WILL NOT WORK.
370# full_java_lib_deps: Should be specified as a prerequisite of this module
371# to guarantee that the files in full_java_libs will
372# be up-to-date.
373ifdef LOCAL_IS_HOST_MODULE
374# TODO: make prebuilt java libraries use the same
375# intermediates path pattern as target java libraries.
Ying Wang73ca57f2010-09-10 18:38:10 -0700376ifeq ($(LOCAL_BUILD_HOST_DEX),true)
377full_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
378full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
379else
The Android Open Source Project88b60792009-03-03 19:28:42 -0800380full_java_libs := $(addprefix $(HOST_OUT_JAVA_LIBRARIES)/,$(addsuffix $(COMMON_JAVA_PACKAGE_SUFFIX),$(LOCAL_JAVA_LIBRARIES)))
381full_java_lib_deps := $(full_java_libs)
Ying Wang73ca57f2010-09-10 18:38:10 -0700382endif # LOCAL_BUILD_HOST_DEX
The Android Open Source Project88b60792009-03-03 19:28:42 -0800383else
384full_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
385full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
Ying Wange3265fb2010-01-25 09:56:41 -0800386endif # !LOCAL_IS_HOST_MODULE
The Android Open Source Project88b60792009-03-03 19:28:42 -0800387full_java_libs += $(full_static_java_libs) $(LOCAL_CLASSPATH)
388full_java_lib_deps += $(full_static_java_libs) $(LOCAL_CLASSPATH)
389
390# This is set by packages that contain instrumentation, allowing them to
391# link against the package they are instrumenting. Currently only one such
392# package is allowed.
393LOCAL_INSTRUMENTATION_FOR := $(strip $(LOCAL_INSTRUMENTATION_FOR))
394ifdef LOCAL_INSTRUMENTATION_FOR
395 ifneq ($(words $(LOCAL_INSTRUMENTATION_FOR)),1)
396 $(error \
397 $(LOCAL_PATH): Multiple LOCAL_INSTRUMENTATION_FOR members defined)
398 endif
399
400 link_instr_intermediates_dir := $(call intermediates-dir-for, \
401 APPS,$(LOCAL_INSTRUMENTATION_FOR))
402 link_instr_intermediates_dir.COMMON := $(call intermediates-dir-for, \
403 APPS,$(LOCAL_INSTRUMENTATION_FOR),,COMMON)
404
Ying Wang3b2bdf12010-02-01 09:51:23 -0800405 # link against the jar with full original names (before proguard processing).
Ying Wanga9c381e2010-10-02 18:35:51 -0700406 full_java_libs += $(link_instr_intermediates_dir.COMMON)/classes.jar
407 full_java_lib_deps += $(link_instr_intermediates_dir.COMMON)/classes.jar
The Android Open Source Project88b60792009-03-03 19:28:42 -0800408endif
409
410ifneq ($(strip $(LOCAL_JAR_MANIFEST)),)
411$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAR_MANIFEST := $(LOCAL_PATH)/$(LOCAL_JAR_MANIFEST)
412else
413$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAR_MANIFEST :=
414endif
415
416endif
417
418
419###########################################################
420## make clean- targets
421###########################################################
422cleantarget := clean-$(LOCAL_MODULE)
423$(cleantarget) : PRIVATE_MODULE := $(LOCAL_MODULE)
424$(cleantarget) : PRIVATE_CLEAN_FILES := \
425 $(PRIVATE_CLEAN_FILES) \
426 $(LOCAL_BUILT_MODULE) \
427 $(LOCAL_INSTALLED_MODULE) \
428 $(intermediates)
429$(cleantarget)::
430 @echo "Clean: $(PRIVATE_MODULE)"
431 $(hide) rm -rf $(PRIVATE_CLEAN_FILES)
432
433###########################################################
434## Common definitions for module.
435###########################################################
436
437# Propagate local configuration options to this target.
438$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_PATH:=$(LOCAL_PATH)
439$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_POST_PROCESS_COMMAND:= $(LOCAL_POST_PROCESS_COMMAND)
440$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_AAPT_FLAGS:= $(LOCAL_AAPT_FLAGS)
441$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_JAVA_LIBRARIES:= $(LOCAL_JAVA_LIBRARIES)
Jeff Hamiltonbb67d212010-02-05 22:36:42 -0600442$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_MANIFEST_PACKAGE_NAME:= $(LOCAL_MANIFEST_PACKAGE_NAME)
Ying Wang3dae0ee2010-09-02 15:41:01 -0700443$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_MANIFEST_INSTRUMENTATION_FOR:= $(LOCAL_MANIFEST_INSTRUMENTATION_FOR)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800444
445$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_ALL_JAVA_LIBRARIES:= $(full_java_libs)
446$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_IS_HOST_MODULE := $(LOCAL_IS_HOST_MODULE)
447$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_HOST:= $(my_host)
448
Dima Zavin46e9bec2009-05-27 19:41:07 -0700449$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_INTERMEDIATES_DIR:= $(intermediates)
450
The Android Open Source Project88b60792009-03-03 19:28:42 -0800451# Tell the module and all of its sub-modules who it is.
452$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_MODULE:= $(LOCAL_MODULE)
453
454# Provide a short-hand for building this module.
455# We name both BUILT and INSTALLED in case
456# LOCAL_UNINSTALLABLE_MODULE is set.
457.PHONY: $(LOCAL_MODULE)
458$(LOCAL_MODULE): $(LOCAL_BUILT_MODULE) $(LOCAL_INSTALLED_MODULE)
459
460###########################################################
461## Module installation rule
462###########################################################
463
464# Some hosts do not have ACP; override the LOCAL version if that's the case.
465ifneq ($(strip $(HOST_ACP_UNAVAILABLE)),)
466 LOCAL_ACP_UNAVAILABLE := $(strip $(HOST_ACP_UNAVAILABLE))
467endif
468
469ifndef LOCAL_UNINSTALLABLE_MODULE
470 # Define a copy rule to install the module.
471 # acp and libraries that it uses can't use acp for
472 # installation; hence, LOCAL_ACP_UNAVAILABLE.
473ifneq ($(LOCAL_ACP_UNAVAILABLE),true)
474$(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE) | $(ACP)
475 @echo "Install: $@"
476 $(copy-file-to-target)
477else
478$(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE)
479 @echo "Install: $@"
480 $(copy-file-to-target-with-cp)
481endif
482
Ying Wange7874c42010-09-17 16:36:06 -0700483ifeq ($(LOCAL_DEX_PREOPT),true)
484installed_odex := $(basename $(LOCAL_INSTALLED_MODULE)).odex
485built_odex := $(basename $(LOCAL_BUILT_MODULE)).odex
486$(installed_odex) : $(built_odex) | $(ACP)
487 @echo "Install: $@"
488 $(copy-file-to-target)
489
Ying Wang19f9c1c2010-09-24 13:56:45 -0700490$(LOCAL_INSTALLED_MODULE) : | $(installed_odex)
Ying Wange7874c42010-09-17 16:36:06 -0700491endif
492
The Android Open Source Project88b60792009-03-03 19:28:42 -0800493endif # !LOCAL_UNINSTALLABLE_MODULE
494
Joe Onoratoe334d252009-07-17 15:33:40 -0400495
496###########################################################
497## CHECK_BUILD goals
498###########################################################
499
500# If nobody has defined a more specific module for the
501# checked modules, use LOCAL_BUILT_MODULE. This was old
502# behavior, so it should be a safe default.
503ifndef LOCAL_CHECKED_MODULE
Joe Onorato05c7f612010-01-05 12:47:14 -0800504 ifndef LOCAL_SDK_VERSION
505 LOCAL_CHECKED_MODULE := $(LOCAL_BUILT_MODULE)
506 endif
Joe Onoratoe334d252009-07-17 15:33:40 -0400507endif
508
509# If they request that this module not be checked, then don't.
510# PLEASE DON'T SET THIS. ANY PLACES THAT SET THIS WITHOUT
511# GOOD REASON WILL HAVE IT REMOVED.
512ifdef LOCAL_DONT_CHECK_MODULE
513 LOCAL_CHECKED_MODULE :=
514endif
515
The Android Open Source Project88b60792009-03-03 19:28:42 -0800516###########################################################
517## Register with ALL_MODULES
518###########################################################
519
520ALL_MODULES += $(LOCAL_MODULE)
521
522# Don't use += on subvars, or else they'll end up being
523# recursively expanded.
Joe Onorato8a06bac2010-05-21 14:29:29 -0700524ALL_MODULES.$(LOCAL_MODULE).CLASS := \
525 $(ALL_MODULES.$(LOCAL_MODULE).CLASS) $(LOCAL_MODULE_CLASS)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800526ALL_MODULES.$(LOCAL_MODULE).PATH := \
527 $(ALL_MODULES.$(LOCAL_MODULE).PATH) $(LOCAL_PATH)
528ALL_MODULES.$(LOCAL_MODULE).TAGS := \
529 $(ALL_MODULES.$(LOCAL_MODULE).TAGS) $(LOCAL_MODULE_TAGS)
Joe Onoratoe334d252009-07-17 15:33:40 -0400530ALL_MODULES.$(LOCAL_MODULE).CHECKED := \
531 $(ALL_MODULES.$(LOCAL_MODULE).CHECKED) $(LOCAL_CHECKED_MODULE)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800532ALL_MODULES.$(LOCAL_MODULE).BUILT := \
533 $(ALL_MODULES.$(LOCAL_MODULE).BUILT) $(LOCAL_BUILT_MODULE)
534ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \
535 $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(LOCAL_INSTALLED_MODULE)
536ALL_MODULES.$(LOCAL_MODULE).REQUIRED := \
537 $(ALL_MODULES.$(LOCAL_MODULE).REQUIRED) $(LOCAL_REQUIRED_MODULES)
Doug Zongker9bd49622009-11-30 14:28:59 -0800538ALL_MODULES.$(LOCAL_MODULE).EVENT_LOG_TAGS := \
539 $(ALL_MODULES.$(LOCAL_MODULE).EVENT_LOG_TAGS) $(event_log_tags)
Joe Onorato77dc0a52010-05-17 18:16:11 -0700540ALL_MODULES.$(LOCAL_MODULE).INTERMEDIATE_SOURCE_DIR := \
Ying Wang01c35172010-05-17 19:07:21 -0700541 $(ALL_MODULES.$(LOCAL_MODULE).INTERMEDIATE_SOURCE_DIR) $(LOCAL_INTERMEDIATE_SOURCE_DIR)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800542
Joe Onorato8a06bac2010-05-21 14:29:29 -0700543INSTALLABLE_FILES.$(LOCAL_INSTALLED_MODULE).MODULE := $(LOCAL_MODULE)
544
The Android Open Source Project88b60792009-03-03 19:28:42 -0800545###########################################################
546## Take care of LOCAL_MODULE_TAGS
547###########################################################
548
549# Keep track of all the tags we've seen.
550ALL_MODULE_TAGS := $(sort $(ALL_MODULE_TAGS) $(LOCAL_MODULE_TAGS))
551
552# Add this module to the tag list of each specified tag.
553# Don't use "+=". If the variable hasn't been set with ":=",
554# it will default to recursive expansion.
555$(foreach tag,$(LOCAL_MODULE_TAGS),\
556 $(eval ALL_MODULE_TAGS.$(tag) := \
557 $(ALL_MODULE_TAGS.$(tag)) \
558 $(LOCAL_INSTALLED_MODULE)))
559
560# Add this module name to the tag list of each specified tag.
561$(foreach tag,$(LOCAL_MODULE_TAGS),\
562 $(eval ALL_MODULE_NAME_TAGS.$(tag) += $(LOCAL_MODULE)))
563
The Android Open Source Project88b60792009-03-03 19:28:42 -0800564###########################################################
565## NOTICE files
566###########################################################
567
568include $(BUILD_SYSTEM)/notice_files.mk
569
570#:vi noexpandtab