The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1 | # |
| 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. |
| 19 | ifdef base-rules-hook |
| 20 | $(if $(base-rules-hook),) |
| 21 | endif |
| 22 | |
| 23 | ########################################################### |
| 24 | ## Common instructions for a generic module. |
| 25 | ########################################################### |
| 26 | |
| 27 | LOCAL_MODULE := $(strip $(LOCAL_MODULE)) |
| 28 | ifeq ($(LOCAL_MODULE),) |
| 29 | $(error $(LOCAL_PATH): LOCAL_MODULE is not defined) |
| 30 | endif |
| 31 | |
| 32 | LOCAL_IS_HOST_MODULE := $(strip $(LOCAL_IS_HOST_MODULE)) |
| 33 | ifdef 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- |
| 39 | else |
| 40 | my_prefix:=TARGET_ |
| 41 | my_host:= |
| 42 | endif |
| 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 | |
| 58 | LOCAL_MODULE_TAGS := $(sort $(LOCAL_MODULE_TAGS)) |
| 59 | ifeq (,$(LOCAL_MODULE_TAGS)) |
| 60 | # Modules without tags fall back to user (which is changed to user eng below) |
| 61 | LOCAL_MODULE_TAGS := user |
Jean-Baptiste Queru | 32afccc | 2010-09-14 13:25:42 -0700 | [diff] [blame] | 62 | #$(warning default tags: $(lastword $(filter-out config/% out/%,$(MAKEFILE_LIST)))) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 63 | endif |
| 64 | |
Jean-Baptiste Queru | a831cbd | 2010-01-07 11:06:50 -0800 | [diff] [blame] | 65 | # 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. |
| 68 | ifneq ($(filter-out user debug eng tests optional samples,$(LOCAL_MODULE_TAGS)),) |
| 69 | $(warning unusual tags $(LOCAL_MODULE_TAGS) on $(LOCAL_MODULE) at $(LOCAL_PATH)) |
| 70 | endif |
| 71 | |
Jean-Baptiste Queru | 39de432 | 2010-09-03 16:32:58 -0700 | [diff] [blame] | 72 | ifneq ($(filter $(LOCAL_MODULE_TAGS),user),) |
| 73 | ifeq ($(filter $(GRANDFATHERED_USER_MODULES),$(LOCAL_MODULE)),) |
Jean-Baptiste Queru | 6e8b268 | 2010-09-14 08:59:21 -0700 | [diff] [blame] | 74 | $(warning *** Module name: $(LOCAL_MODULE)) |
| 75 | $(warning *** Makefile location: $(LOCAL_PATH)) |
Jean-Baptiste Queru | 5890600 | 2010-09-15 13:59:29 -0700 | [diff] [blame] | 76 | $(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 Queru | 6e8b268 | 2010-09-14 08:59:21 -0700 | [diff] [blame] | 98 | $(error user tag detected on new module - user tags are only supported on legacy modules) |
Jean-Baptiste Queru | 39de432 | 2010-09-03 16:32:58 -0700 | [diff] [blame] | 99 | endif |
| 100 | endif |
| 101 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 102 | # 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 | # |
| 109 | ifneq ($(call find-parent-file,$(LOCAL_PATH),MODULE_LICENSE*_GPL*),) |
| 110 | LOCAL_MODULE_TAGS += gnu |
| 111 | endif |
| 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 | # |
| 117 | ifneq (,$(filter $(LOCAL_MODULE),$(CUSTOM_MODULES))) |
| 118 | LOCAL_MODULE_TAGS := $(sort $(LOCAL_MODULE_TAGS) user) |
| 119 | endif |
| 120 | |
| 121 | # The definition of should-install-to-system will be different depending |
The Android Open Source Project | 2f31293 | 2009-03-09 11:52:11 -0700 | [diff] [blame] | 122 | # on which goal (e.g., sdk or just droid) is being built. |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 123 | ifdef LOCAL_IS_HOST_MODULE |
| 124 | use_data := |
| 125 | else |
| 126 | use_data := $(if $(call should-install-to-system,$(LOCAL_MODULE_TAGS)),,_DATA) |
| 127 | endif |
| 128 | |
| 129 | LOCAL_MODULE_CLASS := $(strip $(LOCAL_MODULE_CLASS)) |
| 130 | ifneq ($(words $(LOCAL_MODULE_CLASS)),1) |
| 131 | $(error $(LOCAL_PATH): LOCAL_MODULE_CLASS must contain exactly one word, not "$(LOCAL_MODULE_CLASS)") |
| 132 | endif |
| 133 | |
Jean-Baptiste Queru | 6907cfe | 2010-01-07 11:19:39 -0800 | [diff] [blame] | 134 | # Those used to be implicitly ignored, but aren't any more. |
| 135 | # As of 20100110 there are no apps with the user tag. |
| 136 | ifeq ($(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 |
| 140 | endif |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 141 | |
| 142 | LOCAL_MODULE_PATH := $(strip $(LOCAL_MODULE_PATH)) |
| 143 | ifeq ($(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 |
| 148 | endif |
| 149 | |
| 150 | ifneq ($(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) |
| 152 | endif |
| 153 | |
| 154 | # Make sure that this IS_HOST/CLASS/MODULE combination is unique. |
| 155 | module_id := MODULE.$(if \ |
| 156 | $(LOCAL_IS_HOST_MODULE),HOST,TARGET).$(LOCAL_MODULE_CLASS).$(LOCAL_MODULE) |
| 157 | ifdef $(module_id) |
| 158 | $(error $(LOCAL_PATH): $(module_id) already defined by $($(module_id))) |
| 159 | endif |
| 160 | $(module_id) := $(LOCAL_PATH) |
| 161 | |
| 162 | intermediates := $(call local-intermediates-dir) |
| 163 | intermediates.COMMON := $(call local-intermediates-dir,COMMON) |
| 164 | |
| 165 | ########################################################### |
| 166 | # Pick a name for the intermediate and final targets |
| 167 | ########################################################### |
| 168 | LOCAL_MODULE_STEM := $(strip $(LOCAL_MODULE_STEM)) |
| 169 | ifeq ($(LOCAL_MODULE_STEM),) |
| 170 | LOCAL_MODULE_STEM := $(LOCAL_MODULE) |
| 171 | endif |
| 172 | LOCAL_INSTALLED_MODULE_STEM := $(LOCAL_MODULE_STEM)$(LOCAL_MODULE_SUFFIX) |
| 173 | |
| 174 | LOCAL_BUILT_MODULE_STEM := $(strip $(LOCAL_BUILT_MODULE_STEM)) |
| 175 | ifeq ($(LOCAL_BUILT_MODULE_STEM),) |
| 176 | LOCAL_BUILT_MODULE_STEM := $(LOCAL_INSTALLED_MODULE_STEM) |
| 177 | endif |
| 178 | |
| 179 | # OVERRIDE_BUILT_MODULE_PATH is only allowed to be used by the |
| 180 | # internal SHARED_LIBRARIES build files. |
| 181 | OVERRIDE_BUILT_MODULE_PATH := $(strip $(OVERRIDE_BUILT_MODULE_PATH)) |
| 182 | ifdef 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) |
| 187 | else |
| 188 | built_module_path := $(intermediates) |
| 189 | endif |
| 190 | LOCAL_BUILT_MODULE := $(built_module_path)/$(LOCAL_BUILT_MODULE_STEM) |
| 191 | built_module_path := |
| 192 | |
| 193 | # LOCAL_UNINSTALLABLE_MODULE is only allowed to be used by the |
| 194 | # internal STATIC_LIBRARIES build files. |
| 195 | LOCAL_UNINSTALLABLE_MODULE := $(strip $(LOCAL_UNINSTALLABLE_MODULE)) |
| 196 | ifdef 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 |
| 200 | else |
| 201 | LOCAL_INSTALLED_MODULE := $(LOCAL_MODULE_PATH)/$(LOCAL_MODULE_SUBDIR)$(LOCAL_INSTALLED_MODULE_STEM) |
| 202 | endif |
| 203 | |
| 204 | # Assemble the list of targets to create PRIVATE_ variables for. |
| 205 | LOCAL_INTERMEDIATE_TARGETS += $(LOCAL_BUILT_MODULE) |
| 206 | |
| 207 | |
| 208 | ########################################################### |
| 209 | ## AIDL: Compile .aidl files to .java |
| 210 | ########################################################### |
| 211 | |
| 212 | aidl_sources := $(filter %.aidl,$(LOCAL_SRC_FILES)) |
| 213 | |
| 214 | ifneq ($(strip $(aidl_sources)),) |
| 215 | |
| 216 | aidl_java_sources := $(patsubst %.aidl,%.java,$(addprefix $(intermediates.COMMON)/src/, $(aidl_sources))) |
| 217 | aidl_sources := $(addprefix $(TOP_DIR)$(LOCAL_PATH)/, $(aidl_sources)) |
| 218 | |
Ying Wang | e3265fb | 2010-01-25 09:56:41 -0800 | [diff] [blame] | 219 | aidl_preprocess_import := |
| 220 | LOCAL_SDK_VERSION:=$(strip $(LOCAL_SDK_VERSION)) |
| 221 | ifdef LOCAL_SDK_VERSION |
Ying Wang | a07d37b | 2010-06-09 11:43:33 -0700 | [diff] [blame] | 222 | ifeq ($(LOCAL_SDK_VERSION),current) |
| 223 | aidl_preprocess_import := $(TARGET_OUT_COMMON_INTERMEDIATES)/framework.aidl |
| 224 | else |
| 225 | aidl_preprocess_import := $(HISTORICAL_SDK_VERSIONS_ROOT)/$(LOCAL_SDK_VERSION)/framework.aidl |
Ying Wang | e3265fb | 2010-01-25 09:56:41 -0800 | [diff] [blame] | 226 | endif # !current |
| 227 | endif # LOCAL_SDK_VERSION |
Ying Wang | a07d37b | 2010-06-09 11:43:33 -0700 | [diff] [blame] | 228 | $(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 Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 229 | |
Ying Wang | a07d37b | 2010-06-09 11:43:33 -0700 | [diff] [blame] | 230 | $(aidl_java_sources): $(intermediates.COMMON)/src/%.java: $(TOPDIR)$(LOCAL_PATH)/%.aidl $(PRIVATE_ADDITIONAL_DEPENDENCIES) $(AIDL) $(aidl_preprocess_import) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 231 | $(transform-aidl-to-java) |
| 232 | -include $(aidl_java_sources:%.java=%.P) |
| 233 | |
| 234 | else |
| 235 | aidl_java_sources := |
| 236 | endif |
| 237 | |
| 238 | ########################################################### |
Doug Zongker | 9bd4962 | 2009-11-30 14:28:59 -0800 | [diff] [blame] | 239 | ## logtags: Add .logtags files to global list, emit java source |
| 240 | ########################################################### |
| 241 | |
| 242 | logtags_sources := $(filter %.logtags,$(LOCAL_SRC_FILES)) |
| 243 | |
| 244 | ifneq ($(strip $(logtags_sources)),) |
| 245 | |
| 246 | event_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". |
| 250 | ifneq ($(strip $(filter $(LOCAL_MODULE_CLASS),APPS JAVA_LIBRARIES)),) |
| 251 | |
| 252 | logtags_java_sources := $(patsubst %.logtags,%.java,$(addprefix $(intermediates.COMMON)/src/, $(logtags_sources))) |
| 253 | logtags_sources := $(addprefix $(TOP_DIR)$(LOCAL_PATH)/, $(logtags_sources)) |
| 254 | |
Joe Onorato | b751053 | 2010-07-14 10:22:54 -0700 | [diff] [blame] | 255 | $(logtags_java_sources): $(intermediates.COMMON)/src/%.java: $(TOPDIR)$(LOCAL_PATH)/%.logtags $(TARGET_OUT_COMMON_INTERMEDIATES)/all-event-log-tags.txt |
Doug Zongker | 9bd4962 | 2009-11-30 14:28:59 -0800 | [diff] [blame] | 256 | $(transform-logtags-to-java) |
| 257 | |
| 258 | endif |
| 259 | |
| 260 | else |
| 261 | logtags_java_sources := |
| 262 | event_log_tags := |
| 263 | endif |
| 264 | |
| 265 | ########################################################### |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 266 | ## Java: Compile .java files to .class |
| 267 | ########################################################### |
| 268 | #TODO: pull this into java.make once host and target are combined |
| 269 | |
Ying Wang | 5291130 | 2010-05-26 13:13:56 -0700 | [diff] [blame] | 270 | java_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 Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 272 | all_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. |
| 279 | java_resource_file_groups := |
| 280 | |
| 281 | LOCAL_JAVA_RESOURCE_DIRS := $(strip $(LOCAL_JAVA_RESOURCE_DIRS)) |
| 282 | ifneq ($(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)) |
| 307 | endif # LOCAL_JAVA_RESOURCE_DIRS |
| 308 | |
| 309 | LOCAL_JAVA_RESOURCE_FILES := $(strip $(LOCAL_JAVA_RESOURCE_FILES)) |
| 310 | ifneq ($(LOCAL_JAVA_RESOURCE_FILES),) |
| 311 | java_resource_file_groups += \ |
| 312 | $(foreach f,$(LOCAL_JAVA_RESOURCE_FILES), \ |
| 313 | $(patsubst %/,%,$(dir $(f)))::$(notdir $(f)) \ |
| 314 | ) |
| 315 | endif # LOCAL_JAVA_RESOURCE_FILES |
| 316 | |
| 317 | ifdef 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 := |
| 333 | else |
| 334 | java_resource_sources := |
| 335 | extra_jar_args := |
| 336 | endif # java_resource_file_groups |
| 337 | |
| 338 | ## PRIVATE java vars ###################################### |
| 339 | |
| 340 | ifneq ($(strip $(all_java_sources)$(all_res_assets)),) |
| 341 | |
| 342 | full_static_java_libs := \ |
| 343 | $(foreach lib,$(LOCAL_STATIC_JAVA_LIBRARIES), \ |
| 344 | $(call intermediates-dir-for, \ |
Ying Wang | a83940f | 2010-09-24 18:09:04 -0700 | [diff] [blame] | 345 | JAVA_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),COMMON)/javalib.jar) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 346 | |
| 347 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_INSTALL_DIR := $(dir $(LOCAL_INSTALLED_MODULE)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 348 | $(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)) |
| 352 | ifeq ($(my_prefix),TARGET_) |
Joe Onorato | e62902c | 2009-09-23 15:28:12 -0700 | [diff] [blame] | 353 | ifeq ($(LOCAL_SDK_VERSION),) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 354 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,core) |
Ying Wang | a07d37b | 2010-06-09 11:43:33 -0700 | [diff] [blame] | 355 | else |
| 356 | ifeq ($(LOCAL_SDK_VERSION),current) |
| 357 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,android_stubs_current) |
| 358 | else |
| 359 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,sdk_v$(LOCAL_SDK_VERSION)) |
| 360 | endif # current |
| 361 | endif # LOCAL_SDK_VERSION |
| 362 | endif # TARGET_ |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 363 | $(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. |
| 373 | ifdef LOCAL_IS_HOST_MODULE |
| 374 | # TODO: make prebuilt java libraries use the same |
| 375 | # intermediates path pattern as target java libraries. |
Ying Wang | 73ca57f | 2010-09-10 18:38:10 -0700 | [diff] [blame] | 376 | ifeq ($(LOCAL_BUILD_HOST_DEX),true) |
| 377 | full_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) |
| 378 | full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) |
| 379 | else |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 380 | full_java_libs := $(addprefix $(HOST_OUT_JAVA_LIBRARIES)/,$(addsuffix $(COMMON_JAVA_PACKAGE_SUFFIX),$(LOCAL_JAVA_LIBRARIES))) |
| 381 | full_java_lib_deps := $(full_java_libs) |
Ying Wang | 73ca57f | 2010-09-10 18:38:10 -0700 | [diff] [blame] | 382 | endif # LOCAL_BUILD_HOST_DEX |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 383 | else |
| 384 | full_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) |
| 385 | full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) |
Ying Wang | e3265fb | 2010-01-25 09:56:41 -0800 | [diff] [blame] | 386 | endif # !LOCAL_IS_HOST_MODULE |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 387 | full_java_libs += $(full_static_java_libs) $(LOCAL_CLASSPATH) |
| 388 | full_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. |
| 393 | LOCAL_INSTRUMENTATION_FOR := $(strip $(LOCAL_INSTRUMENTATION_FOR)) |
| 394 | ifdef 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 Wang | 3b2bdf1 | 2010-02-01 09:51:23 -0800 | [diff] [blame] | 405 | # link against the jar with full original names (before proguard processing). |
Ying Wang | a9c381e | 2010-10-02 18:35:51 -0700 | [diff] [blame^] | 406 | 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 Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 408 | endif |
| 409 | |
| 410 | ifneq ($(strip $(LOCAL_JAR_MANIFEST)),) |
| 411 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAR_MANIFEST := $(LOCAL_PATH)/$(LOCAL_JAR_MANIFEST) |
| 412 | else |
| 413 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAR_MANIFEST := |
| 414 | endif |
| 415 | |
| 416 | endif |
| 417 | |
| 418 | |
| 419 | ########################################################### |
| 420 | ## make clean- targets |
| 421 | ########################################################### |
| 422 | cleantarget := 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 Hamilton | bb67d21 | 2010-02-05 22:36:42 -0600 | [diff] [blame] | 442 | $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_MANIFEST_PACKAGE_NAME:= $(LOCAL_MANIFEST_PACKAGE_NAME) |
Ying Wang | 3dae0ee | 2010-09-02 15:41:01 -0700 | [diff] [blame] | 443 | $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_MANIFEST_INSTRUMENTATION_FOR:= $(LOCAL_MANIFEST_INSTRUMENTATION_FOR) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 444 | |
| 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 Zavin | 46e9bec | 2009-05-27 19:41:07 -0700 | [diff] [blame] | 449 | $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_INTERMEDIATES_DIR:= $(intermediates) |
| 450 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 451 | # 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. |
| 465 | ifneq ($(strip $(HOST_ACP_UNAVAILABLE)),) |
| 466 | LOCAL_ACP_UNAVAILABLE := $(strip $(HOST_ACP_UNAVAILABLE)) |
| 467 | endif |
| 468 | |
| 469 | ifndef 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. |
| 473 | ifneq ($(LOCAL_ACP_UNAVAILABLE),true) |
| 474 | $(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE) | $(ACP) |
| 475 | @echo "Install: $@" |
| 476 | $(copy-file-to-target) |
| 477 | else |
| 478 | $(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE) |
| 479 | @echo "Install: $@" |
| 480 | $(copy-file-to-target-with-cp) |
| 481 | endif |
| 482 | |
Ying Wang | e7874c4 | 2010-09-17 16:36:06 -0700 | [diff] [blame] | 483 | ifeq ($(LOCAL_DEX_PREOPT),true) |
| 484 | installed_odex := $(basename $(LOCAL_INSTALLED_MODULE)).odex |
| 485 | built_odex := $(basename $(LOCAL_BUILT_MODULE)).odex |
| 486 | $(installed_odex) : $(built_odex) | $(ACP) |
| 487 | @echo "Install: $@" |
| 488 | $(copy-file-to-target) |
| 489 | |
Ying Wang | 19f9c1c | 2010-09-24 13:56:45 -0700 | [diff] [blame] | 490 | $(LOCAL_INSTALLED_MODULE) : | $(installed_odex) |
Ying Wang | e7874c4 | 2010-09-17 16:36:06 -0700 | [diff] [blame] | 491 | endif |
| 492 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 493 | endif # !LOCAL_UNINSTALLABLE_MODULE |
| 494 | |
Joe Onorato | e334d25 | 2009-07-17 15:33:40 -0400 | [diff] [blame] | 495 | |
| 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. |
| 503 | ifndef LOCAL_CHECKED_MODULE |
Joe Onorato | 05c7f61 | 2010-01-05 12:47:14 -0800 | [diff] [blame] | 504 | ifndef LOCAL_SDK_VERSION |
| 505 | LOCAL_CHECKED_MODULE := $(LOCAL_BUILT_MODULE) |
| 506 | endif |
Joe Onorato | e334d25 | 2009-07-17 15:33:40 -0400 | [diff] [blame] | 507 | endif |
| 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. |
| 512 | ifdef LOCAL_DONT_CHECK_MODULE |
| 513 | LOCAL_CHECKED_MODULE := |
| 514 | endif |
| 515 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 516 | ########################################################### |
| 517 | ## Register with ALL_MODULES |
| 518 | ########################################################### |
| 519 | |
| 520 | ALL_MODULES += $(LOCAL_MODULE) |
| 521 | |
| 522 | # Don't use += on subvars, or else they'll end up being |
| 523 | # recursively expanded. |
Joe Onorato | 8a06bac | 2010-05-21 14:29:29 -0700 | [diff] [blame] | 524 | ALL_MODULES.$(LOCAL_MODULE).CLASS := \ |
| 525 | $(ALL_MODULES.$(LOCAL_MODULE).CLASS) $(LOCAL_MODULE_CLASS) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 526 | ALL_MODULES.$(LOCAL_MODULE).PATH := \ |
| 527 | $(ALL_MODULES.$(LOCAL_MODULE).PATH) $(LOCAL_PATH) |
| 528 | ALL_MODULES.$(LOCAL_MODULE).TAGS := \ |
| 529 | $(ALL_MODULES.$(LOCAL_MODULE).TAGS) $(LOCAL_MODULE_TAGS) |
Joe Onorato | e334d25 | 2009-07-17 15:33:40 -0400 | [diff] [blame] | 530 | ALL_MODULES.$(LOCAL_MODULE).CHECKED := \ |
| 531 | $(ALL_MODULES.$(LOCAL_MODULE).CHECKED) $(LOCAL_CHECKED_MODULE) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 532 | ALL_MODULES.$(LOCAL_MODULE).BUILT := \ |
| 533 | $(ALL_MODULES.$(LOCAL_MODULE).BUILT) $(LOCAL_BUILT_MODULE) |
| 534 | ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \ |
| 535 | $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(LOCAL_INSTALLED_MODULE) |
| 536 | ALL_MODULES.$(LOCAL_MODULE).REQUIRED := \ |
| 537 | $(ALL_MODULES.$(LOCAL_MODULE).REQUIRED) $(LOCAL_REQUIRED_MODULES) |
Doug Zongker | 9bd4962 | 2009-11-30 14:28:59 -0800 | [diff] [blame] | 538 | ALL_MODULES.$(LOCAL_MODULE).EVENT_LOG_TAGS := \ |
| 539 | $(ALL_MODULES.$(LOCAL_MODULE).EVENT_LOG_TAGS) $(event_log_tags) |
Joe Onorato | 77dc0a5 | 2010-05-17 18:16:11 -0700 | [diff] [blame] | 540 | ALL_MODULES.$(LOCAL_MODULE).INTERMEDIATE_SOURCE_DIR := \ |
Ying Wang | 01c3517 | 2010-05-17 19:07:21 -0700 | [diff] [blame] | 541 | $(ALL_MODULES.$(LOCAL_MODULE).INTERMEDIATE_SOURCE_DIR) $(LOCAL_INTERMEDIATE_SOURCE_DIR) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 542 | |
Joe Onorato | 8a06bac | 2010-05-21 14:29:29 -0700 | [diff] [blame] | 543 | INSTALLABLE_FILES.$(LOCAL_INSTALLED_MODULE).MODULE := $(LOCAL_MODULE) |
| 544 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 545 | ########################################################### |
| 546 | ## Take care of LOCAL_MODULE_TAGS |
| 547 | ########################################################### |
| 548 | |
| 549 | # Keep track of all the tags we've seen. |
| 550 | ALL_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 Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 564 | ########################################################### |
| 565 | ## NOTICE files |
| 566 | ########################################################### |
| 567 | |
| 568 | include $(BUILD_SYSTEM)/notice_files.mk |
| 569 | |
| 570 | #:vi noexpandtab |