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