main.mk revision 128800f2c8d3f27d6ae29b9cb8e62cb26bcf5f2f
1# Only use ANDROID_BUILD_SHELL to wrap around bash. 2# DO NOT use other shells such as zsh. 3ifdef ANDROID_BUILD_SHELL 4SHELL := $(ANDROID_BUILD_SHELL) 5else 6# Use bash, not whatever shell somebody has installed as /bin/sh 7# This is repeated in config.mk, since envsetup.sh runs that file 8# directly. 9SHELL := /bin/bash 10endif 11 12ifndef KATI 13 14host_prebuilts := linux-x86 15ifeq ($(shell uname),Darwin) 16host_prebuilts := darwin-x86 17endif 18 19.PHONY: run_soong_ui 20run_soong_ui: 21 +@prebuilts/build-tools/$(host_prebuilts)/bin/makeparallel --ninja build/soong/soong_ui.bash --make-mode $(MAKECMDGOALS) 22 23.PHONY: $(MAKECMDGOALS) 24$(sort $(MAKECMDGOALS)) : run_soong_ui 25 @#empty 26 27else # KATI 28 29# Absolute path of the present working direcotry. 30# This overrides the shell variable $PWD, which does not necessarily points to 31# the top of the source tree, for example when "make -C" is used in m/mm/mmm. 32PWD := $(shell pwd) 33 34TOP := . 35TOPDIR := 36 37BUILD_SYSTEM := $(TOPDIR)build/core 38 39# This is the default target. It must be the first declared target. 40.PHONY: droid 41DEFAULT_GOAL := droid 42$(DEFAULT_GOAL): droid_targets 43 44.PHONY: droid_targets 45droid_targets: 46 47# Set up various standard variables based on configuration 48# and host information. 49include $(BUILD_SYSTEM)/config.mk 50 51ifneq ($(filter $(dont_bother_goals), $(MAKECMDGOALS)),) 52dont_bother := true 53endif 54 55include $(SOONG_MAKEVARS_MK) 56 57include $(BUILD_SYSTEM)/clang/config.mk 58 59# Write the build number to a file so it can be read back in 60# without changing the command line every time. Avoids rebuilds 61# when using ninja. 62$(shell mkdir -p $(OUT_DIR) && \ 63 echo -n $(BUILD_NUMBER) > $(OUT_DIR)/build_number.txt && \ 64 echo -n $(BUILD_DATETIME) > $(OUT_DIR)/build_date.txt) 65BUILD_NUMBER_FROM_FILE := $$(cat $(OUT_DIR)/build_number.txt) 66BUILD_DATETIME_FROM_FILE := $$(cat $(OUT_DIR)/build_date.txt) 67ifeq ($(HOST_OS),darwin) 68DATE_FROM_FILE := date -r $(BUILD_DATETIME_FROM_FILE) 69else 70DATE_FROM_FILE := date -d @$(BUILD_DATETIME_FROM_FILE) 71endif 72 73# Make an empty directory, which can be used to make empty jars 74EMPTY_DIRECTORY := $(OUT_DIR)/empty 75$(shell mkdir -p $(EMPTY_DIRECTORY) && rm -rf $(EMPTY_DIRECTORY)/*) 76 77# CTS-specific config. 78-include cts/build/config.mk 79# VTS-specific config. 80-include test/vts/tools/vts-tradefed/build/config.mk 81# device-tests-specific-config. 82-include tools/tradefederation/build/suites/device-tests/config.mk 83# general-tests-specific-config. 84-include tools/tradefederation/build/suites/general-tests/config.mk 85 86# This allows us to force a clean build - included after the config.mk 87# environment setup is done, but before we generate any dependencies. This 88# file does the rm -rf inline so the deps which are all done below will 89# be generated correctly 90include $(BUILD_SYSTEM)/cleanbuild.mk 91 92# Include the google-specific config 93-include vendor/google/build/config.mk 94 95# These are the modifier targets that don't do anything themselves, but 96# change the behavior of the build. 97# (must be defined before including definitions.make) 98INTERNAL_MODIFIER_TARGETS := all 99 100# EMMA_INSTRUMENT_STATIC merges the static emma library to each emma-enabled module. 101ifeq (true,$(EMMA_INSTRUMENT_STATIC)) 102EMMA_INSTRUMENT := true 103endif 104 105# 106# ----------------------------------------------------------------- 107# Validate ADDITIONAL_DEFAULT_PROPERTIES. 108ifneq ($(ADDITIONAL_DEFAULT_PROPERTIES),) 109$(error ADDITIONAL_DEFAULT_PROPERTIES must not be set before here: $(ADDITIONAL_DEFAULT_PROPERTIES)) 110endif 111 112# 113# ----------------------------------------------------------------- 114# Validate ADDITIONAL_BUILD_PROPERTIES. 115ifneq ($(ADDITIONAL_BUILD_PROPERTIES),) 116$(error ADDITIONAL_BUILD_PROPERTIES must not be set before here: $(ADDITIONAL_BUILD_PROPERTIES)) 117endif 118 119# 120# ----------------------------------------------------------------- 121# Add the product-defined properties to the build properties. 122ifdef PRODUCT_SHIPPING_API_LEVEL 123ADDITIONAL_BUILD_PROPERTIES += \ 124 ro.product.first_api_level=$(PRODUCT_SHIPPING_API_LEVEL) 125endif 126ADDITIONAL_BUILD_PROPERTIES := \ 127 $(ADDITIONAL_BUILD_PROPERTIES) \ 128 $(PRODUCT_PROPERTY_OVERRIDES) 129 130# Bring in standard build system definitions. 131include $(BUILD_SYSTEM)/definitions.mk 132 133# Bring in dex_preopt.mk 134include $(BUILD_SYSTEM)/dex_preopt.mk 135 136ifneq ($(filter user userdebug eng,$(MAKECMDGOALS)),) 137$(info ***************************************************************) 138$(info ***************************************************************) 139$(info Do not pass '$(filter user userdebug eng,$(MAKECMDGOALS))' on \ 140 the make command line.) 141$(info Set TARGET_BUILD_VARIANT in buildspec.mk, or use lunch or) 142$(info choosecombo.) 143$(info ***************************************************************) 144$(info ***************************************************************) 145$(error stopping) 146endif 147 148ifneq ($(filter-out $(INTERNAL_VALID_VARIANTS),$(TARGET_BUILD_VARIANT)),) 149$(info ***************************************************************) 150$(info ***************************************************************) 151$(info Invalid variant: $(TARGET_BUILD_VARIANT)) 152$(info Valid values are: $(INTERNAL_VALID_VARIANTS)) 153$(info ***************************************************************) 154$(info ***************************************************************) 155$(error stopping) 156endif 157 158# ----------------------------------------------------------------- 159# Variable to check java support level inside PDK build. 160# Not necessary if the components is not in PDK. 161# not defined : not supported 162# "sdk" : sdk API only 163# "platform" : platform API supproted 164TARGET_BUILD_JAVA_SUPPORT_LEVEL := platform 165 166# ----------------------------------------------------------------- 167# The pdk (Platform Development Kit) build 168include build/core/pdk_config.mk 169 170# 171# ----------------------------------------------------------------- 172# Jack version configuration 173-include $(TOPDIR)prebuilts/sdk/tools/jack_versions.mk 174-include $(TOPDIR)prebuilts/sdk/tools/jack_for_module.mk 175 176# 177# ----------------------------------------------------------------- 178# Install and start Jack server 179-include $(TOPDIR)prebuilts/sdk/tools/jack_server_setup.mk 180 181# 182# ----------------------------------------------------------------- 183# Jacoco package name for Jack 184-include $(TOPDIR)external/jacoco/config.mk 185 186# 187# ----------------------------------------------------------------- 188# Enable dynamic linker developer warnings for all builds except 189# final release. 190ifneq ($(PLATFORM_VERSION_CODENAME),REL) 191 ADDITIONAL_BUILD_PROPERTIES += ro.bionic.ld.warning=1 192endif 193 194# ----------------------------------------------------------------- 195### 196### In this section we set up the things that are different 197### between the build variants 198### 199 200is_sdk_build := 201 202ifneq ($(filter sdk win_sdk sdk_addon,$(MAKECMDGOALS)),) 203is_sdk_build := true 204endif 205 206# Add build properties for ART. These define system properties used by installd 207# to pass flags to dex2oat. 208ADDITIONAL_BUILD_PROPERTIES += persist.sys.dalvik.vm.lib.2=libart.so 209ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.isa.$(TARGET_ARCH).variant=$(DEX2OAT_TARGET_CPU_VARIANT) 210ifneq ($(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES),) 211 ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.isa.$(TARGET_ARCH).features=$(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) 212endif 213 214ifdef TARGET_2ND_ARCH 215 ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.isa.$(TARGET_2ND_ARCH).variant=$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT) 216 ifneq ($($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES),) 217 ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.isa.$(TARGET_2ND_ARCH).features=$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) 218 endif 219endif 220 221# Add the system server compiler filter if they are specified for the product. 222ifneq (,$(PRODUCT_SYSTEM_SERVER_COMPILER_FILTER)) 223ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.systemservercompilerfilter=$(PRODUCT_SYSTEM_SERVER_COMPILER_FILTER) 224endif 225 226## user/userdebug ## 227 228user_variant := $(filter user userdebug,$(TARGET_BUILD_VARIANT)) 229enable_target_debugging := true 230tags_to_install := 231ifneq (,$(user_variant)) 232 # Target is secure in user builds. 233 ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=1 234 ADDITIONAL_DEFAULT_PROPERTIES += security.perf_harden=1 235 236 ifeq ($(user_variant),user) 237 ADDITIONAL_DEFAULT_PROPERTIES += ro.adb.secure=1 238 endif 239 240 ifeq ($(user_variant),userdebug) 241 # Pick up some extra useful tools 242 tags_to_install += debug 243 else 244 # Disable debugging in plain user builds. 245 enable_target_debugging := 246 endif 247 248 # Disallow mock locations by default for user builds 249 ADDITIONAL_DEFAULT_PROPERTIES += ro.allow.mock.location=0 250 251else # !user_variant 252 # Turn on checkjni for non-user builds. 253 ADDITIONAL_BUILD_PROPERTIES += ro.kernel.android.checkjni=1 254 # Set device insecure for non-user builds. 255 ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=0 256 # Allow mock locations by default for non user builds 257 ADDITIONAL_DEFAULT_PROPERTIES += ro.allow.mock.location=1 258endif # !user_variant 259 260ifeq (true,$(strip $(enable_target_debugging))) 261 # Target is more debuggable and adbd is on by default 262 ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=1 263 # Enable Dalvik lock contention logging. 264 ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.lockprof.threshold=500 265 # Include the debugging/testing OTA keys in this build. 266 INCLUDE_TEST_OTA_KEYS := true 267else # !enable_target_debugging 268 # Target is less debuggable and adbd is off by default 269 ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=0 270endif # !enable_target_debugging 271 272## eng ## 273 274ifeq ($(TARGET_BUILD_VARIANT),eng) 275tags_to_install := debug eng 276ifneq ($(filter ro.setupwizard.mode=ENABLED, $(call collapse-pairs, $(ADDITIONAL_BUILD_PROPERTIES))),) 277 # Don't require the setup wizard on eng builds 278 ADDITIONAL_BUILD_PROPERTIES := $(filter-out ro.setupwizard.mode=%,\ 279 $(call collapse-pairs, $(ADDITIONAL_BUILD_PROPERTIES))) \ 280 ro.setupwizard.mode=OPTIONAL 281endif 282ifndef is_sdk_build 283 # To speedup startup of non-preopted builds, don't verify or compile the boot image. 284 ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.image-dex2oat-filter=verify-at-runtime 285endif 286endif 287 288## sdk ## 289 290ifdef is_sdk_build 291 292# Detect if we want to build a repository for the SDK 293sdk_repo_goal := $(strip $(filter sdk_repo,$(MAKECMDGOALS))) 294MAKECMDGOALS := $(strip $(filter-out sdk_repo,$(MAKECMDGOALS))) 295 296ifneq ($(words $(sort $(filter-out $(INTERNAL_MODIFIER_TARGETS) checkbuild emulator_tests target-files-package,$(MAKECMDGOALS)))),1) 297$(error The 'sdk' target may not be specified with any other targets) 298endif 299 300# AUX dependencies are already added by now; remove triggers from the MAKECMDGOALS 301MAKECMDGOALS := $(strip $(filter-out AUX-%,$(MAKECMDGOALS))) 302 303# TODO: this should be eng I think. Since the sdk is built from the eng 304# variant. 305tags_to_install := debug eng 306ADDITIONAL_BUILD_PROPERTIES += xmpp.auto-presence=true 307ADDITIONAL_BUILD_PROPERTIES += ro.config.nocheckin=yes 308else # !sdk 309endif 310 311BUILD_WITHOUT_PV := true 312 313ADDITIONAL_BUILD_PROPERTIES += net.bt.name=Android 314 315# Sets the location that the runtime dumps stack traces to when signalled 316# with SIGQUIT. Stack trace dumping is turned on for all android builds. 317ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.stack-trace-file=/data/anr/traces.txt 318 319# ------------------------------------------------------------ 320# Define a function that, given a list of module tags, returns 321# non-empty if that module should be installed in /system. 322 323# For most goals, anything not tagged with the "tests" tag should 324# be installed in /system. 325define should-install-to-system 326$(if $(filter tests,$(1)),,true) 327endef 328 329ifdef is_sdk_build 330# For the sdk goal, anything with the "samples" tag should be 331# installed in /data even if that module also has "eng"/"debug"/"user". 332define should-install-to-system 333$(if $(filter samples tests,$(1)),,true) 334endef 335endif 336 337 338# If they only used the modifier goals (all, etc), we'll actually 339# build the default target. 340ifeq ($(filter-out $(INTERNAL_MODIFIER_TARGETS),$(MAKECMDGOALS)),) 341.PHONY: $(INTERNAL_MODIFIER_TARGETS) 342$(INTERNAL_MODIFIER_TARGETS): $(DEFAULT_GOAL) 343endif 344 345# 346# Typical build; include any Android.mk files we can find. 347# 348 349FULL_BUILD := true 350 351# Before we go and include all of the module makefiles, mark the PRODUCT_* 352# and ADDITIONAL*PROPERTIES values readonly so that they won't be modified. 353$(call readonly-product-vars) 354ADDITIONAL_DEFAULT_PROPERTIES := $(strip $(ADDITIONAL_DEFAULT_PROPERTIES)) 355.KATI_READONLY := ADDITIONAL_DEFAULT_PROPERTIES 356ADDITIONAL_BUILD_PROPERTIES := $(strip $(ADDITIONAL_BUILD_PROPERTIES)) 357.KATI_READONLY := ADDITIONAL_BUILD_PROPERTIES 358 359ifneq ($(PRODUCT_ENFORCE_RRO_TARGETS),) 360ENFORCE_RRO_SOURCES := 361endif 362 363ifneq ($(ONE_SHOT_MAKEFILE),) 364# We've probably been invoked by the "mm" shell function 365# with a subdirectory's makefile. 366include $(SOONG_ANDROID_MK) $(wildcard $(ONE_SHOT_MAKEFILE)) 367# Change CUSTOM_MODULES to include only modules that were 368# defined by this makefile; this will install all of those 369# modules as a side-effect. Do this after including ONE_SHOT_MAKEFILE 370# so that the modules will be installed in the same place they 371# would have been with a normal make. 372CUSTOM_MODULES := $(sort $(call get-tagged-modules,$(ALL_MODULE_TAGS))) 373FULL_BUILD := 374# Stub out the notice targets, which probably aren't defined 375# when using ONE_SHOT_MAKEFILE. 376NOTICE-HOST-%: ; 377NOTICE-TARGET-%: ; 378 379# A helper goal printing out install paths 380define register_module_install_path 381.PHONY: GET-MODULE-INSTALL-PATH-$(1) 382GET-MODULE-INSTALL-PATH-$(1): 383 echo 'INSTALL-PATH: $(1) $(ALL_MODULES.$(1).INSTALLED)' 384endef 385 386SORTED_ALL_MODULES := $(sort $(ALL_MODULES)) 387UNIQUE_ALL_MODULES := 388$(foreach m,$(SORTED_ALL_MODULES),\ 389 $(if $(call streq,$(m),$(lastword $(UNIQUE_ALL_MODULES))),,\ 390 $(eval UNIQUE_ALL_MODULES += $(m)))) 391SORTED_ALL_MODULES := 392 393$(foreach mod,$(UNIQUE_ALL_MODULES),$(if $(ALL_MODULES.$(mod).INSTALLED),\ 394 $(eval $(call register_module_install_path,$(mod)))\ 395 $(foreach path,$(ALL_MODULES.$(mod).PATH),\ 396 $(eval my_path_prefix := GET-INSTALL-PATH-IN)\ 397 $(foreach component,$(subst /,$(space),$(path)),\ 398 $(eval my_path_prefix := $$(my_path_prefix)-$$(component))\ 399 $(eval .PHONY: $$(my_path_prefix))\ 400 $(eval $$(my_path_prefix): GET-MODULE-INSTALL-PATH-$(mod)))))) 401UNIQUE_ALL_MODULES := 402 403else # ONE_SHOT_MAKEFILE 404 405ifneq ($(dont_bother),true) 406# 407# Include all of the makefiles in the system 408# 409 410subdir_makefiles := $(SOONG_ANDROID_MK) $(call first-makefiles-under,$(TOP)) 411subdir_makefiles_total := $(words $(subdir_makefiles)) 412.KATI_READONLY := subdir_makefiles_total 413 414$(foreach mk,$(subdir_makefiles),$(info [$(call inc_and_print,subdir_makefiles_inc)/$(subdir_makefiles_total)] including $(mk) ...)$(eval include $(mk))) 415 416ifdef PDK_FUSION_PLATFORM_ZIP 417# Bring in the PDK platform.zip modules. 418include $(BUILD_SYSTEM)/pdk_fusion_modules.mk 419endif # PDK_FUSION_PLATFORM_ZIP 420 421droid_targets : blueprint_tools 422 423endif # dont_bother 424 425endif # ONE_SHOT_MAKEFILE 426 427# ------------------------------------------------------------------- 428# All module makefiles have been included at this point. 429# ------------------------------------------------------------------- 430 431# ------------------------------------------------------------------- 432# Enforce to generate all RRO packages for modules having resource 433# overlays. 434# ------------------------------------------------------------------- 435ifneq ($(PRODUCT_ENFORCE_RRO_TARGETS),) 436$(call generate_all_enforce_rro_packages) 437endif 438 439# ------------------------------------------------------------------- 440# Fix up CUSTOM_MODULES to refer to installed files rather than 441# just bare module names. Leave unknown modules alone in case 442# they're actually full paths to a particular file. 443known_custom_modules := $(filter $(ALL_MODULES),$(CUSTOM_MODULES)) 444unknown_custom_modules := $(filter-out $(ALL_MODULES),$(CUSTOM_MODULES)) 445CUSTOM_MODULES := \ 446 $(call module-installed-files,$(known_custom_modules)) \ 447 $(unknown_custom_modules) 448 449# ------------------------------------------------------------------- 450# Define dependencies for modules that require other modules. 451# This can only happen now, after we've read in all module makefiles. 452# 453# TODO: deal with the fact that a bare module name isn't 454# unambiguous enough. Maybe declare short targets like 455# APPS:Quake or HOST:SHARED_LIBRARIES:libutils. 456# BUG: the system image won't know to depend on modules that are 457# brought in as requirements of other modules. 458# 459# Resolve the required module name to 32-bit or 64-bit variant. 460# Get a list of corresponding 32-bit module names, if one exists. 461ifneq ($(TARGET_TRANSLATE_2ND_ARCH),true) 462define get-32-bit-modules 463$(sort $(foreach m,$(1),\ 464 $(if $(ALL_MODULES.$(m)$(TARGET_2ND_ARCH_MODULE_SUFFIX).CLASS),\ 465 $(m)$(TARGET_2ND_ARCH_MODULE_SUFFIX))\ 466 $(if $(ALL_MODULES.$(m)$(HOST_2ND_ARCH_MODULE_SUFFIX).CLASS),\ 467 $(m)$(HOST_2ND_ARCH_MODULE_SUFFIX))\ 468 )) 469endef 470# Get a list of corresponding 32-bit module names, if one exists; 471# otherwise return the original module name 472define get-32-bit-modules-if-we-can 473$(sort $(foreach m,$(1),\ 474 $(if $(ALL_MODULES.$(m)$(TARGET_2ND_ARCH_MODULE_SUFFIX).CLASS)$(ALL_MODULES.$(m)$(HOST_2ND_ARCH_MODULE_SUFFIX).CLASS),\ 475 $(if $(ALL_MODULES.$(m)$(TARGET_2ND_ARCH_MODULE_SUFFIX).CLASS),$(m)$(TARGET_2ND_ARCH_MODULE_SUFFIX)) \ 476 $(if $(ALL_MODULES.$(m)$(HOST_2ND_ARCH_MODULE_SUFFIX).CLASS),$(m)$(HOST_2ND_ARCH_MODULE_SUFFIX)),\ 477 $(m)))) 478endef 479else # TARGET_TRANSLATE_2ND_ARCH 480# For binary translation config, by default only install the first arch. 481define get-32-bit-modules 482endef 483 484define get-32-bit-modules-if-we-can 485$(strip $(1)) 486endef 487endif # TARGET_TRANSLATE_2ND_ARCH 488 489# If a module is for a cross host os, the required modules must be for 490# that OS too. 491# If a module is built for 32-bit, the required modules must be 32-bit too; 492# Otherwise if the module is an exectuable or shared library, 493# the required modules must be 64-bit; 494# otherwise we require both 64-bit and 32-bit variant, if one exists. 495$(foreach m,$(ALL_MODULES),\ 496 $(eval r := $(ALL_MODULES.$(m).REQUIRED))\ 497 $(if $(r),\ 498 $(if $(ALL_MODULES.$(m).FOR_HOST_CROSS),\ 499 $(eval r := $(addprefix host_cross_,$(r))))\ 500 $(if $(ALL_MODULES.$(m).FOR_2ND_ARCH),\ 501 $(eval r_r := $(call get-32-bit-modules-if-we-can,$(r))),\ 502 $(if $(filter EXECUTABLES SHARED_LIBRARIES NATIVE_TESTS,$(ALL_MODULES.$(m).CLASS)),\ 503 $(eval r_r := $(r)),\ 504 $(eval r_r := $(r) $(call get-32-bit-modules,$(r)))\ 505 )\ 506 )\ 507 $(eval ALL_MODULES.$(m).REQUIRED := $(strip $(r_r)))\ 508 )\ 509) 510r_r := 511 512define add-required-deps 513$(1): | $(2) 514endef 515 516# Use a normal dependency instead of an order-only dependency when installing 517# host dynamic binaries so that the timestamp of the final binary always 518# changes, even if the toc optimization has skipped relinking the binary 519# and its dependant shared libraries. 520define add-required-host-so-deps 521$(1): $(2) 522endef 523 524$(foreach m,$(ALL_MODULES), \ 525 $(eval r := $(ALL_MODULES.$(m).REQUIRED)) \ 526 $(if $(r), \ 527 $(eval r := $(call module-installed-files,$(r))) \ 528 $(eval t_m := $(filter $(TARGET_OUT_ROOT)/%, $(ALL_MODULES.$(m).INSTALLED))) \ 529 $(eval h_m := $(filter $(HOST_OUT)/%, $(ALL_MODULES.$(m).INSTALLED))) \ 530 $(eval hc_m := $(filter $(HOST_CROSS_OUT)/%, $(ALL_MODULES.$(m).INSTALLED))) \ 531 $(eval t_r := $(filter $(TARGET_OUT_ROOT)/%, $(r))) \ 532 $(eval h_r := $(filter $(HOST_OUT)/%, $(r))) \ 533 $(eval hc_r := $(filter $(HOST_CROSS_OUT)/%, $(r))) \ 534 $(eval t_m := $(filter-out $(t_r), $(t_m))) \ 535 $(eval h_m := $(filter-out $(h_r), $(h_m))) \ 536 $(eval hc_m := $(filter-out $(hc_r), $(hc_m))) \ 537 $(if $(t_m), $(eval $(call add-required-deps, $(t_m),$(t_r)))) \ 538 $(if $(h_m), $(eval $(call add-required-deps, $(h_m),$(h_r)))) \ 539 $(if $(hc_m), $(eval $(call add-required-deps, $(hc_m),$(hc_r)))) \ 540 ) \ 541 ) 542 543t_m := 544h_m := 545hc_m := 546t_r := 547h_r := 548hc_r := 549 550# Establish the dependecies on the shared libraries. 551# It also adds the shared library module names to ALL_MODULES.$(m).REQUIRED, 552# so they can be expanded to product_MODULES later. 553# $(1): TARGET_ or HOST_ or HOST_CROSS_. 554# $(2): non-empty for 2nd arch. 555# $(3): non-empty for host cross compile. 556define resolve-shared-libs-depes 557$(foreach m,$($(if $(2),$($(1)2ND_ARCH_VAR_PREFIX))$(1)DEPENDENCIES_ON_SHARED_LIBRARIES),\ 558 $(eval p := $(subst :,$(space),$(m)))\ 559 $(eval mod := $(firstword $(p)))\ 560 $(eval deps := $(subst $(comma),$(space),$(lastword $(p))))\ 561 $(eval root := $(1)OUT$(if $(call streq,$(1),TARGET_),_ROOT))\ 562 $(if $(2),$(eval deps := $(addsuffix $($(1)2ND_ARCH_MODULE_SUFFIX),$(deps))))\ 563 $(if $(3),$(eval deps := $(addprefix host_cross_,$(deps))))\ 564 $(eval r := $(filter $($(root))/%,$(call module-installed-files,\ 565 $(deps))))\ 566 $(if $(filter $(1),HOST_),\ 567 $(eval $(call add-required-host-so-deps,$(word 2,$(p)),$(r))),\ 568 $(eval $(call add-required-deps,$(word 2,$(p)),$(r))))\ 569 $(eval ALL_MODULES.$(mod).REQUIRED += $(deps))) 570endef 571 572$(call resolve-shared-libs-depes,TARGET_) 573ifdef TARGET_2ND_ARCH 574$(call resolve-shared-libs-depes,TARGET_,true) 575endif 576$(call resolve-shared-libs-depes,HOST_) 577ifdef HOST_2ND_ARCH 578$(call resolve-shared-libs-depes,HOST_,true) 579endif 580ifdef HOST_CROSS_OS 581$(call resolve-shared-libs-depes,HOST_CROSS_,,true) 582endif 583 584m := 585r := 586p := 587deps := 588add-required-deps := 589 590################################################################################ 591# Link type checking 592# 593# ALL_LINK_TYPES contains a list of all link type prefixes (generally one per 594# module, but APKs can "link" to both java and native code). The link type 595# prefix consists of all the information needed by intermediates-dir-for: 596# 597# LINK_TYPE:TARGET:_:2ND:STATIC_LIBRARIES:libfoo 598# 599# 1: LINK_TYPE literal 600# 2: prefix 601# - TARGET 602# - HOST 603# - HOST_CROSS 604# - AUX-<variant-name> 605# 3: Whether to use the common intermediates directory or not 606# - _ 607# - COMMON 608# 4: Whether it's the second arch or not 609# - _ 610# - 2ND_ 611# 5: Module Class 612# - STATIC_LIBRARIES 613# - SHARED_LIBRARIES 614# - ... 615# 6: Module Name 616# 617# Then fields under that are separated by a period and the field name: 618# - TYPE: the link types for this module 619# - MAKEFILE: Where this module was defined 620# - BUILT: The built module location 621# - DEPS: the link type prefixes for the module's dependencies 622# - ALLOWED: the link types to allow in this module's dependencies 623# - WARN: the link types to warn about in this module's dependencies 624# 625# All of the dependency link types not listed in ALLOWED or WARN will become 626# errors. 627################################################################################ 628 629link_type_error := 630 631define link-type-prefix-base 632$(word 2,$(subst :,$(space),$(1))) 633endef 634define link-type-prefix 635$(if $(filter AUX-%,$(link-type-prefix-base)),$(patsubst AUX-%,AUX,$(link-type-prefix-base)),$(link-type-prefix-base)) 636endef 637define link-type-aux-variant 638$(if $(filter AUX-%,$(link-type-prefix-base)),$(patsubst AUX-%,%,$(link-type-prefix-base))) 639endef 640define link-type-common 641$(patsubst _,,$(word 3,$(subst :,$(space),$(1)))) 642endef 643define link-type-2ndarchprefix 644$(patsubst _,,$(word 4,$(subst :,$(space),$(1)))) 645endef 646define link-type-class 647$(word 5,$(subst :,$(space),$(1))) 648endef 649define link-type-name 650$(word 6,$(subst :,$(space),$(1))) 651endef 652define link-type-os 653$(strip $(eval _p := $(link-type-prefix))\ 654 $(if $(filter HOST HOST_CROSS,$(_p)),\ 655 $($(_p)_OS),\ 656 $(if $(filter AUX,$(_p)),AUX,android))) 657endef 658define link-type-arch 659$($(link-type-prefix)_$(link-type-2ndarchprefix)ARCH) 660endef 661define link-type-name-variant 662$(link-type-name) ($(link-type-class) $(link-type-os)-$(link-type-arch)) 663endef 664 665# $(1): the prefix of the module doing the linking 666# $(2): the prefix of the linked module 667define link-type-warning 668$(shell $(call echo-warning,$($(1).MAKEFILE),"$(call link-type-name,$(1)) ($($(1).TYPE)) should not link against $(call link-type-name,$(2)) ($(3))")) 669endef 670 671# $(1): the prefix of the module doing the linking 672# $(2): the prefix of the linked module 673define link-type-error 674$(shell $(call echo-error,$($(1).MAKEFILE),"$(call link-type-name,$(1)) ($($(1).TYPE)) can not link against $(call link-type-name,$(2)) ($(3))"))\ 675$(eval link_type_error := true) 676endef 677 678link-type-missing := 679ifneq ($(ALLOW_MISSING_DEPENDENCIES),true) 680 # Print an error message if the linked-to module is missing 681 # $(1): the prefix of the module doing the linking 682 # $(2): the prefix of the missing module 683 define link-type-missing 684 $(shell $(call echo-error,$($(1).MAKEFILE),"$(call link-type-name-variant,$(1)) missing $(call link-type-name-variant,$(2))"))\ 685 $(eval available_variants := $(filter %:$(call link-type-name,$(2)),$(ALL_LINK_TYPES)))\ 686 $(if $(available_variants),\ 687 $(info Available variants:)\ 688 $(foreach v,$(available_variants),$(info $(space)$(space)$(call link-type-name-variant,$(v)))))\ 689 $(info You can set ALLOW_MISSING_DEPENDENCIES=true in your environment if this is intentional, but that may defer real problems until later in the build.)\ 690 $(eval link_type_error := true) 691 endef 692else 693 define link-type-missing 694 $(eval $$(1).MISSING := true) 695 endef 696endif 697 698# Verify that $(1) can link against $(2) 699# Both $(1) and $(2) are the link type prefix defined above 700define verify-link-type 701$(foreach t,$($(2).TYPE),\ 702 $(if $(filter-out $($(1).ALLOWED),$(t)),\ 703 $(if $(filter $(t),$($(1).WARN)),\ 704 $(call link-type-warning,$(1),$(2),$(t)),\ 705 $(call link-type-error,$(1),$(2),$(t))))) 706endef 707 708# TODO: Verify all branches/configs have reasonable warnings/errors, and remove 709# these overrides 710link-type-missing = $(eval $$(1).MISSING := true) 711verify-link-type = $(eval $$(1).MISSING := true) 712 713$(foreach lt,$(ALL_LINK_TYPES),\ 714 $(foreach d,$($(lt).DEPS),\ 715 $(if $($(d).TYPE),\ 716 $(call verify-link-type,$(lt),$(d)),\ 717 $(call link-type-missing,$(lt),$(d))))) 718 719ifdef link_type_error 720 $(error exiting from previous errors) 721endif 722 723# The intermediate filename for link type rules 724# 725# APPS are special -- they have up to three different rules: 726# 1. The COMMON rule for Java libraries 727# 2. The jni_link_type rule for embedded native code 728# 3. The 2ND_jni_link_type for the second architecture native code 729define link-type-file 730$(eval _ltf_aux_variant:=$(link-type-aux-variant))\ 731$(if $(_ltf_aux_variant),$(call aux-variant-load-env,$(_ltf_aux_variant)))\ 732$(call intermediates-dir-for,$(link-type-class),$(link-type-name),$(filter AUX HOST HOST_CROSS,$(link-type-prefix)),$(link-type-common),$(link-type-2ndarchprefix),$(filter HOST_CROSS,$(link-type-prefix)))/$(if $(filter APPS,$(link-type-class)),$(if $(link-type-common),,$(link-type-2ndarchprefix)jni_))link_type\ 733$(if $(_ltf_aux_variant),$(call aux-variant-load-env,none))\ 734$(eval _ltf_aux_variant:=) 735endef 736 737# Write out the file-based link_type rules for the ALLOW_MISSING_DEPENDENCIES 738# case. We always need to write the file for mm to work, but only need to 739# check it if we weren't able to check it when reading the Android.mk files. 740define link-type-file-rule 741my_link_type_deps := $(foreach l,$($(1).DEPS),$(call link-type-file,$(l))) 742my_link_type_file := $(call link-type-file,$(1)) 743$($(1).BUILT): | $$(my_link_type_file) 744$$(my_link_type_file): PRIVATE_DEPS := $$(my_link_type_deps) 745ifeq ($($(1).MISSING),true) 746$$(my_link_type_file): $(CHECK_LINK_TYPE) 747endif 748$$(my_link_type_file): $$(my_link_type_deps) 749 @echo Check module type: $$@ 750 $$(hide) mkdir -p $$(dir $$@) && rm -f $$@ 751ifeq ($($(1).MISSING),true) 752 $$(hide) $(CHECK_LINK_TYPE) --makefile $($(1).MAKEFILE) --module $(link-type-name) \ 753 --type "$($(1).TYPE)" $(addprefix --allowed ,$($(1).ALLOWED)) \ 754 $(addprefix --warn ,$($(1).WARN)) $$(PRIVATE_DEPS) 755endif 756 $$(hide) echo "$($(1).TYPE)" >$$@ 757endef 758 759$(foreach lt,$(ALL_LINK_TYPES),\ 760 $(eval $(call link-type-file-rule,$(lt)))) 761 762# ------------------------------------------------------------------- 763# Figure out our module sets. 764# 765# Of the modules defined by the component makefiles, 766# determine what we actually want to build. 767 768########################################################### 769## Expand a module name list with REQUIRED modules 770########################################################### 771# $(1): The variable name that holds the initial module name list. 772# the variable will be modified to hold the expanded results. 773# $(2): The initial module name list. 774# Returns empty string (maybe with some whitespaces). 775define expand-required-modules 776$(eval _erm_new_modules := $(sort $(filter-out $($(1)),\ 777 $(foreach m,$(2),$(ALL_MODULES.$(m).REQUIRED)))))\ 778$(if $(_erm_new_modules),$(eval $(1) += $(_erm_new_modules))\ 779 $(call expand-required-modules,$(1),$(_erm_new_modules))) 780endef 781 782ifdef FULL_BUILD 783 # The base list of modules to build for this product is specified 784 # by the appropriate product definition file, which was included 785 # by product_config.mk. 786 product_MODULES := $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES) 787 # Filter out the overridden packages before doing expansion 788 product_MODULES := $(filter-out $(foreach p, $(product_MODULES), \ 789 $(PACKAGES.$(p).OVERRIDES)), $(product_MODULES)) 790 # Filter out executables as well 791 product_MODULES := $(filter-out $(foreach m, $(product_MODULES), \ 792 $(EXECUTABLES.$(m).OVERRIDES)), $(product_MODULES)) 793 794 # Resolve the :32 :64 module name 795 modules_32 := $(patsubst %:32,%,$(filter %:32, $(product_MODULES))) 796 modules_64 := $(patsubst %:64,%,$(filter %:64, $(product_MODULES))) 797 modules_rest := $(filter-out %:32 %:64,$(product_MODULES)) 798 # Note for 32-bit product, $(modules_32) and $(modules_64) will be 799 # added as their original module names. 800 product_MODULES := $(call get-32-bit-modules-if-we-can, $(modules_32)) 801 product_MODULES += $(modules_64) 802 # For the rest we add both 803 product_MODULES += $(call get-32-bit-modules, $(modules_rest)) 804 product_MODULES += $(modules_rest) 805 806 $(call expand-required-modules,product_MODULES,$(product_MODULES)) 807 808 product_FILES := $(call module-installed-files, $(product_MODULES)) 809 ifeq (0,1) 810 $(info product_FILES for $(TARGET_DEVICE) ($(INTERNAL_PRODUCT)):) 811 $(foreach p,$(product_FILES),$(info : $(p))) 812 $(error done) 813 endif 814else 815 # We're not doing a full build, and are probably only including 816 # a subset of the module makefiles. Don't try to build any modules 817 # requested by the product, because we probably won't have rules 818 # to build them. 819 product_FILES := 820endif 821 822eng_MODULES := $(sort \ 823 $(call get-tagged-modules,eng) \ 824 $(call module-installed-files, $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES_ENG)) \ 825 ) 826debug_MODULES := $(sort \ 827 $(call get-tagged-modules,debug) \ 828 $(call module-installed-files, $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES_DEBUG)) \ 829 ) 830tests_MODULES := $(sort \ 831 $(call get-tagged-modules,tests) \ 832 $(call module-installed-files, $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES_TESTS)) \ 833 ) 834 835# TODO: Remove the 3 places in the tree that use ALL_DEFAULT_INSTALLED_MODULES 836# and get rid of it from this list. 837modules_to_install := $(sort \ 838 $(ALL_DEFAULT_INSTALLED_MODULES) \ 839 $(product_FILES) \ 840 $(foreach tag,$(tags_to_install),$($(tag)_MODULES)) \ 841 $(CUSTOM_MODULES) \ 842 ) 843 844# Some packages may override others using LOCAL_OVERRIDES_PACKAGES. 845# Filter out (do not install) any overridden packages. 846overridden_packages := $(call get-package-overrides,$(modules_to_install)) 847ifdef overridden_packages 848# old_modules_to_install := $(modules_to_install) 849 modules_to_install := \ 850 $(filter-out $(foreach p,$(overridden_packages),$(p) %/$(p).apk %/$(p).odex %/$(p).vdex), \ 851 $(modules_to_install)) 852endif 853#$(error filtered out 854# $(filter-out $(modules_to_install),$(old_modules_to_install))) 855 856# Don't include any GNU General Public License shared objects or static 857# libraries in SDK images. GPL executables (not static/dynamic libraries) 858# are okay if they don't link against any closed source libraries (directly 859# or indirectly) 860 861# It's ok (and necessary) to build the host tools, but nothing that's 862# going to be installed on the target (including static libraries). 863 864ifdef is_sdk_build 865 target_gnu_MODULES := \ 866 $(filter \ 867 $(TARGET_OUT_INTERMEDIATES)/% \ 868 $(TARGET_OUT)/% \ 869 $(TARGET_OUT_DATA)/%, \ 870 $(sort $(call get-tagged-modules,gnu))) 871 target_gnu_MODULES := $(filter-out $(TARGET_OUT_EXECUTABLES)/%,$(target_gnu_MODULES)) 872 $(info Removing from sdk:)$(foreach d,$(target_gnu_MODULES),$(info : $(d))) 873 modules_to_install := \ 874 $(filter-out $(target_gnu_MODULES),$(modules_to_install)) 875 876 # Ensure every module listed in PRODUCT_PACKAGES* gets something installed 877 # TODO: Should we do this for all builds and not just the sdk? 878 dangling_modules := 879 $(foreach m, $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES), \ 880 $(if $(strip $(ALL_MODULES.$(m).INSTALLED) $(ALL_MODULES.$(m)$(TARGET_2ND_ARCH_MODULE_SUFFIX).INSTALLED)),,\ 881 $(eval dangling_modules += $(m)))) 882 ifneq ($(dangling_modules),) 883 $(warning: Modules '$(dangling_modules)' in PRODUCT_PACKAGES have nothing to install!) 884 endif 885 $(foreach m, $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES_DEBUG), \ 886 $(if $(strip $(ALL_MODULES.$(m).INSTALLED)),,\ 887 $(warning $(ALL_MODULES.$(m).MAKEFILE): Module '$(m)' in PRODUCT_PACKAGES_DEBUG has nothing to install!))) 888 $(foreach m, $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES_ENG), \ 889 $(if $(strip $(ALL_MODULES.$(m).INSTALLED)),,\ 890 $(warning $(ALL_MODULES.$(m).MAKEFILE): Module '$(m)' in PRODUCT_PACKAGES_ENG has nothing to install!))) 891 $(foreach m, $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES_TESTS), \ 892 $(if $(strip $(ALL_MODULES.$(m).INSTALLED)),,\ 893 $(warning $(ALL_MODULES.$(m).MAKEFILE): Module '$(m)' in PRODUCT_PACKAGES_TESTS has nothing to install!))) 894endif 895 896# build/core/Makefile contains extra stuff that we don't want to pollute this 897# top-level makefile with. It expects that ALL_DEFAULT_INSTALLED_MODULES 898# contains everything that's built during the current make, but it also further 899# extends ALL_DEFAULT_INSTALLED_MODULES. 900ALL_DEFAULT_INSTALLED_MODULES := $(modules_to_install) 901include $(BUILD_SYSTEM)/Makefile 902modules_to_install := $(sort $(ALL_DEFAULT_INSTALLED_MODULES)) 903ALL_DEFAULT_INSTALLED_MODULES := 904 905 906# These are additional goals that we build, in order to make sure that there 907# is as little code as possible in the tree that doesn't build. 908modules_to_check := $(foreach m,$(ALL_MODULES),$(ALL_MODULES.$(m).CHECKED)) 909 910# If you would like to build all goals, and not skip any intermediate 911# steps, you can pass the "all" modifier goal on the commandline. 912ifneq ($(filter all,$(MAKECMDGOALS)),) 913modules_to_check += $(foreach m,$(ALL_MODULES),$(ALL_MODULES.$(m).BUILT)) 914endif 915 916# for easier debugging 917modules_to_check := $(sort $(modules_to_check)) 918#$(error modules_to_check $(modules_to_check)) 919 920# ------------------------------------------------------------------- 921# This is used to to get the ordering right, you can also use these, 922# but they're considered undocumented, so don't complain if their 923# behavior changes. 924# An internal target that depends on all copied headers 925# (see copy_headers.make). Other targets that need the 926# headers to be copied first can depend on this target. 927.PHONY: all_copied_headers 928all_copied_headers: ; 929 930$(ALL_C_CPP_ETC_OBJECTS): | all_copied_headers 931 932# All the droid stuff, in directories 933.PHONY: files 934files: $(modules_to_install) \ 935 $(INSTALLED_ANDROID_INFO_TXT_TARGET) 936 937# ------------------------------------------------------------------- 938 939.PHONY: checkbuild 940checkbuild: $(modules_to_check) droid_targets 941 942ifeq (true,$(ANDROID_BUILD_EVERYTHING_BY_DEFAULT)) 943droid: checkbuild 944endif 945 946.PHONY: ramdisk 947ramdisk: $(INSTALLED_RAMDISK_TARGET) 948 949.PHONY: systemtarball 950systemtarball: $(INSTALLED_SYSTEMTARBALL_TARGET) 951 952.PHONY: boottarball 953boottarball: $(INSTALLED_BOOTTARBALL_TARGET) 954 955.PHONY: userdataimage 956userdataimage: $(INSTALLED_USERDATAIMAGE_TARGET) 957 958ifneq (,$(filter userdataimage, $(MAKECMDGOALS))) 959$(call dist-for-goals, userdataimage, $(BUILT_USERDATAIMAGE_TARGET)) 960endif 961 962.PHONY: userdatatarball 963userdatatarball: $(INSTALLED_USERDATATARBALL_TARGET) 964 965.PHONY: cacheimage 966cacheimage: $(INSTALLED_CACHEIMAGE_TARGET) 967 968.PHONY: bptimage 969bptimage: $(INSTALLED_BPTIMAGE_TARGET) 970 971.PHONY: vendorimage 972vendorimage: $(INSTALLED_VENDORIMAGE_TARGET) 973 974.PHONY: systemotherimage 975systemotherimage: $(INSTALLED_SYSTEMOTHERIMAGE_TARGET) 976 977.PHONY: bootimage 978bootimage: $(INSTALLED_BOOTIMAGE_TARGET) 979 980.PHONY: vbmetaimage 981vbmetaimage: $(INSTALLED_VBMETAIMAGE_TARGET) 982 983.PHONY: auxiliary 984auxiliary: $(INSTALLED_AUX_TARGETS) 985 986# Build files and then package it into the rom formats 987.PHONY: droidcore 988droidcore: files \ 989 systemimage \ 990 $(INSTALLED_BOOTIMAGE_TARGET) \ 991 $(INSTALLED_RECOVERYIMAGE_TARGET) \ 992 $(INSTALLED_VBMETAIMAGE_TARGET) \ 993 $(INSTALLED_USERDATAIMAGE_TARGET) \ 994 $(INSTALLED_CACHEIMAGE_TARGET) \ 995 $(INSTALLED_BPTIMAGE_TARGET) \ 996 $(INSTALLED_VENDORIMAGE_TARGET) \ 997 $(INSTALLED_SYSTEMOTHERIMAGE_TARGET) \ 998 $(INSTALLED_FILES_FILE) \ 999 $(INSTALLED_FILES_FILE_VENDOR) \ 1000 $(INSTALLED_FILES_FILE_SYSTEMOTHER) 1001 1002# dist_files only for putting your library into the dist directory with a full build. 1003.PHONY: dist_files 1004 1005ifneq ($(TARGET_BUILD_APPS),) 1006 # If this build is just for apps, only build apps and not the full system by default. 1007 1008 unbundled_build_modules := 1009 ifneq ($(filter all,$(TARGET_BUILD_APPS)),) 1010 # If they used the magic goal "all" then build all apps in the source tree. 1011 unbundled_build_modules := $(foreach m,$(sort $(ALL_MODULES)),$(if $(filter APPS,$(ALL_MODULES.$(m).CLASS)),$(m))) 1012 else 1013 unbundled_build_modules := $(TARGET_BUILD_APPS) 1014 endif 1015 1016 # Dist the installed files if they exist. 1017 apps_only_installed_files := $(foreach m,$(unbundled_build_modules),$(ALL_MODULES.$(m).INSTALLED)) 1018 $(call dist-for-goals,apps_only, $(apps_only_installed_files)) 1019 # For uninstallable modules such as static Java library, we have to dist the built file, 1020 # as <module_name>.<suffix> 1021 apps_only_dist_built_files := $(foreach m,$(unbundled_build_modules),$(if $(ALL_MODULES.$(m).INSTALLED),,\ 1022 $(if $(ALL_MODULES.$(m).BUILT),$(ALL_MODULES.$(m).BUILT):$(m)$(suffix $(ALL_MODULES.$(m).BUILT)))\ 1023 $(if $(ALL_MODULES.$(m).AAR),$(ALL_MODULES.$(m).AAR):$(m).aar)\ 1024 )) 1025 $(call dist-for-goals,apps_only, $(apps_only_dist_built_files)) 1026 1027 ifeq ($(EMMA_INSTRUMENT),true) 1028 ifeq ($(ANDROID_COMPILE_WITH_JACK),false) 1029 $(JACOCO_REPORT_CLASSES_ALL) : $(apps_only_installed_files) 1030 $(call dist-for-goals,apps_only, $(JACOCO_REPORT_CLASSES_ALL)) 1031 else 1032 $(EMMA_META_ZIP) : $(apps_only_installed_files) 1033 $(call dist-for-goals,apps_only, $(EMMA_META_ZIP)) 1034 endif 1035 endif 1036 1037 $(PROGUARD_DICT_ZIP) : $(apps_only_installed_files) 1038 $(call dist-for-goals,apps_only, $(PROGUARD_DICT_ZIP)) 1039 1040 $(SYMBOLS_ZIP) : $(apps_only_installed_files) 1041 $(call dist-for-goals,apps_only, $(SYMBOLS_ZIP)) 1042 1043 $(COVERAGE_ZIP) : $(apps_only_installed_files) 1044 $(call dist-for-goals,apps_only, $(COVERAGE_ZIP)) 1045 1046.PHONY: apps_only 1047apps_only: $(unbundled_build_modules) 1048 1049droid_targets: apps_only 1050 1051# Combine the NOTICE files for a apps_only build 1052$(eval $(call combine-notice-files, html, \ 1053 $(target_notice_file_txt), \ 1054 $(target_notice_file_html_or_xml), \ 1055 "Notices for files for apps:", \ 1056 $(TARGET_OUT_NOTICE_FILES), \ 1057 $(apps_only_installed_files))) 1058 1059 1060else # TARGET_BUILD_APPS 1061 $(call dist-for-goals, droidcore, \ 1062 $(INTERNAL_UPDATE_PACKAGE_TARGET) \ 1063 $(INTERNAL_OTA_PACKAGE_TARGET) \ 1064 $(BUILT_OTATOOLS_PACKAGE) \ 1065 $(SYMBOLS_ZIP) \ 1066 $(COVERAGE_ZIP) \ 1067 $(INSTALLED_FILES_FILE) \ 1068 $(INSTALLED_FILES_FILE_VENDOR) \ 1069 $(INSTALLED_FILES_FILE_SYSTEMOTHER) \ 1070 $(INSTALLED_BUILD_PROP_TARGET) \ 1071 $(BUILT_TARGET_FILES_PACKAGE) \ 1072 $(INSTALLED_ANDROID_INFO_TXT_TARGET) \ 1073 $(INSTALLED_RAMDISK_TARGET) \ 1074 ) 1075 1076 # Put a copy of the radio/bootloader files in the dist dir. 1077 $(foreach f,$(INSTALLED_RADIOIMAGE_TARGET), \ 1078 $(call dist-for-goals, droidcore, $(f))) 1079 1080 ifneq ($(ANDROID_BUILD_EMBEDDED),true) 1081 ifneq ($(TARGET_BUILD_PDK),true) 1082 $(call dist-for-goals, droidcore, \ 1083 $(APPS_ZIP) \ 1084 $(INTERNAL_EMULATOR_PACKAGE_TARGET) \ 1085 $(PACKAGE_STATS_FILE) \ 1086 ) 1087 endif 1088 endif 1089 1090 ifeq ($(EMMA_INSTRUMENT),true) 1091 ifeq ($(ANDROID_COMPILE_WITH_JACK),false) 1092 $(JACOCO_REPORT_CLASSES_ALL) : $(INSTALLED_SYSTEMIMAGE) 1093 $(call dist-for-goals, dist_files, $(JACOCO_REPORT_CLASSES_ALL)) 1094 else 1095 $(EMMA_META_ZIP) : $(INSTALLED_SYSTEMIMAGE) 1096 $(call dist-for-goals, dist_files, $(EMMA_META_ZIP)) 1097 endif 1098 endif 1099 1100# Building a full system-- the default is to build droidcore 1101droid_targets: droidcore dist_files 1102 1103endif # TARGET_BUILD_APPS 1104 1105.PHONY: docs 1106docs: $(ALL_DOCS) 1107 1108.PHONY: sdk 1109ALL_SDK_TARGETS := $(INTERNAL_SDK_TARGET) 1110sdk: $(ALL_SDK_TARGETS) 1111$(call dist-for-goals,sdk win_sdk, \ 1112 $(ALL_SDK_TARGETS) \ 1113 $(SYMBOLS_ZIP) \ 1114 $(COVERAGE_ZIP) \ 1115 $(INSTALLED_BUILD_PROP_TARGET) \ 1116) 1117 1118# umbrella targets to assit engineers in verifying builds 1119.PHONY: java native target host java-host java-target native-host native-target \ 1120 java-host-tests java-target-tests native-host-tests native-target-tests \ 1121 java-tests native-tests host-tests target-tests tests java-dex 1122# some synonyms 1123.PHONY: host-java target-java host-native target-native \ 1124 target-java-tests target-native-tests 1125host-java : java-host 1126target-java : java-target 1127host-native : native-host 1128target-native : native-target 1129target-java-tests : java-target-tests 1130target-native-tests : native-target-tests 1131tests : host-tests target-tests 1132 1133# Phony target to run all java compilations that use javac instead of jack. 1134.PHONY: javac-check 1135 1136ifneq (,$(filter samplecode, $(MAKECMDGOALS))) 1137.PHONY: samplecode 1138sample_MODULES := $(sort $(call get-tagged-modules,samples)) 1139sample_APKS_DEST_PATH := $(TARGET_COMMON_OUT_ROOT)/samples 1140sample_APKS_COLLECTION := \ 1141 $(foreach module,$(sample_MODULES),$(sample_APKS_DEST_PATH)/$(notdir $(module))) 1142$(foreach module,$(sample_MODULES),$(eval $(call \ 1143 copy-one-file,$(module),$(sample_APKS_DEST_PATH)/$(notdir $(module))))) 1144sample_ADDITIONAL_INSTALLED := \ 1145 $(filter-out $(modules_to_install) $(modules_to_check),$(sample_MODULES)) 1146samplecode: $(sample_APKS_COLLECTION) 1147 @echo "Collect sample code apks: $^" 1148 # remove apks that are not intended to be installed. 1149 rm -f $(sample_ADDITIONAL_INSTALLED) 1150endif # samplecode in $(MAKECMDGOALS) 1151 1152.PHONY: findbugs 1153findbugs: $(INTERNAL_FINDBUGS_HTML_TARGET) $(INTERNAL_FINDBUGS_XML_TARGET) 1154 1155#xxx scrape this from ALL_MODULE_NAME_TAGS 1156.PHONY: modules 1157modules: 1158 @echo "Available sub-modules:" 1159 @echo "$(call module-names-for-tag-list,$(ALL_MODULE_TAGS))" | \ 1160 tr -s ' ' '\n' | sort -u | $(COLUMN) 1161 1162.PHONY: nothing 1163nothing: 1164 @echo Successfully read the makefiles. 1165 1166.PHONY: tidy_only 1167tidy_only: 1168 @echo Successfully make tidy_only. 1169 1170ndk: $(SOONG_OUT_DIR)/ndk.timestamp 1171.PHONY: ndk 1172 1173endif # KATI 1174