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