1ifndef KATI 2$(warning Calling make directly is no longer supported.) 3$(warning Either use 'envsetup.sh; m' or 'build/soong/soong_ui.bash --make-mode') 4$(error done) 5endif 6 7$(info [1/1] initializing build system ...) 8 9# Absolute path of the present working direcotry. 10# This overrides the shell variable $PWD, which does not necessarily points to 11# the top of the source tree, for example when "make -C" is used in m/mm/mmm. 12PWD := $(shell pwd) 13 14# This is the default target. It must be the first declared target. 15.PHONY: droid 16DEFAULT_GOAL := droid 17$(DEFAULT_GOAL): droid_targets 18 19.PHONY: droid_targets 20droid_targets: 21 22# Set up various standard variables based on configuration 23# and host information. 24include build/make/core/config.mk 25 26ifneq ($(filter $(dont_bother_goals), $(MAKECMDGOALS)),) 27dont_bother := true 28endif 29 30.KATI_READONLY := SOONG_CONFIG_NAMESPACES 31.KATI_READONLY := $(foreach n,$(SOONG_CONFIG_NAMESPACES),SOONG_CONFIG_$(n)) 32.KATI_READONLY := $(foreach n,$(SOONG_CONFIG_NAMESPACES),$(foreach k,$(SOONG_CONFIG_$(n)),SOONG_CONFIG_$(n)_$(k))) 33 34include $(SOONG_MAKEVARS_MK) 35 36YACC :=$= $(BISON) -d 37 38include $(BUILD_SYSTEM)/clang/config.mk 39 40# Write the build number to a file so it can be read back in 41# without changing the command line every time. Avoids rebuilds 42# when using ninja. 43$(shell mkdir -p $(SOONG_OUT_DIR) && \ 44 echo -n $(BUILD_NUMBER) > $(SOONG_OUT_DIR)/build_number.tmp; \ 45 if ! cmp -s $(SOONG_OUT_DIR)/build_number.tmp $(SOONG_OUT_DIR)/build_number.txt; then \ 46 mv $(SOONG_OUT_DIR)/build_number.tmp $(SOONG_OUT_DIR)/build_number.txt; \ 47 else \ 48 rm $(SOONG_OUT_DIR)/build_number.tmp; \ 49 fi) 50BUILD_NUMBER_FILE := $(SOONG_OUT_DIR)/build_number.txt 51.KATI_READONLY := BUILD_NUMBER_FILE 52$(KATI_obsolete_var BUILD_NUMBER,See https://android.googlesource.com/platform/build/+/master/Changes.md#BUILD_NUMBER) 53$(BUILD_NUMBER_FILE): 54 touch $@ 55 56DATE_FROM_FILE := date -d @$(BUILD_DATETIME_FROM_FILE) 57.KATI_READONLY := DATE_FROM_FILE 58 59# Pick a reasonable string to use to identify files. 60ifeq ($(strip $(HAS_BUILD_NUMBER)),false) 61 # BUILD_NUMBER has a timestamp in it, which means that 62 # it will change every time. Pick a stable value. 63 FILE_NAME_TAG := eng.$(BUILD_USERNAME) 64else 65 FILE_NAME_TAG := $(file <$(BUILD_NUMBER_FILE)) 66endif 67.KATI_READONLY := FILE_NAME_TAG 68 69# Make an empty directory, which can be used to make empty jars 70EMPTY_DIRECTORY := $(OUT_DIR)/empty 71$(shell mkdir -p $(EMPTY_DIRECTORY) && rm -rf $(EMPTY_DIRECTORY)/*) 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# CTS-Instant-specific config 84-include test/suite_harness/tools/cts-instant-tradefed/build/config.mk 85# MTS-specific config. 86-include test/mts/tools/build/config.mk 87# VTS-Core-specific config. 88-include test/vts/tools/vts-core-tradefed/build/config.mk 89# CSUITE-specific config. 90-include test/app_compat/csuite/tools/build/config.mk 91# CATBox-specific config. 92-include test/catbox/tools/build/config.mk 93# CTS-Root-specific config. 94-include test/cts-root/tools/build/config.mk 95 96# Clean rules 97.PHONY: clean-dex-files 98clean-dex-files: 99 $(hide) find $(OUT_DIR) -name "*.dex" | xargs rm -f 100 $(hide) for i in `find $(OUT_DIR) -name "*.jar" -o -name "*.apk"` ; do ((unzip -l $$i 2> /dev/null | \ 101 grep -q "\.dex$$" && rm -f $$i) || continue ) ; done 102 @echo "All dex files and archives containing dex files have been removed." 103 104# Include the google-specific config 105-include vendor/google/build/config.mk 106 107# These are the modifier targets that don't do anything themselves, but 108# change the behavior of the build. 109# (must be defined before including definitions.make) 110INTERNAL_MODIFIER_TARGETS := all 111 112# EMMA_INSTRUMENT_STATIC merges the static jacoco library to each 113# jacoco-enabled module. 114ifeq (true,$(EMMA_INSTRUMENT_STATIC)) 115EMMA_INSTRUMENT := true 116endif 117 118ifeq (true,$(EMMA_INSTRUMENT)) 119# Adding the jacoco library can cause the inclusion of 120# some typically banned classes 121# So if the user didn't specify SKIP_BOOT_JARS_CHECK, enable it here 122ifndef SKIP_BOOT_JARS_CHECK 123SKIP_BOOT_JARS_CHECK := true 124endif 125endif 126 127ifdef TARGET_ARCH_SUITE 128 # TODO(b/175577370): Enable this error. 129 # $(error TARGET_ARCH_SUITE is not supported in kati/make builds) 130endif 131 132# ADDITIONAL_<partition>_PROPERTIES are properties that are determined by the 133# build system itself. Don't let it be defined from outside of the core build 134# system like Android.mk or <product>.mk files. 135_additional_prop_var_names := \ 136 ADDITIONAL_SYSTEM_PROPERTIES \ 137 ADDITIONAL_VENDOR_PROPERTIES \ 138 ADDITIONAL_ODM_PROPERTIES \ 139 ADDITIONAL_PRODUCT_PROPERTIES 140 141$(foreach name, $(_additional_prop_var_names),\ 142 $(if $($(name)),\ 143 $(error $(name) must not set before here. $($(name)))\ 144 ,)\ 145 $(eval $(name) :=)\ 146) 147_additional_prop_var_names := 148 149$(KATI_obsolete_var ADDITIONAL_BUILD_PROPERTIES, Please use ADDITIONAL_SYSTEM_PROPERTIES) 150 151# 152# ----------------------------------------------------------------- 153# Add the product-defined properties to the build properties. 154ifdef PRODUCT_SHIPPING_API_LEVEL 155ADDITIONAL_SYSTEM_PROPERTIES += \ 156 ro.product.first_api_level=$(PRODUCT_SHIPPING_API_LEVEL) 157endif 158 159ifneq ($(BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED), true) 160 ADDITIONAL_SYSTEM_PROPERTIES += $(PRODUCT_PROPERTY_OVERRIDES) 161else 162 ifndef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE 163 ADDITIONAL_SYSTEM_PROPERTIES += $(PRODUCT_PROPERTY_OVERRIDES) 164 endif 165endif 166 167 168# Bring in standard build system definitions. 169include $(BUILD_SYSTEM)/definitions.mk 170 171ifneq ($(filter user userdebug eng,$(MAKECMDGOALS)),) 172$(info ***************************************************************) 173$(info ***************************************************************) 174$(info Do not pass '$(filter user userdebug eng,$(MAKECMDGOALS))' on \ 175 the make command line.) 176$(info Set TARGET_BUILD_VARIANT in buildspec.mk, or use lunch or) 177$(info choosecombo.) 178$(info ***************************************************************) 179$(info ***************************************************************) 180$(error stopping) 181endif 182 183# These are the valid values of TARGET_BUILD_VARIANT. 184INTERNAL_VALID_VARIANTS := user userdebug eng 185ifneq ($(filter-out $(INTERNAL_VALID_VARIANTS),$(TARGET_BUILD_VARIANT)),) 186$(info ***************************************************************) 187$(info ***************************************************************) 188$(info Invalid variant: $(TARGET_BUILD_VARIANT)) 189$(info Valid values are: $(INTERNAL_VALID_VARIANTS)) 190$(info ***************************************************************) 191$(info ***************************************************************) 192$(error stopping) 193endif 194 195# ----------------------------------------------------------------- 196# PDK builds are no longer supported, this is always platform 197TARGET_BUILD_JAVA_SUPPORT_LEVEL :=$= platform 198 199# ----------------------------------------------------------------- 200 201ADDITIONAL_SYSTEM_PROPERTIES += ro.treble.enabled=${PRODUCT_FULL_TREBLE} 202 203$(KATI_obsolete_var PRODUCT_FULL_TREBLE,\ 204 Code should be written to work regardless of a device being Treble or \ 205 variables like PRODUCT_SEPOLICY_SPLIT should be used until that is \ 206 possible.) 207 208# Sets ro.actionable_compatible_property.enabled to know on runtime whether the 209# allowed list of actionable compatible properties is enabled or not. 210ADDITIONAL_SYSTEM_PROPERTIES += ro.actionable_compatible_property.enabled=true 211 212# Add the system server compiler filter if they are specified for the product. 213ifneq (,$(PRODUCT_SYSTEM_SERVER_COMPILER_FILTER)) 214ADDITIONAL_PRODUCT_PROPERTIES += dalvik.vm.systemservercompilerfilter=$(PRODUCT_SYSTEM_SERVER_COMPILER_FILTER) 215endif 216 217# Enable core platform API violation warnings on userdebug and eng builds. 218ifneq ($(TARGET_BUILD_VARIANT),user) 219ADDITIONAL_SYSTEM_PROPERTIES += persist.debug.dalvik.vm.core_platform_api_policy=just-warn 220endif 221 222# Define ro.sanitize.<name> properties for all global sanitizers. 223ADDITIONAL_SYSTEM_PROPERTIES += $(foreach s,$(SANITIZE_TARGET),ro.sanitize.$(s)=true) 224 225# Sets the default value of ro.postinstall.fstab.prefix to /system. 226# Device board config should override the value to /product when needed by: 227# 228# PRODUCT_PRODUCT_PROPERTIES += ro.postinstall.fstab.prefix=/product 229# 230# It then uses ${ro.postinstall.fstab.prefix}/etc/fstab.postinstall to 231# mount system_other partition. 232ADDITIONAL_SYSTEM_PROPERTIES += ro.postinstall.fstab.prefix=/system 233 234# ----------------------------------------------------------------- 235# ADDITIONAL_VENDOR_PROPERTIES will be installed in vendor/build.prop if 236# property_overrides_split_enabled is true. Otherwise it will be installed in 237# /system/build.prop 238ifdef BOARD_VNDK_VERSION 239 ifeq ($(BOARD_VNDK_VERSION),current) 240 ADDITIONAL_VENDOR_PROPERTIES := ro.vndk.version=$(PLATFORM_VNDK_VERSION) 241 else 242 ADDITIONAL_VENDOR_PROPERTIES := ro.vndk.version=$(BOARD_VNDK_VERSION) 243 endif 244endif 245 246# Add cpu properties for bionic and ART. 247ADDITIONAL_VENDOR_PROPERTIES += ro.bionic.arch=$(TARGET_ARCH) 248ADDITIONAL_VENDOR_PROPERTIES += ro.bionic.cpu_variant=$(TARGET_CPU_VARIANT_RUNTIME) 249ADDITIONAL_VENDOR_PROPERTIES += ro.bionic.2nd_arch=$(TARGET_2ND_ARCH) 250ADDITIONAL_VENDOR_PROPERTIES += ro.bionic.2nd_cpu_variant=$(TARGET_2ND_CPU_VARIANT_RUNTIME) 251 252ADDITIONAL_VENDOR_PROPERTIES += persist.sys.dalvik.vm.lib.2=libart.so 253ADDITIONAL_VENDOR_PROPERTIES += dalvik.vm.isa.$(TARGET_ARCH).variant=$(DEX2OAT_TARGET_CPU_VARIANT_RUNTIME) 254ifneq ($(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES),) 255 ADDITIONAL_VENDOR_PROPERTIES += dalvik.vm.isa.$(TARGET_ARCH).features=$(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) 256endif 257 258ifdef TARGET_2ND_ARCH 259 ADDITIONAL_VENDOR_PROPERTIES += dalvik.vm.isa.$(TARGET_2ND_ARCH).variant=$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT_RUNTIME) 260 ifneq ($($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES),) 261 ADDITIONAL_VENDOR_PROPERTIES += dalvik.vm.isa.$(TARGET_2ND_ARCH).features=$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) 262 endif 263endif 264 265# Although these variables are prefixed with TARGET_RECOVERY_, they are also needed under charger 266# mode (via libminui). 267ifdef TARGET_RECOVERY_DEFAULT_ROTATION 268ADDITIONAL_VENDOR_PROPERTIES += \ 269 ro.minui.default_rotation=$(TARGET_RECOVERY_DEFAULT_ROTATION) 270endif 271ifdef TARGET_RECOVERY_OVERSCAN_PERCENT 272ADDITIONAL_VENDOR_PROPERTIES += \ 273 ro.minui.overscan_percent=$(TARGET_RECOVERY_OVERSCAN_PERCENT) 274endif 275ifdef TARGET_RECOVERY_PIXEL_FORMAT 276ADDITIONAL_VENDOR_PROPERTIES += \ 277 ro.minui.pixel_format=$(TARGET_RECOVERY_PIXEL_FORMAT) 278endif 279 280ifdef PRODUCT_USE_DYNAMIC_PARTITIONS 281ADDITIONAL_VENDOR_PROPERTIES += \ 282 ro.boot.dynamic_partitions=$(PRODUCT_USE_DYNAMIC_PARTITIONS) 283endif 284 285ifdef PRODUCT_RETROFIT_DYNAMIC_PARTITIONS 286ADDITIONAL_VENDOR_PROPERTIES += \ 287 ro.boot.dynamic_partitions_retrofit=$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS) 288endif 289 290ifdef PRODUCT_SHIPPING_API_LEVEL 291ADDITIONAL_VENDOR_PROPERTIES += \ 292 ro.product.first_api_level=$(PRODUCT_SHIPPING_API_LEVEL) 293endif 294 295ifneq ($(TARGET_BUILD_VARIANT),user) 296 ifdef PRODUCT_SET_DEBUGFS_RESTRICTIONS 297 ADDITIONAL_VENDOR_PROPERTIES += \ 298 ro.product.debugfs_restrictions.enabled=$(PRODUCT_SET_DEBUGFS_RESTRICTIONS) 299 endif 300endif 301 302# Vendors with GRF must define BOARD_SHIPPING_API_LEVEL for the vendor API level. 303# This must not be defined for the non-GRF devices. 304ifdef BOARD_SHIPPING_API_LEVEL 305ADDITIONAL_VENDOR_PROPERTIES += \ 306 ro.board.first_api_level=$(BOARD_SHIPPING_API_LEVEL) 307 308# To manually set the vendor API level of the vendor modules, BOARD_API_LEVEL can be used. 309# The values of the GRF properties will be verified by post_process_props.py 310ifdef BOARD_API_LEVEL 311ADDITIONAL_VENDOR_PROPERTIES += \ 312 ro.board.api_level=$(BOARD_API_LEVEL) 313endif 314endif 315 316# Set build prop. This prop is read by ota_from_target_files when generating OTA, 317# to decide if VABC should be disabled. 318ifeq ($(BOARD_DONT_USE_VABC_OTA),true) 319ADDITIONAL_VENDOR_PROPERTIES += \ 320 ro.vendor.build.dont_use_vabc=true 321endif 322 323ADDITIONAL_VENDOR_PROPERTIES += \ 324 ro.vendor.build.security_patch=$(VENDOR_SECURITY_PATCH) \ 325 ro.product.board=$(TARGET_BOOTLOADER_BOARD_NAME) \ 326 ro.board.platform=$(TARGET_BOARD_PLATFORM) \ 327 ro.hwui.use_vulkan=$(TARGET_USES_VULKAN) 328 329ifdef TARGET_SCREEN_DENSITY 330ADDITIONAL_VENDOR_PROPERTIES += \ 331 ro.sf.lcd_density=$(TARGET_SCREEN_DENSITY) 332endif 333 334ifdef AB_OTA_UPDATER 335ADDITIONAL_VENDOR_PROPERTIES += \ 336 ro.build.ab_update=$(AB_OTA_UPDATER) 337endif 338 339# Set ro.product.vndk.version to know the VNDK version required by product 340# modules. It uses the version in PRODUCT_PRODUCT_VNDK_VERSION. If the value 341# is "current", use PLATFORM_VNDK_VERSION. 342ifdef PRODUCT_PRODUCT_VNDK_VERSION 343ifeq ($(PRODUCT_PRODUCT_VNDK_VERSION),current) 344ADDITIONAL_PRODUCT_PROPERTIES += ro.product.vndk.version=$(PLATFORM_VNDK_VERSION) 345else 346ADDITIONAL_PRODUCT_PROPERTIES += ro.product.vndk.version=$(PRODUCT_PRODUCT_VNDK_VERSION) 347endif 348endif 349 350ADDITIONAL_PRODUCT_PROPERTIES += ro.build.characteristics=$(TARGET_AAPT_CHARACTERISTICS) 351 352ifeq ($(AB_OTA_UPDATER),true) 353ADDITIONAL_PRODUCT_PROPERTIES += ro.product.ab_ota_partitions=$(subst $(space),$(comma),$(AB_OTA_PARTITIONS)) 354endif 355 356# ----------------------------------------------------------------- 357### 358### In this section we set up the things that are different 359### between the build variants 360### 361 362is_sdk_build := 363 364ifneq ($(filter sdk win_sdk sdk_addon,$(MAKECMDGOALS)),) 365is_sdk_build := true 366endif 367 368## user/userdebug ## 369 370user_variant := $(filter user userdebug,$(TARGET_BUILD_VARIANT)) 371enable_target_debugging := true 372tags_to_install := 373ifneq (,$(user_variant)) 374 # Target is secure in user builds. 375 ADDITIONAL_SYSTEM_PROPERTIES += ro.secure=1 376 ADDITIONAL_SYSTEM_PROPERTIES += security.perf_harden=1 377 378 ifeq ($(user_variant),user) 379 ADDITIONAL_SYSTEM_PROPERTIES += ro.adb.secure=1 380 endif 381 382 ifeq ($(user_variant),userdebug) 383 # Pick up some extra useful tools 384 tags_to_install += debug 385 else 386 # Disable debugging in plain user builds. 387 enable_target_debugging := 388 endif 389 390 # Disallow mock locations by default for user builds 391 ADDITIONAL_SYSTEM_PROPERTIES += ro.allow.mock.location=0 392 393else # !user_variant 394 # Turn on checkjni for non-user builds. 395 ADDITIONAL_SYSTEM_PROPERTIES += ro.kernel.android.checkjni=1 396 # Set device insecure for non-user builds. 397 ADDITIONAL_SYSTEM_PROPERTIES += ro.secure=0 398 # Allow mock locations by default for non user builds 399 ADDITIONAL_SYSTEM_PROPERTIES += ro.allow.mock.location=1 400endif # !user_variant 401 402ifeq (true,$(strip $(enable_target_debugging))) 403 # Target is more debuggable and adbd is on by default 404 ADDITIONAL_SYSTEM_PROPERTIES += ro.debuggable=1 405 # Enable Dalvik lock contention logging. 406 ADDITIONAL_SYSTEM_PROPERTIES += dalvik.vm.lockprof.threshold=500 407else # !enable_target_debugging 408 # Target is less debuggable and adbd is off by default 409 ADDITIONAL_SYSTEM_PROPERTIES += ro.debuggable=0 410endif # !enable_target_debugging 411 412## eng ## 413 414ifeq ($(TARGET_BUILD_VARIANT),eng) 415tags_to_install := debug eng 416ifneq ($(filter ro.setupwizard.mode=ENABLED, $(call collapse-pairs, $(ADDITIONAL_SYSTEM_PROPERTIES))),) 417 # Don't require the setup wizard on eng builds 418 ADDITIONAL_SYSTEM_PROPERTIES := $(filter-out ro.setupwizard.mode=%,\ 419 $(call collapse-pairs, $(ADDITIONAL_SYSTEM_PROPERTIES))) \ 420 ro.setupwizard.mode=OPTIONAL 421endif 422ifndef is_sdk_build 423 # To speedup startup of non-preopted builds, don't verify or compile the boot image. 424 ADDITIONAL_SYSTEM_PROPERTIES += dalvik.vm.image-dex2oat-filter=extract 425endif 426endif 427 428## asan ## 429 430# Install some additional tools on ASAN builds IFF we are also installing debug tools 431ifneq ($(filter address,$(SANITIZE_TARGET)),) 432ifneq (,$(filter debug,$(tags_to_install))) 433 tags_to_install += asan 434endif 435endif 436 437## java coverage ## 438# Install additional tools on java coverage builds 439ifeq (true,$(EMMA_INSTRUMENT)) 440ifneq (,$(filter debug,$(tags_to_install))) 441 tags_to_install += java_coverage 442endif 443endif 444 445 446## sdk ## 447 448ifdef is_sdk_build 449 450# Detect if we want to build a repository for the SDK 451sdk_repo_goal := $(strip $(filter sdk_repo,$(MAKECMDGOALS))) 452MAKECMDGOALS := $(strip $(filter-out sdk_repo,$(MAKECMDGOALS))) 453 454ifneq ($(words $(sort $(filter-out $(INTERNAL_MODIFIER_TARGETS) checkbuild emulator_tests,$(MAKECMDGOALS)))),1) 455$(error The 'sdk' target may not be specified with any other targets) 456endif 457 458# TODO: this should be eng I think. Since the sdk is built from the eng 459# variant. 460tags_to_install := debug eng 461ADDITIONAL_SYSTEM_PROPERTIES += xmpp.auto-presence=true 462ADDITIONAL_SYSTEM_PROPERTIES += ro.config.nocheckin=yes 463else # !sdk 464endif 465 466BUILD_WITHOUT_PV := true 467 468ADDITIONAL_SYSTEM_PROPERTIES += net.bt.name=Android 469 470# ------------------------------------------------------------ 471# Define a function that, given a list of module tags, returns 472# non-empty if that module should be installed in /system. 473 474# For most goals, anything not tagged with the "tests" tag should 475# be installed in /system. 476define should-install-to-system 477$(if $(filter tests,$(1)),,true) 478endef 479 480ifdef is_sdk_build 481# For the sdk goal, anything with the "samples" tag should be 482# installed in /data even if that module also has "eng"/"debug"/"user". 483define should-install-to-system 484$(if $(filter samples tests,$(1)),,true) 485endef 486endif 487 488 489# If they only used the modifier goals (all, etc), we'll actually 490# build the default target. 491ifeq ($(filter-out $(INTERNAL_MODIFIER_TARGETS),$(MAKECMDGOALS)),) 492.PHONY: $(INTERNAL_MODIFIER_TARGETS) 493$(INTERNAL_MODIFIER_TARGETS): $(DEFAULT_GOAL) 494endif 495 496# 497# Typical build; include any Android.mk files we can find. 498# 499 500# Bring in dex_preopt.mk 501# This creates some modules so it needs to be included after 502# should-install-to-system is defined (in order for base_rules.mk to function 503# properly), but before readonly-final-product-vars is called. 504include $(BUILD_SYSTEM)/dex_preopt.mk 505 506# Strip and readonly a few more variables so they won't be modified. 507$(readonly-final-product-vars) 508ADDITIONAL_SYSTEM_PROPERTIES := $(strip $(ADDITIONAL_SYSTEM_PROPERTIES)) 509.KATI_READONLY := ADDITIONAL_SYSTEM_PROPERTIES 510ADDITIONAL_PRODUCT_PROPERTIES := $(strip $(ADDITIONAL_PRODUCT_PROPERTIES)) 511.KATI_READONLY := ADDITIONAL_PRODUCT_PROPERTIES 512 513ifneq ($(PRODUCT_ENFORCE_RRO_TARGETS),) 514ENFORCE_RRO_SOURCES := 515endif 516 517# Color-coded warnings including current module info 518# $(1): message to print 519define pretty-warning 520$(shell $(call echo-warning,$(LOCAL_MODULE_MAKEFILE),$(LOCAL_MODULE): $(1))) 521endef 522 523# Color-coded errors including current module info 524# $(1): message to print 525define pretty-error 526$(shell $(call echo-error,$(LOCAL_MODULE_MAKEFILE),$(LOCAL_MODULE): $(1))) 527$(error done) 528endef 529 530subdir_makefiles_inc := . 531FULL_BUILD := 532 533ifneq ($(dont_bother),true) 534FULL_BUILD := true 535# 536# Include all of the makefiles in the system 537# 538 539subdir_makefiles := $(SOONG_ANDROID_MK) $(file <$(OUT_DIR)/.module_paths/Android.mk.list) $(SOONG_OUT_DIR)/late-$(TARGET_PRODUCT).mk 540subdir_makefiles_total := $(words int $(subdir_makefiles) post finish) 541.KATI_READONLY := subdir_makefiles_total 542 543$(foreach mk,$(subdir_makefiles),$(info [$(call inc_and_print,subdir_makefiles_inc)/$(subdir_makefiles_total)] including $(mk) ...)$(eval include $(mk))) 544 545droid_targets : blueprint_tools 546 547endif # dont_bother 548 549ifndef subdir_makefiles_total 550subdir_makefiles_total := $(words init post finish) 551endif 552 553$(info [$(call inc_and_print,subdir_makefiles_inc)/$(subdir_makefiles_total)] finishing build rules ...) 554 555# ------------------------------------------------------------------- 556# All module makefiles have been included at this point. 557# ------------------------------------------------------------------- 558 559# ------------------------------------------------------------------- 560# Use basic warning/error messages now that LOCAL_MODULE_MAKEFILE 561# and LOCAL_MODULE aren't useful anymore. 562# ------------------------------------------------------------------- 563define pretty-warning 564$(warning $(1)) 565endef 566 567define pretty-error 568$(error $(1)) 569endef 570 571# ------------------------------------------------------------------- 572# Enforce to generate all RRO packages for modules having resource 573# overlays. 574# ------------------------------------------------------------------- 575ifneq ($(PRODUCT_ENFORCE_RRO_TARGETS),) 576$(call generate_all_enforce_rro_packages) 577endif 578 579# ------------------------------------------------------------------- 580# Sort ALL_MODULES to remove duplicate entries. 581# ------------------------------------------------------------------- 582ALL_MODULES := $(sort $(ALL_MODULES)) 583# Cannot set to readonly because Makefile extends ALL_MODULES 584# .KATI_READONLY := ALL_MODULES 585 586# ------------------------------------------------------------------- 587# Fix up CUSTOM_MODULES to refer to installed files rather than 588# just bare module names. Leave unknown modules alone in case 589# they're actually full paths to a particular file. 590known_custom_modules := $(filter $(ALL_MODULES),$(CUSTOM_MODULES)) 591unknown_custom_modules := $(filter-out $(ALL_MODULES),$(CUSTOM_MODULES)) 592CUSTOM_MODULES := \ 593 $(call module-installed-files,$(known_custom_modules)) \ 594 $(unknown_custom_modules) 595 596# ------------------------------------------------------------------- 597# Define dependencies for modules that require other modules. 598# This can only happen now, after we've read in all module makefiles. 599# 600# TODO: deal with the fact that a bare module name isn't 601# unambiguous enough. Maybe declare short targets like 602# APPS:Quake or HOST:SHARED_LIBRARIES:libutils. 603# BUG: the system image won't know to depend on modules that are 604# brought in as requirements of other modules. 605# 606# Resolve the required module name to 32-bit or 64-bit variant. 607 608# Get a list of corresponding module names for the second arch, if they exist. 609# $(1): TARGET, HOST or HOST_CROSS 610# $(2): A list of module names 611define get-modules-for-2nd-arch 612$(strip \ 613 $(foreach m,$(2), \ 614 $(if $(filter true,$(ALL_MODULES.$(m)$($(1)_2ND_ARCH_MODULE_SUFFIX).FOR_2ND_ARCH)), \ 615 $(m)$($(1)_2ND_ARCH_MODULE_SUFFIX) \ 616 ) \ 617 ) \ 618) 619endef 620 621# Resolves module bitness for PRODUCT_PACKAGES and PRODUCT_HOST_PACKAGES. 622# The returned list of module names can be used to access 623# ALL_MODULES.<module>.<*> variables. 624# Name resolution for PRODUCT_PACKAGES / PRODUCT_HOST_PACKAGES: 625# foo:32 resolves to foo_32; 626# foo:64 resolves to foo; 627# foo resolves to both foo and foo_32 (if foo_32 is defined). 628# 629# Name resolution for HOST_CROSS modules: 630# foo:32 resolves to foo; 631# foo:64 resolves to foo_64; 632# foo resolves to both foo and foo_64 (if foo_64 is defined). 633# 634# $(1): TARGET, HOST or HOST_CROSS 635# $(2): A list of simple module names with :32 and :64 suffix 636define resolve-bitness-for-modules 637$(strip \ 638 $(eval modules_32 := $(patsubst %:32,%,$(filter %:32,$(2)))) \ 639 $(eval modules_64 := $(patsubst %:64,%,$(filter %:64,$(2)))) \ 640 $(eval modules_both := $(filter-out %:32 %:64,$(2))) \ 641 $(eval ### if 2ND_HOST_CROSS_IS_64_BIT, then primary/secondary are reversed for HOST_CROSS modules) \ 642 $(if $(filter HOST_CROSS_true,$(1)_$(2ND_HOST_CROSS_IS_64_BIT)), \ 643 $(eval modules_1st_arch := $(modules_32)) \ 644 $(eval modules_2nd_arch := $(modules_64)), \ 645 $(eval modules_1st_arch := $(modules_64)) \ 646 $(eval modules_2nd_arch := $(modules_32))) \ 647 $(eval ### Note for 32-bit product, 32 and 64 will be added as their original module names.) \ 648 $(eval modules := $(modules_1st_arch)) \ 649 $(if $($(1)_2ND_ARCH), \ 650 $(eval modules += $(call get-modules-for-2nd-arch,$(1),$(modules_2nd_arch))), \ 651 $(eval modules += $(modules_2nd_arch))) \ 652 $(eval ### For the rest we add both) \ 653 $(eval modules += $(modules_both)) \ 654 $(if $($(1)_2ND_ARCH), \ 655 $(eval modules += $(call get-modules-for-2nd-arch,$(1),$(modules_both)))) \ 656 $(modules) \ 657) 658endef 659 660# Resolve the required module names to 32-bit or 64-bit variant for: 661# ALL_MODULES.<*>.REQUIRED_FROM_TARGET 662# ALL_MODULES.<*>.REQUIRED_FROM_HOST 663# ALL_MODULES.<*>.REQUIRED_FROM_HOST_CROSS 664# 665# If a module is for cross host OS, the required modules are also for that OS. 666# Required modules explicitly suffixed with :32 or :64 resolve to that bitness. 667# Otherwise if the requiring module is native and the required module is shared 668# library or native test, then the required module resolves to the same bitness. 669# Otherwise the required module resolves to both variants, if they exist. 670# $(1): TARGET, HOST or HOST_CROSS 671define select-bitness-of-required-modules 672$(foreach m,$(ALL_MODULES), \ 673 $(eval r := $(ALL_MODULES.$(m).REQUIRED_FROM_$(1))) \ 674 $(if $(r), \ 675 $(if $(filter HOST_CROSS,$(1)), \ 676 $(if $(ALL_MODULES.$(m).FOR_HOST_CROSS),,$(error Only expected REQUIRED_FROM_HOST_CROSS on FOR_HOST_CROSS modules - $(m))) \ 677 $(eval r := $(addprefix host_cross_,$(r)))) \ 678 $(eval module_is_native := \ 679 $(filter EXECUTABLES SHARED_LIBRARIES NATIVE_TESTS,$(ALL_MODULES.$(m).CLASS))) \ 680 $(eval r_r := \ 681 $(foreach r_i,$(r), \ 682 $(if $(filter %:32 %:64,$(r_i)), \ 683 $(eval r_m := $(call resolve-bitness-for-modules,$(1),$(r_i))), \ 684 $(eval r_m := \ 685 $(eval r_i_2nd := $(call get-modules-for-2nd-arch,$(1),$(r_i))) \ 686 $(eval required_is_shared_library_or_native_test := \ 687 $(filter SHARED_LIBRARIES NATIVE_TESTS, \ 688 $(ALL_MODULES.$(r_i).CLASS) $(ALL_MODULES.$(r_i_2nd).CLASS))) \ 689 $(if $(and $(module_is_native),$(required_is_shared_library_or_native_test)), \ 690 $(if $(ALL_MODULES.$(m).FOR_2ND_ARCH),$(r_i_2nd),$(r_i)), \ 691 $(r_i) $(r_i_2nd)))) \ 692 $(eval r_m := $(foreach r_j,$(r_m),$(if $(ALL_MODULES.$(r_j).PATH),$(r_j)))) \ 693 $(if $(r_m),,$(eval _nonexistent_required += $(1)$(comma)$(m)$(comma)$(1)$(comma)$(r_i))) \ 694 $(r_m))) \ 695 $(eval ALL_MODULES.$(m).REQUIRED_FROM_$(1) := $(sort $(r_r))) \ 696 ) \ 697) 698endef 699 700# Resolve the required module names to 32-bit or 64-bit variant for: 701# ALL_MODULES.<*>.TARGET_REQUIRED_FROM_HOST 702# ALL_MODULES.<*>.HOST_REQUIRED_FROM_TARGET 703# 704# This is like select-bitness-of-required-modules, but it doesn't have 705# complicated logic for various module types. 706# Calls resolve-bitness-for-modules to resolve module names. 707# $(1): TARGET or HOST 708# $(2): HOST or TARGET 709define select-bitness-of-target-host-required-modules 710$(foreach m,$(ALL_MODULES), \ 711 $(eval r := $(ALL_MODULES.$(m).$(1)_REQUIRED_FROM_$(2))) \ 712 $(if $(r), \ 713 $(eval r_r := \ 714 $(foreach r_i,$(r), \ 715 $(eval r_m := $(call resolve-bitness-for-modules,$(1),$(r_i))) \ 716 $(eval r_m := $(foreach r_j,$(r_m),$(if $(ALL_MODULES.$(r_j).PATH),$(r_j)))) \ 717 $(if $(r_m),,$(eval _nonexistent_required += $(2)$(comma)$(m)$(comma)$(1)$(comma)$(r_i))) \ 718 $(r_m))) \ 719 $(eval ALL_MODULES.$(m).$(1)_REQUIRED_FROM_$(2) := $(sort $(r_r))) \ 720 ) \ 721) 722endef 723 724_nonexistent_required := 725$(call select-bitness-of-required-modules,TARGET) 726$(call select-bitness-of-required-modules,HOST) 727$(call select-bitness-of-required-modules,HOST_CROSS) 728$(call select-bitness-of-target-host-required-modules,TARGET,HOST) 729$(call select-bitness-of-target-host-required-modules,HOST,TARGET) 730_nonexistent_required := $(sort $(_nonexistent_required)) 731 732check_missing_required_modules := true 733ifneq (,$(filter true,$(ALLOW_MISSING_DEPENDENCIES) $(BUILD_BROKEN_MISSING_REQUIRED_MODULES))) 734 check_missing_required_modules := 735endif # ALLOW_MISSING_DEPENDENCIES == true || BUILD_BROKEN_MISSING_REQUIRED_MODULES == true 736 737# Some executables are skipped in ASAN SANITIZE_TARGET build, thus breaking their dependencies. 738ifneq (,$(filter address,$(SANITIZE_TARGET))) 739 check_missing_required_modules := 740endif # SANITIZE_TARGET has ASAN 741 742# HOST OS darwin build is broken, disable this check for darwin for now. 743# TODO(b/162102724): Remove this when darwin host has no broken dependency. 744ifneq (,$(filter $(HOST_OS),darwin)) 745 check_missing_required_modules := 746endif # HOST_OS == darwin 747 748ifeq (true,$(check_missing_required_modules)) 749ifneq (,$(_nonexistent_required)) 750 $(warning Missing required dependencies:) 751 $(foreach r_i,$(_nonexistent_required), \ 752 $(eval r := $(subst $(comma),$(space),$(r_i))) \ 753 $(info $(word 1,$(r)) module $(word 2,$(r)) requires non-existent $(word 3,$(r)) module: $(word 4,$(r))) \ 754 ) 755 $(warning Set BUILD_BROKEN_MISSING_REQUIRED_MODULES := true to bypass this check if this is intentional) 756 $(error Build failed) 757endif # _nonexistent_required != empty 758endif # check_missing_required_modules == true 759 760define add-required-deps 761$(1): | $(2) 762endef 763 764# Use a normal dependency instead of an order-only dependency when installing 765# host dynamic binaries so that the timestamp of the final binary always 766# changes, even if the toc optimization has skipped relinking the binary 767# and its dependant shared libraries. 768define add-required-host-so-deps 769$(1): $(2) 770endef 771 772# Sets up dependencies such that whenever a host module is installed, 773# any other host modules listed in $(ALL_MODULES.$(m).REQUIRED_FROM_HOST) will also be installed 774define add-all-host-to-host-required-modules-deps 775$(foreach m,$(ALL_MODULES), \ 776 $(eval r := $(ALL_MODULES.$(m).REQUIRED_FROM_HOST)) \ 777 $(if $(r), \ 778 $(eval r := $(call module-installed-files,$(r))) \ 779 $(eval h_m := $(filter $(HOST_OUT)/%, $(ALL_MODULES.$(m).INSTALLED))) \ 780 $(eval h_r := $(filter $(HOST_OUT)/%, $(r))) \ 781 $(eval h_r := $(filter-out $(h_m), $(h_r))) \ 782 $(if $(h_m), $(eval $(call add-required-deps, $(h_m),$(h_r)))) \ 783 ) \ 784) 785endef 786$(call add-all-host-to-host-required-modules-deps) 787 788# Sets up dependencies such that whenever a host cross module is installed, 789# any other host cross modules listed in $(ALL_MODULES.$(m).REQUIRED_FROM_HOST_CROSS) will also be installed 790define add-all-host-cross-to-host-cross-required-modules-deps 791$(foreach m,$(ALL_MODULES), \ 792 $(eval r := $(ALL_MODULES.$(m).REQUIRED_FROM_HOST_CROSS)) \ 793 $(if $(r), \ 794 $(eval r := $(call module-installed-files,$(r))) \ 795 $(eval hc_m := $(filter $(HOST_CROSS_OUT)/%, $(ALL_MODULES.$(m).INSTALLED))) \ 796 $(eval hc_r := $(filter $(HOST_CROSS_OUT)/%, $(r))) \ 797 $(eval hc_r := $(filter-out $(hc_m), $(hc_r))) \ 798 $(if $(hc_m), $(eval $(call add-required-deps, $(hc_m),$(hc_r)))) \ 799 ) \ 800) 801endef 802$(call add-all-host-cross-to-host-cross-required-modules-deps) 803 804# Sets up dependencies such that whenever a target module is installed, 805# any other target modules listed in $(ALL_MODULES.$(m).REQUIRED_FROM_TARGET) will also be installed 806define add-all-target-to-target-required-modules-deps 807$(foreach m,$(ALL_MODULES), \ 808 $(eval r := $(ALL_MODULES.$(m).REQUIRED_FROM_TARGET)) \ 809 $(if $(r), \ 810 $(eval r := $(call module-installed-files,$(r))) \ 811 $(eval t_m := $(filter $(TARGET_OUT_ROOT)/%, $(ALL_MODULES.$(m).INSTALLED))) \ 812 $(eval t_r := $(filter $(TARGET_OUT_ROOT)/%, $(r))) \ 813 $(eval t_r := $(filter-out $(t_m), $(t_r))) \ 814 $(if $(t_m), $(eval $(call add-required-deps, $(t_m),$(t_r)))) \ 815 ) \ 816) 817endef 818$(call add-all-target-to-target-required-modules-deps) 819 820# Sets up dependencies such that whenever a host module is installed, 821# any target modules listed in $(ALL_MODULES.$(m).TARGET_REQUIRED_FROM_HOST) will also be installed 822define add-all-host-to-target-required-modules-deps 823$(foreach m,$(ALL_MODULES), \ 824 $(eval req_mods := $(ALL_MODULES.$(m).TARGET_REQUIRED_FROM_HOST))\ 825 $(if $(req_mods), \ 826 $(eval req_files := )\ 827 $(foreach req_mod,$(req_mods), \ 828 $(eval req_file := $(filter $(TARGET_OUT_ROOT)/%, $(call module-installed-files,$(req_mod)))) \ 829 $(if $(filter true,$(ALLOW_MISSING_DEPENDENCIES)), \ 830 , \ 831 $(if $(strip $(req_file)), \ 832 , \ 833 $(error $(m).LOCAL_TARGET_REQUIRED_MODULES : illegal value $(req_mod) : not a device module. If you want to specify host modules to be required to be installed along with your host module, add those module names to LOCAL_REQUIRED_MODULES instead) \ 834 ) \ 835 ) \ 836 $(eval req_files := $(req_files)$(space)$(req_file))\ 837 )\ 838 $(eval req_files := $(strip $(req_files)))\ 839 $(eval mod_files := $(filter $(HOST_OUT)/%, $(call module-installed-files,$(m)))) \ 840 $(if $(mod_files),\ 841 $(eval $(call add-required-deps, $(mod_files),$(req_files))) \ 842 )\ 843 )\ 844) 845endef 846$(call add-all-host-to-target-required-modules-deps) 847 848# Sets up dependencies such that whenever a target module is installed, 849# any host modules listed in $(ALL_MODULES.$(m).HOST_REQUIRED_FROM_TARGET) will also be installed 850define add-all-target-to-host-required-modules-deps 851$(foreach m,$(ALL_MODULES), \ 852 $(eval req_mods := $(ALL_MODULES.$(m).HOST_REQUIRED_FROM_TARGET))\ 853 $(if $(req_mods), \ 854 $(eval req_files := )\ 855 $(foreach req_mod,$(req_mods), \ 856 $(eval req_file := $(filter $(HOST_OUT)/%, $(call module-installed-files,$(req_mod)))) \ 857 $(if $(filter true,$(ALLOW_MISSING_DEPENDENCIES)), \ 858 , \ 859 $(if $(strip $(req_file)), \ 860 , \ 861 $(error $(m).LOCAL_HOST_REQUIRED_MODULES : illegal value $(req_mod) : not a host module. If you want to specify target modules to be required to be installed along with your target module, add those module names to LOCAL_REQUIRED_MODULES instead) \ 862 ) \ 863 ) \ 864 $(eval req_files := $(req_files)$(space)$(req_file))\ 865 )\ 866 $(eval req_files := $(strip $(req_files)))\ 867 $(eval mod_files := $(filter $(TARGET_OUT_ROOT)/%, $(call module-installed-files,$(m))))\ 868 $(if $(mod_files),\ 869 $(eval $(call add-required-deps, $(mod_files),$(req_files))) \ 870 )\ 871 )\ 872) 873endef 874$(call add-all-target-to-host-required-modules-deps) 875 876t_m := 877h_m := 878hc_m := 879t_r := 880h_r := 881hc_r := 882 883# Establish the dependencies on the shared libraries. 884# It also adds the shared library module names to ALL_MODULES.$(m).REQUIRED_FROM_(TARGET|HOST|HOST_CROSS), 885# so they can be expanded to product_MODULES later. 886# $(1): TARGET_ or HOST_ or HOST_CROSS_. 887# $(2): non-empty for 2nd arch. 888# $(3): non-empty for host cross compile. 889define resolve-shared-libs-depes 890$(foreach m,$($(if $(2),$($(1)2ND_ARCH_VAR_PREFIX))$(1)DEPENDENCIES_ON_SHARED_LIBRARIES),\ 891 $(eval p := $(subst :,$(space),$(m)))\ 892 $(eval mod := $(firstword $(p)))\ 893 $(eval deps := $(subst $(comma),$(space),$(lastword $(p))))\ 894 $(eval root := $(1)OUT$(if $(call streq,$(1),TARGET_),_ROOT))\ 895 $(if $(2),$(eval deps := $(addsuffix $($(1)2ND_ARCH_MODULE_SUFFIX),$(deps))))\ 896 $(if $(3),$(eval deps := $(addprefix host_cross_,$(deps))))\ 897 $(eval r := $(filter $($(root))/%,$(call module-installed-files,\ 898 $(deps))))\ 899 $(if $(filter $(1),HOST_),\ 900 $(eval ALL_MODULES.$(mod).HOST_SHARED_LIBRARY_FILES := $$(ALL_MODULES.$(mod).HOST_SHARED_LIBRARY_FILES) $(word 2,$(p)) $(r))\ 901 $(eval ALL_MODULES.$(mod).HOST_SHARED_LIBRARIES := $$(ALL_MODULES.$(mod).HOST_SHARED_LIBRARIES) $(deps))\ 902 $(eval $(call add-required-host-so-deps,$(word 2,$(p)),$(r))),\ 903 $(eval $(call add-required-deps,$(word 2,$(p)),$(r))))\ 904 $(eval ALL_MODULES.$(mod).REQUIRED_FROM_$(patsubst %_,%,$(1)) += $(deps))) 905endef 906 907# Recursively resolve host shared library dependency for a given module. 908# $(1): module name 909# Returns all dependencies of shared library. 910define get-all-shared-libs-deps 911$(if $(_all_deps_for_$(1)_set_),$(_all_deps_for_$(1)_),\ 912 $(eval _all_deps_for_$(1)_ :=) \ 913 $(foreach dep,$(ALL_MODULES.$(1).HOST_SHARED_LIBRARIES),\ 914 $(foreach m,$(call get-all-shared-libs-deps,$(dep)),\ 915 $(eval _all_deps_for_$(1)_ := $$(_all_deps_for_$(1)_) $(m))\ 916 $(eval _all_deps_for_$(1)_ := $(sort $(_all_deps_for_$(1)_))))\ 917 $(eval _all_deps_for_$(1)_ := $$(_all_deps_for_$(1)_) $(dep))\ 918 $(eval _all_deps_for_$(1)_ := $(sort $(_all_deps_for_$(1)_) $(dep)))\ 919 $(eval _all_deps_for_$(1)_set_ := true))\ 920$(_all_deps_for_$(1)_)) 921endef 922 923# Scan all modules in general-tests, device-tests and other selected suites and 924# flatten the shared library dependencies. 925define update-host-shared-libs-deps-for-suites 926$(foreach suite,general-tests device-tests vts tvts art-host-tests host-unit-tests,\ 927 $(foreach m,$(COMPATIBILITY.$(suite).MODULES),\ 928 $(eval my_deps := $(call get-all-shared-libs-deps,$(m)))\ 929 $(foreach dep,$(my_deps),\ 930 $(foreach f,$(ALL_MODULES.$(dep).HOST_SHARED_LIBRARY_FILES),\ 931 $(if $(filter $(suite),device-tests general-tests),\ 932 $(eval my_testcases := $(HOST_OUT_TESTCASES)),\ 933 $(eval my_testcases := $$(COMPATIBILITY_TESTCASES_OUT_$(suite))))\ 934 $(eval target := $(my_testcases)/$(lastword $(subst /, ,$(dir $(f))))/$(notdir $(f)))\ 935 $(eval COMPATIBILITY.$(suite).HOST_SHARED_LIBRARY.FILES := \ 936 $$(COMPATIBILITY.$(suite).HOST_SHARED_LIBRARY.FILES) $(f):$(target))\ 937 $(eval COMPATIBILITY.$(suite).HOST_SHARED_LIBRARY.FILES := \ 938 $(sort $(COMPATIBILITY.$(suite).HOST_SHARED_LIBRARY.FILES))))))) 939endef 940 941$(call resolve-shared-libs-depes,TARGET_) 942ifdef TARGET_2ND_ARCH 943$(call resolve-shared-libs-depes,TARGET_,true) 944endif 945$(call resolve-shared-libs-depes,HOST_) 946ifdef HOST_2ND_ARCH 947$(call resolve-shared-libs-depes,HOST_,true) 948endif 949# Update host side shared library dependencies for tests in suite device-tests and general-tests. 950# This should be called after calling resolve-shared-libs-depes for HOST_2ND_ARCH. 951$(call update-host-shared-libs-deps-for-suites) 952ifdef HOST_CROSS_OS 953$(call resolve-shared-libs-depes,HOST_CROSS_,,true) 954ifdef HOST_CROSS_2ND_ARCH 955$(call resolve-shared-libs-depes,HOST_CROSS_,true,true) 956endif 957endif 958 959# Pass the shared libraries dependencies to prebuilt ELF file check. 960define add-elf-file-check-shared-lib 961$(1): PRIVATE_SHARED_LIBRARY_FILES += $(2) 962$(1): $(2) 963endef 964 965define resolve-shared-libs-for-elf-file-check 966$(foreach m,$($(if $(2),$($(1)2ND_ARCH_VAR_PREFIX))$(1)DEPENDENCIES_ON_SHARED_LIBRARIES),\ 967 $(eval p := $(subst :,$(space),$(m)))\ 968 $(eval mod := $(firstword $(p)))\ 969 \ 970 $(eval deps := $(subst $(comma),$(space),$(lastword $(p))))\ 971 $(if $(2),$(eval deps := $(addsuffix $($(1)2ND_ARCH_MODULE_SUFFIX),$(deps))))\ 972 $(eval root := $(1)OUT$(if $(call streq,$(1),TARGET_),_ROOT))\ 973 $(eval deps := $(filter $($(root))/%$($(1)SHLIB_SUFFIX),$(call module-built-files,$(deps))))\ 974 \ 975 $(eval r := $(firstword $(filter \ 976 $($(if $(2),$($(1)2ND_ARCH_VAR_PREFIX))TARGET_OUT_INTERMEDIATES)/EXECUTABLES/%\ 977 $($(if $(2),$($(1)2ND_ARCH_VAR_PREFIX))TARGET_OUT_INTERMEDIATES)/NATIVE_TESTS/%\ 978 $($(if $(2),$($(1)2ND_ARCH_VAR_PREFIX))TARGET_OUT_INTERMEDIATES)/SHARED_LIBRARIES/%,\ 979 $(call module-built-files,$(mod)))))\ 980 \ 981 $(if $(and $(r),$(deps)),\ 982 $(eval stamp := $(dir $(r))check_elf_files.timestamp)\ 983 $(if $(CHECK_ELF_FILES.$(stamp)),\ 984 $(eval $(call add-elf-file-check-shared-lib,$(stamp),$(deps))))\ 985 )) 986endef 987 988$(call resolve-shared-libs-for-elf-file-check,TARGET_) 989ifdef TARGET_2ND_ARCH 990$(call resolve-shared-libs-for-elf-file-check,TARGET_,true) 991endif 992 993m := 994r := 995p := 996stamp := 997deps := 998add-required-deps := 999 1000################################################################################ 1001# Link type checking 1002# 1003# ALL_LINK_TYPES contains a list of all link type prefixes (generally one per 1004# module, but APKs can "link" to both java and native code). The link type 1005# prefix consists of all the information needed by intermediates-dir-for: 1006# 1007# LINK_TYPE:TARGET:_:2ND:STATIC_LIBRARIES:libfoo 1008# 1009# 1: LINK_TYPE literal 1010# 2: prefix 1011# - TARGET 1012# - HOST 1013# - HOST_CROSS 1014# 3: Whether to use the common intermediates directory or not 1015# - _ 1016# - COMMON 1017# 4: Whether it's the second arch or not 1018# - _ 1019# - 2ND_ 1020# 5: Module Class 1021# - STATIC_LIBRARIES 1022# - SHARED_LIBRARIES 1023# - ... 1024# 6: Module Name 1025# 1026# Then fields under that are separated by a period and the field name: 1027# - TYPE: the link types for this module 1028# - MAKEFILE: Where this module was defined 1029# - BUILT: The built module location 1030# - DEPS: the link type prefixes for the module's dependencies 1031# - ALLOWED: the link types to allow in this module's dependencies 1032# - WARN: the link types to warn about in this module's dependencies 1033# 1034# All of the dependency link types not listed in ALLOWED or WARN will become 1035# errors. 1036################################################################################ 1037 1038link_type_error := 1039 1040define link-type-prefix 1041$(word 2,$(subst :,$(space),$(1))) 1042endef 1043define link-type-common 1044$(patsubst _,,$(word 3,$(subst :,$(space),$(1)))) 1045endef 1046define link-type-2ndarchprefix 1047$(patsubst _,,$(word 4,$(subst :,$(space),$(1)))) 1048endef 1049define link-type-class 1050$(word 5,$(subst :,$(space),$(1))) 1051endef 1052define link-type-name 1053$(word 6,$(subst :,$(space),$(1))) 1054endef 1055define link-type-os 1056$(strip $(eval _p := $(link-type-prefix))\ 1057 $(if $(filter HOST HOST_CROSS,$(_p)),\ 1058 $($(_p)_OS),\ 1059 android)) 1060endef 1061define link-type-arch 1062$($(link-type-prefix)_$(link-type-2ndarchprefix)ARCH) 1063endef 1064define link-type-name-variant 1065$(link-type-name) ($(link-type-class) $(link-type-os)-$(link-type-arch)) 1066endef 1067 1068# $(1): the prefix of the module doing the linking 1069# $(2): the prefix of the linked module 1070define link-type-warning 1071$(shell $(call echo-warning,$($(1).MAKEFILE),"$(call link-type-name,$(1)) ($($(1).TYPE)) should not link against $(call link-type-name,$(2)) ($(3))")) 1072endef 1073 1074# $(1): the prefix of the module doing the linking 1075# $(2): the prefix of the linked module 1076define link-type-error 1077$(shell $(call echo-error,$($(1).MAKEFILE),"$(call link-type-name,$(1)) ($($(1).TYPE)) can not link against $(call link-type-name,$(2)) ($(3))"))\ 1078$(eval link_type_error := true) 1079endef 1080 1081link-type-missing := 1082ifneq ($(ALLOW_MISSING_DEPENDENCIES),true) 1083 # Print an error message if the linked-to module is missing 1084 # $(1): the prefix of the module doing the linking 1085 # $(2): the prefix of the missing module 1086 define link-type-missing 1087 $(shell $(call echo-error,$($(1).MAKEFILE),"$(call link-type-name-variant,$(1)) missing $(call link-type-name-variant,$(2))"))\ 1088 $(eval available_variants := $(filter %:$(call link-type-name,$(2)),$(ALL_LINK_TYPES)))\ 1089 $(if $(available_variants),\ 1090 $(info Available variants:)\ 1091 $(foreach v,$(available_variants),$(info $(space)$(space)$(call link-type-name-variant,$(v)))))\ 1092 $(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.)\ 1093 $(eval link_type_error := true) 1094 endef 1095else 1096 define link-type-missing 1097 $(eval $$(1).MISSING := true) 1098 endef 1099endif 1100 1101# Verify that $(1) can link against $(2) 1102# Both $(1) and $(2) are the link type prefix defined above 1103define verify-link-type 1104$(foreach t,$($(2).TYPE),\ 1105 $(if $(filter-out $($(1).ALLOWED),$(t)),\ 1106 $(if $(filter $(t),$($(1).WARN)),\ 1107 $(call link-type-warning,$(1),$(2),$(t)),\ 1108 $(call link-type-error,$(1),$(2),$(t))))) 1109endef 1110 1111$(foreach lt,$(ALL_LINK_TYPES),\ 1112 $(foreach d,$($(lt).DEPS),\ 1113 $(if $($(d).TYPE),\ 1114 $(call verify-link-type,$(lt),$(d)),\ 1115 $(call link-type-missing,$(lt),$(d))))) 1116 1117ifdef link_type_error 1118 $(error exiting from previous errors) 1119endif 1120 1121# ------------------------------------------------------------------- 1122# Handle exported/imported includes 1123 1124# Recursively calculate flags 1125$(foreach export,$(EXPORTS_LIST), \ 1126 $(eval EXPORTS.$$(export) = $$(EXPORTS.$(export).FLAGS) \ 1127 $(foreach dep,$(EXPORTS.$(export).REEXPORT),$$(EXPORTS.$(dep))))) 1128 1129# Recursively calculate dependencies 1130$(foreach export,$(EXPORTS_LIST), \ 1131 $(eval EXPORT_DEPS.$$(export) = $$(EXPORTS.$(export).DEPS) \ 1132 $(foreach dep,$(EXPORTS.$(export).REEXPORT),$$(EXPORT_DEPS.$(dep))))) 1133 1134# Converts the recursive variables to simple variables so that we don't have to 1135# evaluate them for every .o rule 1136$(foreach export,$(EXPORTS_LIST),$(eval EXPORTS.$$(export) := $$(strip $$(EXPORTS.$$(export))))) 1137$(foreach export,$(EXPORTS_LIST),$(eval EXPORT_DEPS.$$(export) := $$(sort $$(EXPORT_DEPS.$$(export))))) 1138 1139# Add dependencies 1140$(foreach export,$(EXPORTS_LIST),$(eval $(call add-dependency,$$(EXPORTS.$$(export).USERS),$$(EXPORT_DEPS.$$(export))))) 1141 1142# ------------------------------------------------------------------- 1143# Figure out our module sets. 1144# 1145# Of the modules defined by the component makefiles, 1146# determine what we actually want to build. 1147 1148 1149# Expand a list of modules to the modules that they override (if any) 1150# $(1): The list of modules. 1151define module-overrides 1152$(foreach m,$(1),\ 1153 $(eval _mo_overrides := $(PACKAGES.$(m).OVERRIDES) $(EXECUTABLES.$(m).OVERRIDES) $(SHARED_LIBRARIES.$(m).OVERRIDES) $(ETC.$(m).OVERRIDES))\ 1154 $(if $(filter $(m),$(_mo_overrides)),\ 1155 $(error Module $(m) cannot override itself),\ 1156 $(_mo_overrides))) 1157endef 1158 1159########################################################### 1160## Expand a module name list with REQUIRED modules 1161########################################################### 1162# $(1): The variable name that holds the initial module name list. 1163# the variable will be modified to hold the expanded results. 1164# $(2): The initial module name list. 1165# $(3): The list of overridden modules. 1166# Returns empty string (maybe with some whitespaces). 1167define expand-required-modules 1168$(eval _erm_req := $(foreach m,$(2),$(ALL_MODULES.$(m).REQUIRED_FROM_TARGET))) \ 1169$(eval _erm_new_modules := $(sort $(filter-out $($(1)),$(_erm_req)))) \ 1170$(eval _erm_new_overrides := $(call module-overrides,$(_erm_new_modules))) \ 1171$(eval _erm_all_overrides := $(3) $(_erm_new_overrides)) \ 1172$(eval _erm_new_modules := $(filter-out $(_erm_all_overrides), $(_erm_new_modules))) \ 1173$(eval $(1) := $(filter-out $(_erm_new_overrides),$($(1)))) \ 1174$(eval $(1) += $(_erm_new_modules)) \ 1175$(if $(_erm_new_modules),\ 1176 $(call expand-required-modules,$(1),$(_erm_new_modules),$(_erm_all_overrides))) 1177endef 1178 1179# Same as expand-required-modules above, but does not handle module overrides, as 1180# we don't intend to support them on the host. 1181# $(1): The variable name that holds the initial module name list. 1182# the variable will be modified to hold the expanded results. 1183# $(2): The initial module name list. 1184# $(3): HOST or HOST_CROSS depending on whether we're expanding host or host cross modules 1185# Returns empty string (maybe with some whitespaces). 1186define expand-required-host-modules 1187$(eval _erm_req := $(foreach m,$(2),$(ALL_MODULES.$(m).REQUIRED_FROM_$(3)))) \ 1188$(eval _erm_new_modules := $(sort $(filter-out $($(1)),$(_erm_req)))) \ 1189$(eval $(1) += $(_erm_new_modules)) \ 1190$(if $(_erm_new_modules),\ 1191 $(call expand-required-host-modules,$(1),$(_erm_new_modules),$(3))) 1192endef 1193 1194# Transforms paths relative to PRODUCT_OUT to absolute paths. 1195# $(1): list of relative paths 1196# $(2): optional suffix to append to paths 1197define resolve-product-relative-paths 1198 $(subst $(_vendor_path_placeholder),$(TARGET_COPY_OUT_VENDOR),\ 1199 $(subst $(_product_path_placeholder),$(TARGET_COPY_OUT_PRODUCT),\ 1200 $(subst $(_system_ext_path_placeholder),$(TARGET_COPY_OUT_SYSTEM_EXT),\ 1201 $(subst $(_odm_path_placeholder),$(TARGET_COPY_OUT_ODM),\ 1202 $(subst $(_vendor_dlkm_path_placeholder),$(TARGET_COPY_OUT_VENDOR_DLKM),\ 1203 $(subst $(_odm_dlkm_path_placeholder),$(TARGET_COPY_OUT_ODM_DLKM),\ 1204 $(foreach p,$(1),$(call append-path,$(PRODUCT_OUT),$(p)$(2))))))))) 1205endef 1206 1207# Returns modules included automatically as a result of certain BoardConfig 1208# variables being set. 1209define auto-included-modules 1210 $(if $(BOARD_VNDK_VERSION),vndk_package) \ 1211 $(if $(DEVICE_MANIFEST_FILE),vendor_manifest.xml) \ 1212 $(if $(DEVICE_MANIFEST_SKUS),$(foreach sku, $(DEVICE_MANIFEST_SKUS),vendor_manifest_$(sku).xml)) \ 1213 $(if $(ODM_MANIFEST_FILES),odm_manifest.xml) \ 1214 $(if $(ODM_MANIFEST_SKUS),$(foreach sku, $(ODM_MANIFEST_SKUS),odm_manifest_$(sku).xml)) \ 1215 1216endef 1217 1218# Lists most of the files a particular product installs, including: 1219# - PRODUCT_PACKAGES, and their LOCAL_REQUIRED_MODULES 1220# - PRODUCT_COPY_FILES 1221# The base list of modules to build for this product is specified 1222# by the appropriate product definition file, which was included 1223# by product_config.mk. 1224# Name resolution for PRODUCT_PACKAGES: 1225# foo:32 resolves to foo_32; 1226# foo:64 resolves to foo; 1227# foo resolves to both foo and foo_32 (if foo_32 is defined). 1228# 1229# Name resolution for LOCAL_REQUIRED_MODULES: 1230# See the select-bitness-of-required-modules definition. 1231# $(1): product makefile 1232define product-installed-files 1233 $(eval _pif_modules := \ 1234 $(call get-product-var,$(1),PRODUCT_PACKAGES) \ 1235 $(if $(filter eng,$(tags_to_install)),$(call get-product-var,$(1),PRODUCT_PACKAGES_ENG)) \ 1236 $(if $(filter debug,$(tags_to_install)),$(call get-product-var,$(1),PRODUCT_PACKAGES_DEBUG)) \ 1237 $(if $(filter tests,$(tags_to_install)),$(call get-product-var,$(1),PRODUCT_PACKAGES_TESTS)) \ 1238 $(if $(filter asan,$(tags_to_install)),$(call get-product-var,$(1),PRODUCT_PACKAGES_DEBUG_ASAN)) \ 1239 $(if $(filter java_coverage,$(tags_to_install)),$(call get-product-var,$(1),PRODUCT_PACKAGES_DEBUG_JAVA_COVERAGE)) \ 1240 $(call auto-included-modules) \ 1241 ) \ 1242 $(eval ### Filter out the overridden packages and executables before doing expansion) \ 1243 $(eval _pif_overrides := $(call module-overrides,$(_pif_modules))) \ 1244 $(eval _pif_modules := $(filter-out $(_pif_overrides), $(_pif_modules))) \ 1245 $(eval ### Resolve the :32 :64 module name) \ 1246 $(eval _pif_modules := $(sort $(call resolve-bitness-for-modules,TARGET,$(_pif_modules)))) \ 1247 $(call expand-required-modules,_pif_modules,$(_pif_modules),$(_pif_overrides)) \ 1248 $(filter-out $(HOST_OUT_ROOT)/%,$(call module-installed-files, $(_pif_modules))) \ 1249 $(call resolve-product-relative-paths,\ 1250 $(foreach cf,$(call get-product-var,$(1),PRODUCT_COPY_FILES),$(call word-colon,2,$(cf)))) 1251endef 1252 1253# Similar to product-installed-files above, but handles PRODUCT_HOST_PACKAGES instead 1254# This does support the :32 / :64 syntax, but does not support module overrides. 1255define host-installed-files 1256 $(eval _hif_modules := $(call get-product-var,$(1),PRODUCT_HOST_PACKAGES)) \ 1257 $(eval ### Split host vs host cross modules) \ 1258 $(eval _hcif_modules := $(filter host_cross_%,$(_hif_modules))) \ 1259 $(eval _hif_modules := $(filter-out host_cross_%,$(_hif_modules))) \ 1260 $(eval ### Resolve the :32 :64 module name) \ 1261 $(eval _hif_modules := $(sort $(call resolve-bitness-for-modules,HOST,$(_hif_modules)))) \ 1262 $(eval _hcif_modules := $(sort $(call resolve-bitness-for-modules,HOST_CROSS,$(_hcif_modules)))) \ 1263 $(call expand-required-host-modules,_hif_modules,$(_hif_modules),HOST) \ 1264 $(call expand-required-host-modules,_hcif_modules,$(_hcif_modules),HOST_CROSS) \ 1265 $(filter $(HOST_OUT)/%,$(call module-installed-files, $(_hif_modules))) \ 1266 $(filter $(HOST_CROSS_OUT)/%,$(call module-installed-files, $(_hcif_modules))) 1267endef 1268 1269# Fails the build if the given list is non-empty, and prints it entries (stripping PRODUCT_OUT). 1270# $(1): list of files to print 1271# $(2): heading to print on failure 1272define maybe-print-list-and-error 1273$(if $(strip $(1)), \ 1274 $(warning $(2)) \ 1275 $(info Offending entries:) \ 1276 $(foreach e,$(sort $(1)),$(info $(patsubst $(PRODUCT_OUT)/%,%,$(e)))) \ 1277 $(error Build failed) \ 1278) 1279endef 1280 1281ifdef FULL_BUILD 1282 ifneq (true,$(ALLOW_MISSING_DEPENDENCIES)) 1283 # Check to ensure that all modules in PRODUCT_PACKAGES exist (opt in per product) 1284 ifeq (true,$(PRODUCT_ENFORCE_PACKAGES_EXIST)) 1285 _allow_list := $(PRODUCT_ENFORCE_PACKAGES_EXIST_ALLOW_LIST) 1286 _modules := $(PRODUCT_PACKAGES) 1287 # Strip :32 and :64 suffixes 1288 _modules := $(patsubst %:32,%,$(_modules)) 1289 _modules := $(patsubst %:64,%,$(_modules)) 1290 # Quickly check all modules in PRODUCT_PACKAGES exist. We check for the 1291 # existence if either <module> or the <module>_32 variant. 1292 _nonexistent_modules := $(foreach m,$(_modules), \ 1293 $(if $(or $(ALL_MODULES.$(m).PATH),$(call get-modules-for-2nd-arch,TARGET,$(m))),,$(m))) 1294 $(call maybe-print-list-and-error,$(filter-out $(_allow_list),$(_nonexistent_modules)),\ 1295 $(INTERNAL_PRODUCT) includes non-existent modules in PRODUCT_PACKAGES) 1296 # TODO(b/182105280): Consider re-enabling this check when the ART modules 1297 # have been cleaned up from the allowed_list in target/product/generic.mk. 1298 #$(call maybe-print-list-and-error,$(filter-out $(_nonexistent_modules),$(_allow_list)),\ 1299 # $(INTERNAL_PRODUCT) includes redundant allow list entries for non-existent PRODUCT_PACKAGES) 1300 endif 1301 1302 # Check to ensure that all modules in PRODUCT_HOST_PACKAGES exist 1303 # 1304 # Many host modules are Linux-only, so skip this check on Mac. If we ever have Mac-only modules, 1305 # maybe it would make sense to have PRODUCT_HOST_PACKAGES_LINUX/_DARWIN? 1306 ifneq ($(HOST_OS),darwin) 1307 _modules := $(PRODUCT_HOST_PACKAGES) 1308 # Strip :32 and :64 suffixes 1309 _modules := $(patsubst %:32,%,$(_modules)) 1310 _modules := $(patsubst %:64,%,$(_modules)) 1311 _nonexistent_modules := $(foreach m,$(_modules),\ 1312 $(if $(ALL_MODULES.$(m).REQUIRED_FROM_HOST)$(filter $(HOST_OUT_ROOT)/%,$(ALL_MODULES.$(m).INSTALLED)),,$(m))) 1313 $(call maybe-print-list-and-error,$(_nonexistent_modules),\ 1314 $(INTERNAL_PRODUCT) includes non-existent modules in PRODUCT_HOST_PACKAGES) 1315 endif 1316 endif 1317 1318 # Modules may produce only host installed files in unbundled builds. 1319 ifeq (,$(TARGET_BUILD_UNBUNDLED)) 1320 _modules := $(call resolve-bitness-for-modules,TARGET, \ 1321 $(PRODUCT_PACKAGES) \ 1322 $(PRODUCT_PACKAGES_DEBUG) \ 1323 $(PRODUCT_PACKAGES_DEBUG_ASAN) \ 1324 $(PRODUCT_PACKAGES_ENG) \ 1325 $(PRODUCT_PACKAGES_TESTS)) 1326 _host_modules := $(foreach m,$(_modules), \ 1327 $(if $(ALL_MODULES.$(m).INSTALLED),\ 1328 $(if $(filter-out $(HOST_OUT_ROOT)/%,$(ALL_MODULES.$(m).INSTALLED)),,\ 1329 $(m)))) 1330 $(call maybe-print-list-and-error,$(sort $(_host_modules)),\ 1331 Host modules should be in PRODUCT_HOST_PACKAGES$(comma) not PRODUCT_PACKAGES) 1332 endif 1333 1334 product_host_FILES := $(call host-installed-files,$(INTERNAL_PRODUCT)) 1335 product_target_FILES := $(call product-installed-files, $(INTERNAL_PRODUCT)) 1336 # WARNING: The product_MODULES variable is depended on by external files. 1337 product_MODULES := $(_pif_modules) 1338 1339 # Verify the artifact path requirements made by included products. 1340 is_asan := $(if $(filter address,$(SANITIZE_TARGET)),true) 1341 ifneq (true,$(or $(is_asan),$(DISABLE_ARTIFACT_PATH_REQUIREMENTS))) 1342 include $(BUILD_SYSTEM)/artifact_path_requirements.mk 1343 endif 1344else 1345 # We're not doing a full build, and are probably only including 1346 # a subset of the module makefiles. Don't try to build any modules 1347 # requested by the product, because we probably won't have rules 1348 # to build them. 1349 product_target_FILES := 1350 product_host_FILES := 1351endif 1352 1353# TODO: Remove the 3 places in the tree that use ALL_DEFAULT_INSTALLED_MODULES 1354# and get rid of it from this list. 1355modules_to_install := $(sort \ 1356 $(ALL_DEFAULT_INSTALLED_MODULES) \ 1357 $(product_target_FILES) \ 1358 $(product_host_FILES) \ 1359 $(CUSTOM_MODULES) \ 1360 ) 1361 1362ifdef FULL_BUILD 1363# 1364# Used by the cleanup logic in soong_ui to remove files that should no longer 1365# be installed. 1366# 1367 1368# Include all tests, so that we remove them from the test suites / testcase 1369# folders when they are removed. 1370test_files := $(foreach ts,$(ALL_COMPATIBILITY_SUITES),$(COMPATIBILITY.$(ts).FILES)) 1371 1372$(shell mkdir -p $(PRODUCT_OUT) $(HOST_OUT)) 1373 1374$(file >$(PRODUCT_OUT)/.installable_files$(if $(filter address,$(SANITIZE_TARGET)),_asan), \ 1375 $(sort $(patsubst $(PRODUCT_OUT)/%,%,$(filter $(PRODUCT_OUT)/%, \ 1376 $(modules_to_install) $(test_files))))) 1377 1378$(file >$(HOST_OUT)/.installable_test_files,$(sort \ 1379 $(patsubst $(HOST_OUT)/%,%,$(filter $(HOST_OUT)/%, \ 1380 $(test_files))))) 1381 1382test_files := 1383endif 1384 1385# Dedpulicate compatibility suite dist files across modules and packages before 1386# copying them to their requested locations. Assign the eval result to an unused 1387# var to prevent Make from trying to make a sense of it. 1388_unused := $(call copy-many-files, $(sort $(ALL_COMPATIBILITY_DIST_FILES))) 1389 1390# Don't include any GNU General Public License shared objects or static 1391# libraries in SDK images. GPL executables (not static/dynamic libraries) 1392# are okay if they don't link against any closed source libraries (directly 1393# or indirectly) 1394 1395# It's ok (and necessary) to build the host tools, but nothing that's 1396# going to be installed on the target (including static libraries). 1397 1398ifdef is_sdk_build 1399 target_gnu_MODULES := \ 1400 $(filter \ 1401 $(TARGET_OUT_INTERMEDIATES)/% \ 1402 $(TARGET_OUT)/% \ 1403 $(TARGET_OUT_DATA)/%, \ 1404 $(sort $(call get-tagged-modules,gnu))) 1405 target_gnu_MODULES := $(filter-out $(TARGET_OUT_EXECUTABLES)/%,$(target_gnu_MODULES)) 1406 target_gnu_MODULES := $(filter-out %/libopenjdkjvmti.so,$(target_gnu_MODULES)) 1407 target_gnu_MODULES := $(filter-out %/libopenjdkjvmtid.so,$(target_gnu_MODULES)) 1408 $(info Removing from sdk:)$(foreach d,$(target_gnu_MODULES),$(info : $(d))) 1409 modules_to_install := \ 1410 $(filter-out $(target_gnu_MODULES),$(modules_to_install)) 1411 1412 # Ensure every module listed in PRODUCT_PACKAGES* gets something installed 1413 # TODO: Should we do this for all builds and not just the sdk? 1414 dangling_modules := 1415 $(foreach m, $(PRODUCT_PACKAGES), \ 1416 $(if $(strip $(ALL_MODULES.$(m).INSTALLED) $(ALL_MODULES.$(m)$(TARGET_2ND_ARCH_MODULE_SUFFIX).INSTALLED)),,\ 1417 $(eval dangling_modules += $(m)))) 1418 ifneq ($(dangling_modules),) 1419 $(warning: Modules '$(dangling_modules)' in PRODUCT_PACKAGES have nothing to install!) 1420 endif 1421 $(foreach m, $(PRODUCT_PACKAGES_DEBUG), \ 1422 $(if $(strip $(ALL_MODULES.$(m).INSTALLED)),,\ 1423 $(warning $(ALL_MODULES.$(m).MAKEFILE): Module '$(m)' in PRODUCT_PACKAGES_DEBUG has nothing to install!))) 1424 $(foreach m, $(PRODUCT_PACKAGES_ENG), \ 1425 $(if $(strip $(ALL_MODULES.$(m).INSTALLED)),,\ 1426 $(warning $(ALL_MODULES.$(m).MAKEFILE): Module '$(m)' in PRODUCT_PACKAGES_ENG has nothing to install!))) 1427 $(foreach m, $(PRODUCT_PACKAGES_TESTS), \ 1428 $(if $(strip $(ALL_MODULES.$(m).INSTALLED)),,\ 1429 $(warning $(ALL_MODULES.$(m).MAKEFILE): Module '$(m)' in PRODUCT_PACKAGES_TESTS has nothing to install!))) 1430endif 1431 1432# build/make/core/Makefile contains extra stuff that we don't want to pollute this 1433# top-level makefile with. It expects that ALL_DEFAULT_INSTALLED_MODULES 1434# contains everything that's built during the current make, but it also further 1435# extends ALL_DEFAULT_INSTALLED_MODULES. 1436ALL_DEFAULT_INSTALLED_MODULES := $(modules_to_install) 1437include $(BUILD_SYSTEM)/Makefile 1438modules_to_install := $(sort $(ALL_DEFAULT_INSTALLED_MODULES)) 1439ALL_DEFAULT_INSTALLED_MODULES := 1440 1441 1442# Some notice deps refer to module names without prefix or arch suffix where 1443# only the variants with them get built. 1444# fix-notice-deps replaces those unadorned module names with every built variant. 1445$(call fix-notice-deps) 1446 1447# Create a license metadata rule per module. Could happen in base_rules.mk or 1448# notice_files.mk; except, it has to happen after fix-notice-deps to avoid 1449# missing dependency errors. 1450$(call build-license-metadata) 1451 1452 1453# These are additional goals that we build, in order to make sure that there 1454# is as little code as possible in the tree that doesn't build. 1455modules_to_check := $(foreach m,$(ALL_MODULES),$(ALL_MODULES.$(m).CHECKED)) 1456 1457# If you would like to build all goals, and not skip any intermediate 1458# steps, you can pass the "all" modifier goal on the commandline. 1459ifneq ($(filter all,$(MAKECMDGOALS)),) 1460modules_to_check += $(foreach m,$(ALL_MODULES),$(ALL_MODULES.$(m).BUILT)) 1461endif 1462 1463# Build docs as part of checkbuild to catch more breakages. 1464modules_to_check += $(ALL_DOCS) 1465 1466# for easier debugging 1467modules_to_check := $(sort $(modules_to_check)) 1468#$(error modules_to_check $(modules_to_check)) 1469 1470# ------------------------------------------------------------------- 1471# This is used to to get the ordering right, you can also use these, 1472# but they're considered undocumented, so don't complain if their 1473# behavior changes. 1474# An internal target that depends on all copied headers 1475# (see copy_headers.make). Other targets that need the 1476# headers to be copied first can depend on this target. 1477.PHONY: all_copied_headers 1478all_copied_headers: ; 1479 1480$(ALL_C_CPP_ETC_OBJECTS): | all_copied_headers 1481 1482# All the droid stuff, in directories 1483.PHONY: files 1484files: $(modules_to_install) \ 1485 $(INSTALLED_ANDROID_INFO_TXT_TARGET) 1486 1487# ------------------------------------------------------------------- 1488 1489.PHONY: checkbuild 1490checkbuild: $(modules_to_check) droid_targets check-elf-files 1491 1492ifeq (true,$(ANDROID_BUILD_EVERYTHING_BY_DEFAULT)) 1493droid: checkbuild 1494endif 1495 1496.PHONY: ramdisk 1497ramdisk: $(INSTALLED_RAMDISK_TARGET) 1498 1499.PHONY: ramdisk_debug 1500ramdisk_debug: $(INSTALLED_DEBUG_RAMDISK_TARGET) 1501 1502.PHONY: ramdisk_test_harness 1503ramdisk_test_harness: $(INSTALLED_TEST_HARNESS_RAMDISK_TARGET) 1504 1505.PHONY: userdataimage 1506userdataimage: $(INSTALLED_USERDATAIMAGE_TARGET) 1507 1508ifneq (,$(filter userdataimage, $(MAKECMDGOALS))) 1509$(call dist-for-goals, userdataimage, $(BUILT_USERDATAIMAGE_TARGET)) 1510endif 1511 1512.PHONY: cacheimage 1513cacheimage: $(INSTALLED_CACHEIMAGE_TARGET) 1514 1515.PHONY: bptimage 1516bptimage: $(INSTALLED_BPTIMAGE_TARGET) 1517 1518.PHONY: vendorimage 1519vendorimage: $(INSTALLED_VENDORIMAGE_TARGET) 1520 1521.PHONY: vendorbootimage 1522vendorbootimage: $(INSTALLED_VENDOR_BOOTIMAGE_TARGET) 1523 1524.PHONY: vendorbootimage_debug 1525vendorbootimage_debug: $(INSTALLED_VENDOR_DEBUG_BOOTIMAGE_TARGET) 1526 1527.PHONY: vendorbootimage_test_harness 1528vendorbootimage_test_harness: $(INSTALLED_VENDOR_TEST_HARNESS_BOOTIMAGE_TARGET) 1529 1530.PHONY: vendorramdisk 1531vendorramdisk: $(INSTALLED_VENDOR_RAMDISK_TARGET) 1532 1533.PHONY: vendorramdisk_debug 1534vendorramdisk_debug: $(INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET) 1535 1536.PHONY: productimage 1537productimage: $(INSTALLED_PRODUCTIMAGE_TARGET) 1538 1539.PHONY: systemextimage 1540systemextimage: $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) 1541 1542.PHONY: odmimage 1543odmimage: $(INSTALLED_ODMIMAGE_TARGET) 1544 1545.PHONY: vendor_dlkmimage 1546vendor_dlkmimage: $(INSTALLED_VENDOR_DLKMIMAGE_TARGET) 1547 1548.PHONY: odm_dlkmimage 1549odm_dlkmimage: $(INSTALLED_ODM_DLKMIMAGE_TARGET) 1550 1551.PHONY: systemotherimage 1552systemotherimage: $(INSTALLED_SYSTEMOTHERIMAGE_TARGET) 1553 1554.PHONY: superimage_empty 1555superimage_empty: $(INSTALLED_SUPERIMAGE_EMPTY_TARGET) 1556 1557.PHONY: bootimage 1558bootimage: $(INSTALLED_BOOTIMAGE_TARGET) 1559 1560.PHONY: bootimage_debug 1561bootimage_debug: $(INSTALLED_DEBUG_BOOTIMAGE_TARGET) 1562 1563.PHONY: bootimage_test_harness 1564bootimage_test_harness: $(INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET) 1565 1566.PHONY: vbmetaimage 1567vbmetaimage: $(INSTALLED_VBMETAIMAGE_TARGET) 1568 1569.PHONY: vbmetasystemimage 1570vbmetasystemimage: $(INSTALLED_VBMETA_SYSTEMIMAGE_TARGET) 1571 1572.PHONY: vbmetavendorimage 1573vbmetavendorimage: $(INSTALLED_VBMETA_VENDORIMAGE_TARGET) 1574 1575# The droidcore-unbundled target depends on the subset of targets necessary to 1576# perform a full system build (either unbundled or not). 1577.PHONY: droidcore-unbundled 1578droidcore-unbundled: $(filter $(HOST_OUT_ROOT)/%,$(modules_to_install)) \ 1579 $(INSTALLED_SYSTEMIMAGE_TARGET) \ 1580 $(INSTALLED_RAMDISK_TARGET) \ 1581 $(INSTALLED_BOOTIMAGE_TARGET) \ 1582 $(INSTALLED_RADIOIMAGE_TARGET) \ 1583 $(INSTALLED_DEBUG_RAMDISK_TARGET) \ 1584 $(INSTALLED_DEBUG_BOOTIMAGE_TARGET) \ 1585 $(INSTALLED_RECOVERYIMAGE_TARGET) \ 1586 $(INSTALLED_VBMETAIMAGE_TARGET) \ 1587 $(INSTALLED_VBMETA_SYSTEMIMAGE_TARGET) \ 1588 $(INSTALLED_VBMETA_VENDORIMAGE_TARGET) \ 1589 $(INSTALLED_USERDATAIMAGE_TARGET) \ 1590 $(INSTALLED_CACHEIMAGE_TARGET) \ 1591 $(INSTALLED_BPTIMAGE_TARGET) \ 1592 $(INSTALLED_VENDORIMAGE_TARGET) \ 1593 $(INSTALLED_VENDOR_BOOTIMAGE_TARGET) \ 1594 $(INSTALLED_VENDOR_DEBUG_BOOTIMAGE_TARGET) \ 1595 $(INSTALLED_VENDOR_TEST_HARNESS_BOOTIMAGE_TARGET) \ 1596 $(INSTALLED_VENDOR_RAMDISK_TARGET) \ 1597 $(INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET) \ 1598 $(INSTALLED_ODMIMAGE_TARGET) \ 1599 $(INSTALLED_VENDOR_DLKMIMAGE_TARGET) \ 1600 $(INSTALLED_ODM_DLKMIMAGE_TARGET) \ 1601 $(INSTALLED_SUPERIMAGE_EMPTY_TARGET) \ 1602 $(INSTALLED_PRODUCTIMAGE_TARGET) \ 1603 $(INSTALLED_SYSTEMOTHERIMAGE_TARGET) \ 1604 $(INSTALLED_TEST_HARNESS_RAMDISK_TARGET) \ 1605 $(INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET) \ 1606 $(INSTALLED_FILES_FILE) \ 1607 $(INSTALLED_FILES_JSON) \ 1608 $(INSTALLED_FILES_FILE_VENDOR) \ 1609 $(INSTALLED_FILES_JSON_VENDOR) \ 1610 $(INSTALLED_FILES_FILE_ODM) \ 1611 $(INSTALLED_FILES_JSON_ODM) \ 1612 $(INSTALLED_FILES_FILE_VENDOR_DLKM) \ 1613 $(INSTALLED_FILES_JSON_VENDOR_DLKM) \ 1614 $(INSTALLED_FILES_FILE_ODM_DLKM) \ 1615 $(INSTALLED_FILES_JSON_ODM_DLKM) \ 1616 $(INSTALLED_FILES_FILE_PRODUCT) \ 1617 $(INSTALLED_FILES_JSON_PRODUCT) \ 1618 $(INSTALLED_FILES_FILE_SYSTEM_EXT) \ 1619 $(INSTALLED_FILES_JSON_SYSTEM_EXT) \ 1620 $(INSTALLED_FILES_FILE_SYSTEMOTHER) \ 1621 $(INSTALLED_FILES_JSON_SYSTEMOTHER) \ 1622 $(INSTALLED_FILES_FILE_RAMDISK) \ 1623 $(INSTALLED_FILES_JSON_RAMDISK) \ 1624 $(INSTALLED_FILES_FILE_DEBUG_RAMDISK) \ 1625 $(INSTALLED_FILES_JSON_DEBUG_RAMDISK) \ 1626 $(INSTALLED_FILES_FILE_VENDOR_RAMDISK) \ 1627 $(INSTALLED_FILES_JSON_VENDOR_RAMDISK) \ 1628 $(INSTALLED_FILES_FILE_VENDOR_DEBUG_RAMDISK) \ 1629 $(INSTALLED_FILES_JSON_VENDOR_DEBUG_RAMDISK) \ 1630 $(INSTALLED_FILES_FILE_ROOT) \ 1631 $(INSTALLED_FILES_JSON_ROOT) \ 1632 $(INSTALLED_FILES_FILE_RECOVERY) \ 1633 $(INSTALLED_FILES_JSON_RECOVERY) \ 1634 $(INSTALLED_ANDROID_INFO_TXT_TARGET) \ 1635 soong_docs 1636 1637# The droidcore target depends on the droidcore-unbundled subset and any other 1638# targets for a non-unbundled (full source) full system build. 1639.PHONY: droidcore 1640droidcore: droidcore-unbundled 1641 1642# dist_files only for putting your library into the dist directory with a full build. 1643.PHONY: dist_files 1644 1645ifeq ($(SOONG_COLLECT_JAVA_DEPS), true) 1646 $(call dist-for-goals, dist_files, $(SOONG_OUT_DIR)/module_bp_java_deps.json) 1647 $(call dist-for-goals, dist_files, $(PRODUCT_OUT)/module-info.json) 1648endif 1649 1650.PHONY: apps_only 1651ifneq ($(TARGET_BUILD_APPS),) 1652 # If this build is just for apps, only build apps and not the full system by default. 1653 1654 unbundled_build_modules := 1655 ifneq ($(filter all,$(TARGET_BUILD_APPS)),) 1656 # If they used the magic goal "all" then build all apps in the source tree. 1657 unbundled_build_modules := $(foreach m,$(sort $(ALL_MODULES)),$(if $(filter APPS,$(ALL_MODULES.$(m).CLASS)),$(m))) 1658 else 1659 unbundled_build_modules := $(TARGET_BUILD_APPS) 1660 endif 1661 1662 # Dist the installed files if they exist. 1663 apps_only_installed_files := $(foreach m,$(unbundled_build_modules),$(ALL_MODULES.$(m).INSTALLED)) 1664 $(call dist-for-goals,apps_only, $(apps_only_installed_files)) 1665 1666 # Dist the bundle files if they exist. 1667 apps_only_bundle_files := $(foreach m,$(unbundled_build_modules),\ 1668 $(if $(ALL_MODULES.$(m).BUNDLE),$(ALL_MODULES.$(m).BUNDLE):$(m)-base.zip)) 1669 $(call dist-for-goals,apps_only, $(apps_only_bundle_files)) 1670 1671 # Dist the lint reports if they exist. 1672 apps_only_lint_report_files := $(foreach m,$(unbundled_build_modules),\ 1673 $(foreach report,$(ALL_MODULES.$(m).LINT_REPORTS),\ 1674 $(report):$(m)-$(notdir $(report)))) 1675 .PHONY: lint-check 1676 lint-check: $(foreach f, $(apps_only_lint_report_files), $(call word-colon,1,$(f))) 1677 $(call dist-for-goals,lint-check, $(apps_only_lint_report_files)) 1678 1679 # For uninstallable modules such as static Java library, we have to dist the built file, 1680 # as <module_name>.<suffix> 1681 apps_only_dist_built_files := $(foreach m,$(unbundled_build_modules),$(if $(ALL_MODULES.$(m).INSTALLED),,\ 1682 $(if $(ALL_MODULES.$(m).BUILT),$(ALL_MODULES.$(m).BUILT):$(m)$(suffix $(ALL_MODULES.$(m).BUILT)))\ 1683 $(if $(ALL_MODULES.$(m).AAR),$(ALL_MODULES.$(m).AAR):$(m).aar)\ 1684 )) 1685 $(call dist-for-goals,apps_only, $(apps_only_dist_built_files)) 1686 1687 ifeq ($(EMMA_INSTRUMENT),true) 1688 $(JACOCO_REPORT_CLASSES_ALL) : $(apps_only_installed_files) 1689 $(call dist-for-goals,apps_only, $(JACOCO_REPORT_CLASSES_ALL)) 1690 endif 1691 1692 $(PROGUARD_DICT_ZIP) : $(apps_only_installed_files) 1693 $(call dist-for-goals,apps_only, $(PROGUARD_DICT_ZIP)) 1694 1695 $(PROGUARD_USAGE_ZIP) : $(apps_only_installed_files) 1696 $(call dist-for-goals,apps_only, $(PROGUARD_USAGE_ZIP)) 1697 1698 $(SYMBOLS_ZIP) : $(apps_only_installed_files) 1699 $(call dist-for-goals,apps_only, $(SYMBOLS_ZIP)) 1700 1701 $(COVERAGE_ZIP) : $(apps_only_installed_files) 1702 $(call dist-for-goals,apps_only, $(COVERAGE_ZIP)) 1703 1704apps_only: $(unbundled_build_modules) 1705 1706droid_targets: apps_only 1707 1708# Combine the NOTICE files for a apps_only build 1709$(eval $(call combine-notice-files, html, \ 1710 $(target_notice_file_txt), \ 1711 $(target_notice_file_html_or_xml), \ 1712 "Notices for files for apps:", \ 1713 $(TARGET_OUT_NOTICE_FILES), \ 1714 $(apps_only_installed_files))) 1715 1716 1717else ifeq ($(TARGET_BUILD_UNBUNDLED),$(TARGET_BUILD_UNBUNDLED_IMAGE)) 1718 1719 # Truth table for entering this block of code: 1720 # TARGET_BUILD_UNBUNDLED | TARGET_BUILD_UNBUNDLED_IMAGE | Action 1721 # -----------------------|------------------------------|------------------------- 1722 # not set | not set | droidcore path 1723 # not set | true | invalid 1724 # true | not set | skip 1725 # true | true | droidcore-unbundled path 1726 1727 # We dist the following targets only for droidcore full build. These items 1728 # can include java-related targets that would cause building framework java 1729 # sources in a droidcore full build. 1730 1731 $(call dist-for-goals, droidcore, \ 1732 $(BUILT_OTATOOLS_PACKAGE) \ 1733 $(APPCOMPAT_ZIP) \ 1734 $(DEXPREOPT_CONFIG_ZIP) \ 1735 $(DEXPREOPT_TOOLS_ZIP) \ 1736 ) 1737 1738 # We dist the following targets for droidcore-unbundled (and droidcore since 1739 # droidcore depends on droidcore-unbundled). The droidcore-unbundled target 1740 # is a subset of droidcore. It can be used used for an unbundled build to 1741 # avoid disting targets that would cause building framework java sources, 1742 # which we want to avoid in an unbundled build. 1743 1744 $(call dist-for-goals, droidcore-unbundled, \ 1745 $(INTERNAL_UPDATE_PACKAGE_TARGET) \ 1746 $(INTERNAL_OTA_PACKAGE_TARGET) \ 1747 $(INTERNAL_OTA_METADATA) \ 1748 $(INTERNAL_OTA_PARTIAL_PACKAGE_TARGET) \ 1749 $(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET) \ 1750 $(SYMBOLS_ZIP) \ 1751 $(PROGUARD_DICT_ZIP) \ 1752 $(PROGUARD_USAGE_ZIP) \ 1753 $(COVERAGE_ZIP) \ 1754 $(INSTALLED_FILES_FILE) \ 1755 $(INSTALLED_FILES_JSON) \ 1756 $(INSTALLED_FILES_FILE_VENDOR) \ 1757 $(INSTALLED_FILES_JSON_VENDOR) \ 1758 $(INSTALLED_FILES_FILE_ODM) \ 1759 $(INSTALLED_FILES_JSON_ODM) \ 1760 $(INSTALLED_FILES_FILE_VENDOR_DLKM) \ 1761 $(INSTALLED_FILES_JSON_VENDOR_DLKM) \ 1762 $(INSTALLED_FILES_FILE_ODM_DLKM) \ 1763 $(INSTALLED_FILES_JSON_ODM_DLKM) \ 1764 $(INSTALLED_FILES_FILE_PRODUCT) \ 1765 $(INSTALLED_FILES_JSON_PRODUCT) \ 1766 $(INSTALLED_FILES_FILE_SYSTEM_EXT) \ 1767 $(INSTALLED_FILES_JSON_SYSTEM_EXT) \ 1768 $(INSTALLED_FILES_FILE_SYSTEMOTHER) \ 1769 $(INSTALLED_FILES_JSON_SYSTEMOTHER) \ 1770 $(INSTALLED_FILES_FILE_RECOVERY) \ 1771 $(INSTALLED_FILES_JSON_RECOVERY) \ 1772 $(INSTALLED_BUILD_PROP_TARGET):build.prop \ 1773 $(INSTALLED_VENDOR_BUILD_PROP_TARGET):build.prop-vendor \ 1774 $(INSTALLED_PRODUCT_BUILD_PROP_TARGET):build.prop-product \ 1775 $(INSTALLED_ODM_BUILD_PROP_TARGET):build.prop-odm \ 1776 $(INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET):build.prop-system_ext \ 1777 $(INSTALLED_RAMDISK_BUILD_PROP_TARGET):build.prop-ramdisk \ 1778 $(BUILT_TARGET_FILES_PACKAGE) \ 1779 $(INSTALLED_ANDROID_INFO_TXT_TARGET) \ 1780 $(INSTALLED_MISC_INFO_TARGET) \ 1781 $(INSTALLED_RAMDISK_TARGET) \ 1782 ) 1783 1784 # Put a copy of the radio/bootloader files in the dist dir. 1785 $(foreach f,$(INSTALLED_RADIOIMAGE_TARGET), \ 1786 $(call dist-for-goals, droidcore-unbundled, $(f))) 1787 1788 ifneq ($(ANDROID_BUILD_EMBEDDED),true) 1789 $(call dist-for-goals, droidcore, \ 1790 $(APPS_ZIP) \ 1791 $(INTERNAL_EMULATOR_PACKAGE_TARGET) \ 1792 ) 1793 endif 1794 1795 $(call dist-for-goals, droidcore-unbundled, \ 1796 $(INSTALLED_FILES_FILE_ROOT) \ 1797 $(INSTALLED_FILES_JSON_ROOT) \ 1798 ) 1799 1800 ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true) 1801 $(call dist-for-goals, droidcore-unbundled, \ 1802 $(INSTALLED_FILES_FILE_RAMDISK) \ 1803 $(INSTALLED_FILES_JSON_RAMDISK) \ 1804 $(INSTALLED_FILES_FILE_DEBUG_RAMDISK) \ 1805 $(INSTALLED_FILES_JSON_DEBUG_RAMDISK) \ 1806 $(INSTALLED_FILES_FILE_VENDOR_RAMDISK) \ 1807 $(INSTALLED_FILES_JSON_VENDOR_RAMDISK) \ 1808 $(INSTALLED_FILES_FILE_VENDOR_DEBUG_RAMDISK) \ 1809 $(INSTALLED_FILES_JSON_VENDOR_DEBUG_RAMDISK) \ 1810 $(INSTALLED_DEBUG_RAMDISK_TARGET) \ 1811 $(INSTALLED_DEBUG_BOOTIMAGE_TARGET) \ 1812 $(INSTALLED_TEST_HARNESS_RAMDISK_TARGET) \ 1813 $(INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET) \ 1814 $(INSTALLED_VENDOR_DEBUG_BOOTIMAGE_TARGET) \ 1815 $(INSTALLED_VENDOR_TEST_HARNESS_BOOTIMAGE_TARGET) \ 1816 $(INSTALLED_VENDOR_RAMDISK_TARGET) \ 1817 $(INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET) \ 1818 ) 1819 endif 1820 1821 ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true) 1822 $(call dist-for-goals, droidcore-unbundled, \ 1823 $(recovery_ramdisk) \ 1824 ) 1825 endif 1826 1827 ifeq ($(EMMA_INSTRUMENT),true) 1828 $(call dist-for-goals, dist_files, $(JACOCO_REPORT_CLASSES_ALL)) 1829 endif 1830 1831 # Put XML formatted API files in the dist dir. 1832 $(TARGET_OUT_COMMON_INTERMEDIATES)/api.xml: $(call java-lib-files,android_stubs_current) $(APICHECK) 1833 $(TARGET_OUT_COMMON_INTERMEDIATES)/system-api.xml: $(call java-lib-files,android_system_stubs_current) $(APICHECK) 1834 $(TARGET_OUT_COMMON_INTERMEDIATES)/module-lib-api.xml: $(call java-lib-files,android_module_lib_stubs_current) $(APICHECK) 1835 $(TARGET_OUT_COMMON_INTERMEDIATES)/system-server-api.xml: $(call java-lib-files,android_system_server_stubs_current) $(APICHECK) 1836 $(TARGET_OUT_COMMON_INTERMEDIATES)/test-api.xml: $(call java-lib-files,android_test_stubs_current) $(APICHECK) 1837 1838 api_xmls := $(addprefix $(TARGET_OUT_COMMON_INTERMEDIATES)/,api.xml system-api.xml module-lib-api.xml system-server-api.xml test-api.xml) 1839 $(api_xmls): 1840 $(hide) echo "Converting API file to XML: $@" 1841 $(hide) mkdir -p $(dir $@) 1842 $(hide) $(APICHECK_COMMAND) --input-api-jar $< --api-xml $@ 1843 1844 $(call dist-for-goals, dist_files, $(api_xmls)) 1845 api_xmls := 1846 1847 ifdef CLANG_COVERAGE 1848 $(foreach f,$(SOONG_NDK_API_XML), \ 1849 $(call dist-for-goals,droidcore,$(f):ndk_apis/$(notdir $(f)))) 1850 endif 1851 1852 # For full system build (whether unbundled or not), we configure 1853 # droid_targets to depend on droidcore-unbundled, which will set up the full 1854 # system dependencies and also dist the subset of targets that correspond to 1855 # an unbundled build (exclude building some framework sources). 1856 1857 droid_targets: droidcore-unbundled 1858 1859 ifeq (,$(TARGET_BUILD_UNBUNDLED_IMAGE)) 1860 1861 # If we're building a full system (including the framework sources excluded 1862 # by droidcore-unbundled), we configure droid_targets also to depend on 1863 # droidcore, which includes all dist for droidcore, and will build the 1864 # necessary framework sources. 1865 1866 droid_targets: droidcore dist_files 1867 1868 endif 1869 1870endif # TARGET_BUILD_UNBUNDLED == TARGET_BUILD_UNBUNDLED_IMAGE 1871 1872.PHONY: docs 1873docs: $(ALL_DOCS) 1874 1875.PHONY: sdk win_sdk winsdk-tools sdk_addon 1876ALL_SDK_TARGETS := $(INTERNAL_SDK_TARGET) 1877sdk: $(ALL_SDK_TARGETS) 1878$(call dist-for-goals,sdk win_sdk, \ 1879 $(ALL_SDK_TARGETS) \ 1880 $(SYMBOLS_ZIP) \ 1881 $(COVERAGE_ZIP) \ 1882 $(APPCOMPAT_ZIP) \ 1883 $(INSTALLED_BUILD_PROP_TARGET) \ 1884) 1885 1886# umbrella targets to assit engineers in verifying builds 1887.PHONY: java native target host java-host java-target native-host native-target \ 1888 java-host-tests java-target-tests native-host-tests native-target-tests \ 1889 java-tests native-tests host-tests target-tests tests java-dex \ 1890 native-host-cross 1891# some synonyms 1892.PHONY: host-java target-java host-native target-native \ 1893 target-java-tests target-native-tests 1894host-java : java-host 1895target-java : java-target 1896host-native : native-host 1897target-native : native-target 1898target-java-tests : java-target-tests 1899target-native-tests : native-target-tests 1900tests : host-tests target-tests 1901 1902# Phony target to run all java compilations that use javac 1903.PHONY: javac-check 1904 1905.PHONY: findbugs 1906findbugs: $(INTERNAL_FINDBUGS_HTML_TARGET) $(INTERNAL_FINDBUGS_XML_TARGET) 1907 1908LSDUMP_PATHS_FILE := $(PRODUCT_OUT)/lsdump_paths.txt 1909 1910.PHONY: findlsdumps 1911# LSDUMP_PATHS is a list of tag:path. 1912findlsdumps: $(LSDUMP_PATHS_FILE) $(foreach p,$(LSDUMP_PATHS),$(call word-colon,2,$(p))) 1913 1914$(LSDUMP_PATHS_FILE): PRIVATE_LSDUMP_PATHS := $(LSDUMP_PATHS) 1915$(LSDUMP_PATHS_FILE): 1916 @echo "Generate $@" 1917 @rm -rf $@ && echo -e "$(subst :,:$(space),$(subst $(space),\n,$(PRIVATE_LSDUMP_PATHS)))" > $@ 1918 1919.PHONY: check-elf-files 1920check-elf-files: 1921 1922#xxx scrape this from ALL_MODULE_NAME_TAGS 1923.PHONY: modules 1924modules: 1925 @echo "Available sub-modules:" 1926 @echo "$(call module-names-for-tag-list,$(ALL_MODULE_TAGS))" | \ 1927 tr -s ' ' '\n' | sort -u 1928 1929.PHONY: dump-files 1930dump-files: 1931 @echo "Target files for $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) ($(INTERNAL_PRODUCT)):" 1932 @echo $(sort $(patsubst $(PRODUCT_OUT)/%,%,$(filter $(PRODUCT_OUT)/%,$(modules_to_install)))) | tr -s ' ' '\n' 1933 @echo Successfully dumped product target file list. 1934 1935.PHONY: nothing 1936nothing: 1937 @echo Successfully read the makefiles. 1938 1939.PHONY: tidy_only 1940tidy_only: 1941 @echo Successfully make tidy_only. 1942 1943ndk: $(SOONG_OUT_DIR)/ndk.timestamp 1944.PHONY: ndk 1945 1946# Checks that allowed_deps.txt remains up to date 1947ifneq ($(UNSAFE_DISABLE_APEX_ALLOWED_DEPS_CHECK),true) 1948 droidcore: ${APEX_ALLOWED_DEPS_CHECK} 1949endif 1950 1951$(call dist-write-file,$(KATI_PACKAGE_MK_DIR)/dist.mk) 1952 1953$(info [$(call inc_and_print,subdir_makefiles_inc)/$(subdir_makefiles_total)] writing build rules ...) 1954