1# This is included by the top-level Makefile. 2# It sets up standard variables based on the 3# current configuration and platform, which 4# are not specific to what is being built. 5 6ifndef KATI 7$(warning Directly using config.mk from make is no longer supported.) 8$(warning ) 9$(warning If you are just attempting to build, you probably need to re-source envsetup.sh:) 10$(warning ) 11$(warning $$ source build/envsetup.sh) 12$(warning ) 13$(warning If you are attempting to emulate get_build_var, use one of the following:) 14$(warning $$ build/soong/soong_ui.bash --dumpvar-mode) 15$(warning $$ build/soong/soong_ui.bash --dumpvars-mode) 16$(warning ) 17$(error done) 18endif 19 20BUILD_SYSTEM :=$= build/make/core 21BUILD_SYSTEM_COMMON :=$= build/make/common 22 23include $(BUILD_SYSTEM_COMMON)/core.mk 24 25# ----------------------------------------------------------------- 26# Rules and functions to help copy important files to DIST_DIR 27# when requested. This must be included once only, and must be included before 28# soong_config (as soong_config calls make_vars-$(TARGET).mk, and soong may 29# propagate calls to dist-for-goals there). 30include $(BUILD_SYSTEM)/distdir.mk 31 32# Mark variables that should be coming as environment variables from soong_ui 33# as readonly 34.KATI_READONLY := OUT_DIR TMPDIR BUILD_DATETIME_FILE 35ifdef CALLED_FROM_SETUP 36 .KATI_READONLY := CALLED_FROM_SETUP 37endif 38ifdef KATI_PACKAGE_MK_DIR 39 .KATI_READONLY := KATI_PACKAGE_MK_DIR 40endif 41 42# Mark variables deprecated/obsolete 43CHANGES_URL := https://android.googlesource.com/platform/build/+/master/Changes.md 44.KATI_READONLY := CHANGES_URL 45$(KATI_obsolete_var PATH,Do not use PATH directly. See $(CHANGES_URL)#PATH) 46$(KATI_obsolete_var PYTHONPATH,Do not use PYTHONPATH directly. See $(CHANGES_URL)#PYTHONPATH) 47$(KATI_obsolete_var OUT,Use OUT_DIR instead. See $(CHANGES_URL)#OUT) 48$(KATI_obsolete_var ANDROID_HOST_OUT,Use HOST_OUT instead. See $(CHANGES_URL)#ANDROID_HOST_OUT) 49$(KATI_obsolete_var ANDROID_PRODUCT_OUT,Use PRODUCT_OUT instead. See $(CHANGES_URL)#ANDROID_PRODUCT_OUT) 50$(KATI_obsolete_var ANDROID_HOST_OUT_TESTCASES,Use HOST_OUT_TESTCASES instead. See $(CHANGES_URL)#ANDROID_HOST_OUT_TESTCASES) 51$(KATI_obsolete_var ANDROID_TARGET_OUT_TESTCASES,Use TARGET_OUT_TESTCASES instead. See $(CHANGES_URL)#ANDROID_TARGET_OUT_TESTCASES) 52$(KATI_obsolete_var ANDROID_BUILD_TOP,Use '.' instead. See $(CHANGES_URL)#ANDROID_BUILD_TOP) 53$(KATI_obsolete_var \ 54 ANDROID_TOOLCHAIN \ 55 ANDROID_TOOLCHAIN_2ND_ARCH \ 56 ANDROID_DEV_SCRIPTS \ 57 ANDROID_EMULATOR_PREBUILTS \ 58 ANDROID_PRE_BUILD_PATHS \ 59 ,See $(CHANGES_URL)#other_envsetup_variables) 60$(KATI_obsolete_var PRODUCT_COMPATIBILITY_MATRIX_LEVEL_OVERRIDE,Set FCM Version in device manifest instead. See $(CHANGES_URL)#PRODUCT_COMPATIBILITY_MATRIX_LEVEL_OVERRIDE) 61$(KATI_obsolete_var USE_CLANG_PLATFORM_BUILD,Clang is the only supported Android compiler. See $(CHANGES_URL)#USE_CLANG_PLATFORM_BUILD) 62$(KATI_obsolete_var BUILD_DROIDDOC,Droiddoc is only supported in Soong. See details on build/soong/java/droiddoc.go) 63$(KATI_obsolete_var BUILD_APIDIFF,Apidiff is only supported in Soong. See details on build/soong/java/droiddoc.go) 64$(KATI_obsolete_var \ 65 DEFAULT_GCC_CPP_STD_VERSION \ 66 HOST_GLOBAL_CFLAGS 2ND_HOST_GLOBAL_CFLAGS \ 67 HOST_GLOBAL_CONLYFLAGS 2ND_HOST_GLOBAL_CONLYFLAGS \ 68 HOST_GLOBAL_CPPFLAGS 2ND_HOST_GLOBAL_CPPFLAGS \ 69 HOST_GLOBAL_LDFLAGS 2ND_HOST_GLOBAL_LDFLAGS \ 70 HOST_GLOBAL_LLDFLAGS 2ND_HOST_GLOBAL_LLDFLAGS \ 71 HOST_CLANG_SUPPORTED 2ND_HOST_CLANG_SUPPORTED \ 72 HOST_CC 2ND_HOST_CC \ 73 HOST_CXX 2ND_HOST_CXX \ 74 HOST_CROSS_GLOBAL_CFLAGS 2ND_HOST_CROSS_GLOBAL_CFLAGS \ 75 HOST_CROSS_GLOBAL_CONLYFLAGS 2ND_HOST_CROSS_GLOBAL_CONLYFLAGS \ 76 HOST_CROSS_GLOBAL_CPPFLAGS 2ND_HOST_CROSS_GLOBAL_CPPFLAGS \ 77 HOST_CROSS_GLOBAL_LDFLAGS 2ND_HOST_CROSS_GLOBAL_LDFLAGS \ 78 HOST_CROSS_GLOBAL_LLDFLAGS 2ND_HOST_CROSS_GLOBAL_LLDFLAGS \ 79 HOST_CROSS_CLANG_SUPPORTED 2ND_HOST_CROSS_CLANG_SUPPORTED \ 80 HOST_CROSS_CC 2ND_HOST_CROSS_CC \ 81 HOST_CROSS_CXX 2ND_HOST_CROSS_CXX \ 82 TARGET_GLOBAL_CFLAGS 2ND_TARGET_GLOBAL_CFLAGS \ 83 TARGET_GLOBAL_CONLYFLAGS 2ND_TARGET_GLOBAL_CONLYFLAGS \ 84 TARGET_GLOBAL_CPPFLAGS 2ND_TARGET_GLOBAL_CPPFLAGS \ 85 TARGET_GLOBAL_LDFLAGS 2ND_TARGET_GLOBAL_LDFLAGS \ 86 TARGET_GLOBAL_LLDFLAGS 2ND_TARGET_GLOBAL_LLDFLAGS \ 87 TARGET_CLANG_SUPPORTED 2ND_TARGET_CLANG_SUPPORTED \ 88 TARGET_CC 2ND_TARGET_CC \ 89 TARGET_CXX 2ND_TARGET_CXX \ 90 TARGET_TOOLCHAIN_ROOT 2ND_TARGET_TOOLCHAIN_ROOT \ 91 HOST_TOOLCHAIN_ROOT 2ND_HOST_TOOLCHAIN_ROOT \ 92 HOST_CROSS_TOOLCHAIN_ROOT 2ND_HOST_CROSS_TOOLCHAIN_ROOT \ 93 HOST_TOOLS_PREFIX 2ND_HOST_TOOLS_PREFIX \ 94 HOST_CROSS_TOOLS_PREFIX 2ND_HOST_CROSS_TOOLS_PREFIX \ 95 HOST_GCC_VERSION 2ND_HOST_GCC_VERSION \ 96 HOST_CROSS_GCC_VERSION 2ND_HOST_CROSS_GCC_VERSION \ 97 TARGET_NDK_GCC_VERSION 2ND_TARGET_NDK_GCC_VERSION \ 98 GLOBAL_CFLAGS_NO_OVERRIDE GLOBAL_CPPFLAGS_NO_OVERRIDE \ 99 ,GCC support has been removed. Use Clang instead) 100$(KATI_obsolete_var DIST_DIR dist_goal,Use dist-for-goals instead. See $(CHANGES_URL)#dist) 101$(KATI_obsolete_var TARGET_ANDROID_FILESYSTEM_CONFIG_H,Use TARGET_FS_CONFIG_GEN instead) 102$(KATI_deprecated_var USER,Use BUILD_USERNAME instead. See $(CHANGES_URL)#USER) 103$(KATI_obsolete_var TARGET_ROOT_OUT_SBIN,/sbin has been removed, use /system/bin instead) 104$(KATI_obsolete_var TARGET_ROOT_OUT_SBIN_UNSTRIPPED,/sbin has been removed, use /system/bin instead) 105$(KATI_obsolete_var BUILD_BROKEN_PHONY_TARGETS) 106$(KATI_obsolete_var BUILD_BROKEN_DUP_COPY_HEADERS) 107$(KATI_obsolete_var BUILD_BROKEN_ENG_DEBUG_TAGS) 108$(KATI_obsolete_export It is a global setting. See $(CHANGES_URL)#export_keyword) 109$(KATI_obsolete_var BUILD_BROKEN_ANDROIDMK_EXPORTS) 110$(KATI_obsolete_var PRODUCT_STATIC_BOOT_CONTROL_HAL,Use shared library module instead. See $(CHANGES_URL)#PRODUCT_STATIC_BOOT_CONTROL_HAL) 111$(KATI_obsolete_var \ 112 ARCH_ARM_HAVE_ARMV7A \ 113 ARCH_DSP_REV \ 114 ARCH_HAVE_ALIGNED_DOUBLES \ 115 ARCH_MIPS_HAS_DSP \ 116 ARCH_MIPS_HAS_FPU \ 117 ARCH_MIPS_REV6 \ 118 ARCH_X86_HAVE_AES_NI \ 119 ARCH_X86_HAVE_AVX \ 120 ARCH_X86_HAVE_AVX2 \ 121 ARCH_X86_HAVE_AVX512 \ 122 ARCH_X86_HAVE_MOVBE \ 123 ARCH_X86_HAVE_POPCNT \ 124 ARCH_X86_HAVE_SSE4 \ 125 ARCH_X86_HAVE_SSE4_2 \ 126 ARCH_X86_HAVE_SSSE3 \ 127) 128$(KATI_obsolete_var PRODUCT_IOT) 129$(KATI_obsolete_var MD5SUM) 130$(KATI_obsolete_var BOARD_HAL_STATIC_LIBRARIES, See $(CHANGES_URL)#BOARD_HAL_STATIC_LIBRARIES) 131$(KATI_obsolete_var LOCAL_HAL_STATIC_LIBRARIES, See $(CHANGES_URL)#BOARD_HAL_STATIC_LIBRARIES) 132$(KATI_obsolete_var \ 133 TARGET_AUX_OS_VARIANT_LIST \ 134 LOCAL_AUX_ARCH \ 135 LOCAL_AUX_CPU \ 136 LOCAL_AUX_OS \ 137 LOCAL_AUX_OS_VARIANT \ 138 LOCAL_AUX_SUBARCH \ 139 LOCAL_AUX_TOOLCHAIN \ 140 LOCAL_CUSTOM_BUILD_STEP_INPUT \ 141 LOCAL_CUSTOM_BUILD_STEP_OUTPUT \ 142 LOCAL_IS_AUX_MODULE \ 143 ,AUX support has been removed) 144$(KATI_obsolete_var HOST_OUT_TEST_CONFIG TARGET_OUT_TEST_CONFIG LOCAL_TEST_CONFIG_OPTIONS) 145$(KATI_obsolete_var \ 146 TARGET_PROJECT_INCLUDES \ 147 2ND_TARGET_PROJECT_INCLUDES \ 148 TARGET_PROJECT_SYSTEM_INCLUDES \ 149 2ND_TARGET_PROJECT_SYSTEM_INCLUDES \ 150 ,Project include variables have been removed) 151$(KATI_obsolete_var TARGET_PREFER_32_BIT TARGET_PREFER_32_BIT_APPS TARGET_PREFER_32_BIT_EXECUTABLES) 152$(KATI_obsolete_var PRODUCT_ARTIFACT_SYSTEM_CERTIFICATE_REQUIREMENT_WHITELIST,Use PRODUCT_ARTIFACT_SYSTEM_CERTIFICATE_REQUIREMENT_ALLOW_LIST.) 153$(KATI_obsolete_var PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST,Use PRODUCT_ARTIFACT_PATH_REQUIREMENT_ALLOWED_LIST.) 154$(KATI_obsolete_var COVERAGE_PATHS,Use NATIVE_COVERAGE_PATHS instead) 155$(KATI_obsolete_var COVERAGE_EXCLUDE_PATHS,Use NATIVE_COVERAGE_EXCLUDE_PATHS instead) 156$(KATI_obsolete_var BOARD_VNDK_RUNTIME_DISABLE,VNDK-Lite is no longer supported.) 157 158# Used to force goals to build. Only use for conditionally defined goals. 159.PHONY: FORCE 160FORCE: 161 162ORIGINAL_MAKECMDGOALS := $(MAKECMDGOALS) 163 164UNAME := $(shell uname -sm) 165 166SRC_TARGET_DIR := $(TOPDIR)build/make/target 167 168# Some specific paths to tools 169SRC_DROIDDOC_DIR := $(TOPDIR)build/make/tools/droiddoc 170 171# Mark some inputs as readonly 172ifdef TARGET_DEVICE_DIR 173 .KATI_READONLY := TARGET_DEVICE_DIR 174endif 175 176ONE_SHOT_MAKEFILE := 177.KATI_READONLY := ONE_SHOT_MAKEFILE 178 179# Set up efficient math functions which are used in make. 180# Here since this file is included by envsetup as well as during build. 181include $(BUILD_SYSTEM_COMMON)/math.mk 182 183include $(BUILD_SYSTEM_COMMON)/strings.mk 184 185include $(BUILD_SYSTEM_COMMON)/json.mk 186 187# Various mappings to avoid hard-coding paths all over the place 188include $(BUILD_SYSTEM)/pathmap.mk 189 190# Allow projects to define their own globally-available variables 191include $(BUILD_SYSTEM)/project_definitions.mk 192 193# ############################################################### 194# Build system internal files 195# ############################################################### 196 197BUILD_COMBOS :=$= $(BUILD_SYSTEM)/combo 198 199CLEAR_VARS :=$= $(BUILD_SYSTEM)/clear_vars.mk 200 201BUILD_HOST_STATIC_LIBRARY :=$= $(BUILD_SYSTEM)/host_static_library.mk 202BUILD_HOST_SHARED_LIBRARY :=$= $(BUILD_SYSTEM)/host_shared_library.mk 203BUILD_STATIC_LIBRARY :=$= $(BUILD_SYSTEM)/static_library.mk 204BUILD_HEADER_LIBRARY :=$= $(BUILD_SYSTEM)/header_library.mk 205BUILD_SHARED_LIBRARY :=$= $(BUILD_SYSTEM)/shared_library.mk 206BUILD_EXECUTABLE :=$= $(BUILD_SYSTEM)/executable.mk 207BUILD_HOST_EXECUTABLE :=$= $(BUILD_SYSTEM)/host_executable.mk 208BUILD_PACKAGE :=$= $(BUILD_SYSTEM)/package.mk 209BUILD_PHONY_PACKAGE :=$= $(BUILD_SYSTEM)/phony_package.mk 210BUILD_RRO_PACKAGE :=$= $(BUILD_SYSTEM)/build_rro_package.mk 211BUILD_HOST_PREBUILT :=$= $(BUILD_SYSTEM)/host_prebuilt.mk 212BUILD_PREBUILT :=$= $(BUILD_SYSTEM)/prebuilt.mk 213BUILD_MULTI_PREBUILT :=$= $(BUILD_SYSTEM)/multi_prebuilt.mk 214BUILD_JAVA_LIBRARY :=$= $(BUILD_SYSTEM)/java_library.mk 215BUILD_STATIC_JAVA_LIBRARY :=$= $(BUILD_SYSTEM)/static_java_library.mk 216BUILD_HOST_JAVA_LIBRARY :=$= $(BUILD_SYSTEM)/host_java_library.mk 217BUILD_COPY_HEADERS :=$= $(BUILD_SYSTEM)/copy_headers.mk 218BUILD_NATIVE_TEST :=$= $(BUILD_SYSTEM)/native_test.mk 219BUILD_FUZZ_TEST :=$= $(BUILD_SYSTEM)/fuzz_test.mk 220 221BUILD_NOTICE_FILE :=$= $(BUILD_SYSTEM)/notice_files.mk 222BUILD_HOST_DALVIK_JAVA_LIBRARY :=$= $(BUILD_SYSTEM)/host_dalvik_java_library.mk 223BUILD_HOST_DALVIK_STATIC_JAVA_LIBRARY :=$= $(BUILD_SYSTEM)/host_dalvik_static_java_library.mk 224 225include $(BUILD_SYSTEM)/deprecation.mk 226 227# ############################################################### 228# Parse out any modifier targets. 229# ############################################################### 230 231hide := @ 232 233################################################################ 234# Tools needed in product configuration makefiles. 235################################################################ 236NORMALIZE_PATH := build/make/tools/normalize_path.py 237 238# $(1): the paths to be normalized 239define normalize-paths 240$(if $(1),$(shell $(NORMALIZE_PATH) $(1))) 241endef 242 243# ############################################################### 244# Set common values 245# ############################################################### 246 247# Initialize SOONG_CONFIG_NAMESPACES so that it isn't recursive. 248SOONG_CONFIG_NAMESPACES := 249 250# The add_soong_config_namespace function adds a namespace and initializes it 251# to be empty. 252# $1 is the namespace. 253# Ex: $(call add_soong_config_namespace,acme) 254 255define add_soong_config_namespace 256$(eval SOONG_CONFIG_NAMESPACES += $1) \ 257$(eval SOONG_CONFIG_$1 :=) 258endef 259 260# The add_soong_config_var function adds a a list of soong config variables to 261# SOONG_CONFIG_*. The variables and their values are then available to a 262# soong_config_module_type in an Android.bp file. 263# $1 is the namespace. $2 is the list of variables. 264# Ex: $(call add_soong_config_var,acme,COOL_FEATURE_A COOL_FEATURE_B) 265define add_soong_config_var 266$(eval SOONG_CONFIG_$1 += $2) \ 267$(foreach v,$2,$(eval SOONG_CONFIG_$1_$v := $($v))) 268endef 269 270# The add_soong_config_var_value function defines a make variable and also adds 271# the variable to SOONG_CONFIG_*. 272# $1 is the namespace. $2 is the variable name. $3 is the variable value. 273# Ex: $(call add_soong_config_var_value,acme,COOL_FEATURE,true) 274 275define add_soong_config_var_value 276$(eval $2 := $3) \ 277$(call add_soong_config_var,$1,$2) 278endef 279 280# Set the extensions used for various packages 281COMMON_PACKAGE_SUFFIX := .zip 282COMMON_JAVA_PACKAGE_SUFFIX := .jar 283COMMON_ANDROID_PACKAGE_SUFFIX := .apk 284 285ifdef TMPDIR 286JAVA_TMPDIR_ARG := -Djava.io.tmpdir=$(TMPDIR) 287else 288JAVA_TMPDIR_ARG := 289endif 290 291# ############################################################### 292# Include sub-configuration files 293# ############################################################### 294 295# --------------------------------------------------------------- 296# Try to include buildspec.mk, which will try to set stuff up. 297# If this file doesn't exist, the environment variables will 298# be used, and if that doesn't work, then the default is an 299# arm build 300ifndef ANDROID_BUILDSPEC 301ANDROID_BUILDSPEC := $(TOPDIR)buildspec.mk 302endif 303-include $(ANDROID_BUILDSPEC) 304 305# --------------------------------------------------------------- 306# Define most of the global variables. These are the ones that 307# are specific to the user's build configuration. 308include $(BUILD_SYSTEM)/envsetup.mk 309 310# Pruned directory options used when using findleaves.py 311# See envsetup.mk for a description of SCAN_EXCLUDE_DIRS 312FIND_LEAVES_EXCLUDES := $(addprefix --prune=, $(SCAN_EXCLUDE_DIRS) .repo .git) 313 314# The build system exposes several variables for where to find the kernel 315# headers: 316# TARGET_DEVICE_KERNEL_HEADERS is automatically created for the current 317# device being built. It is set as $(TARGET_DEVICE_DIR)/kernel-headers, 318# e.g. device/samsung/tuna/kernel-headers. This directory is not 319# explicitly set by anyone, the build system always adds this subdir. 320# 321# TARGET_BOARD_KERNEL_HEADERS is specified by the BoardConfig.mk file 322# to allow other directories to be included. This is useful if there's 323# some common place where a few headers are being kept for a group 324# of devices. For example, device/<vendor>/common/kernel-headers could 325# contain some headers for several of <vendor>'s devices. 326# 327# TARGET_PRODUCT_KERNEL_HEADERS is generated by the product inheritance 328# graph. This allows architecture products to provide headers for the 329# devices using that architecture. For example, 330# hardware/ti/omap4xxx/omap4.mk will specify 331# PRODUCT_VENDOR_KERNEL_HEADERS variable that specify where the omap4 332# specific headers are, e.g. hardware/ti/omap4xxx/kernel-headers. 333# The build system then combines all the values specified by all the 334# PRODUCT_VENDOR_KERNEL_HEADERS directives in the product inheritance 335# tree and then exports a TARGET_PRODUCT_KERNEL_HEADERS variable. 336# 337# The layout of subdirs in any of the kernel-headers dir should mirror the 338# layout of the kernel include/ directory. For example, 339# device/samsung/tuna/kernel-headers/linux/, 340# hardware/ti/omap4xxx/kernel-headers/media/, 341# etc. 342# 343# NOTE: These directories MUST contain post-processed headers using the 344# bionic/libc/kernel/tools/clean_header.py tool. Additionally, the original 345# kernel headers must also be checked in, but in a different subdirectory. By 346# convention, the originals should be checked into original-kernel-headers 347# directory of the same parent dir. For example, 348# device/samsung/tuna/kernel-headers <----- post-processed 349# device/samsung/tuna/original-kernel-headers <----- originals 350# 351TARGET_DEVICE_KERNEL_HEADERS := $(strip $(wildcard $(TARGET_DEVICE_DIR)/kernel-headers)) 352 353define validate-kernel-headers 354$(if $(firstword $(foreach hdr_dir,$(1),\ 355 $(filter-out kernel-headers,$(notdir $(hdr_dir))))),\ 356 $(error Kernel header dirs must be end in kernel-headers: $(1))) 357endef 358# also allow the board config to provide additional directories since 359# there could be device/oem/base_hw and device/oem/derived_hw 360# that both are valid devices but derived_hw needs to use kernel headers 361# from base_hw. 362TARGET_BOARD_KERNEL_HEADERS := $(strip $(wildcard $(TARGET_BOARD_KERNEL_HEADERS))) 363TARGET_BOARD_KERNEL_HEADERS := $(patsubst %/,%,$(TARGET_BOARD_KERNEL_HEADERS)) 364$(call validate-kernel-headers,$(TARGET_BOARD_KERNEL_HEADERS)) 365 366# then add product-inherited includes, to allow for 367# hardware/sivendor/chip/chip.mk to include their own headers 368TARGET_PRODUCT_KERNEL_HEADERS := $(strip $(wildcard $(PRODUCT_VENDOR_KERNEL_HEADERS))) 369TARGET_PRODUCT_KERNEL_HEADERS := $(patsubst %/,%,$(TARGET_PRODUCT_KERNEL_HEADERS)) 370$(call validate-kernel-headers,$(TARGET_PRODUCT_KERNEL_HEADERS)) 371.KATI_READONLY := TARGET_DEVICE_KERNEL_HEADERS TARGET_BOARD_KERNEL_HEADERS TARGET_PRODUCT_KERNEL_HEADERS 372 373# Commands to generate .toc file common to ELF .so files. 374define _gen_toc_command_for_elf 375$(hide) ($($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)READELF) -d $(1) | grep SONAME || echo "No SONAME for $1") > $(2) 376$(hide) $($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)READELF) --dyn-syms $(1) | awk '{$$2=""; $$3=""; print}' >> $(2) 377endef 378 379# Commands to generate .toc file from Darwin dynamic library. 380define _gen_toc_command_for_macho 381$(hide) $(HOST_OTOOL) -l $(1) | grep LC_ID_DYLIB -A 5 > $(2) 382$(hide) $(HOST_NM) -gP $(1) | cut -f1-2 -d" " | (grep -v U$$ >> $(2) || true) 383endef 384 385ifeq ($(CALLED_FROM_SETUP),true) 386include $(BUILD_SYSTEM)/ccache.mk 387include $(BUILD_SYSTEM)/goma.mk 388include $(BUILD_SYSTEM)/rbe.mk 389endif 390 391# GCC version selection 392TARGET_GCC_VERSION := 4.9 393ifdef TARGET_2ND_ARCH 3942ND_TARGET_GCC_VERSION := 4.9 395endif 396 397# Normalize WITH_STATIC_ANALYZER 398ifeq ($(strip $(WITH_STATIC_ANALYZER)),0) 399 WITH_STATIC_ANALYZER := 400endif 401 402# Unset WITH_TIDY_ONLY if global WITH_TIDY_ONLY is not true nor 1. 403ifeq (,$(filter 1 true,$(WITH_TIDY_ONLY))) 404 WITH_TIDY_ONLY := 405endif 406 407# Pick a Java compiler. 408include $(BUILD_SYSTEM)/combo/javac.mk 409 410# --------------------------------------------------------------- 411# Check that the configuration is current. We check that 412# BUILD_ENV_SEQUENCE_NUMBER is current against this value. 413# Don't fail if we're called from envsetup, so they have a 414# chance to update their environment. 415 416ifeq (,$(strip $(CALLED_FROM_SETUP))) 417ifneq (,$(strip $(BUILD_ENV_SEQUENCE_NUMBER))) 418ifneq ($(BUILD_ENV_SEQUENCE_NUMBER),$(CORRECT_BUILD_ENV_SEQUENCE_NUMBER)) 419$(warning BUILD_ENV_SEQUENCE_NUMBER is set incorrectly.) 420$(info *** If you use envsetup/lunch/choosecombo:) 421$(info *** - Re-execute envsetup (". envsetup.sh")) 422$(info *** - Re-run lunch or choosecombo) 423$(info *** If you use buildspec.mk:) 424$(info *** - Look at buildspec.mk.default to see what has changed) 425$(info *** - Update BUILD_ENV_SEQUENCE_NUMBER to "$(CORRECT_BUILD_ENV_SEQUENCE_NUMBER)") 426$(error bailing..) 427endif 428endif 429endif 430 431# Set up PDK so we can use TARGET_BUILD_PDK to select prebuilt tools below 432.PHONY: pdk fusion 433pdk fusion: $(DEFAULT_GOAL) 434 435# What to build: 436# pdk fusion if: 437# 1) PDK_FUSION_PLATFORM_ZIP / PDK_FUSION_PLATFORM_DIR is passed in from the environment 438# or 439# 2) the platform.zip / pdk.mk exists in the default location 440# or 441# 3) fusion is a command line build goal, 442# PDK_FUSION_PLATFORM_ZIP is needed anyway, then do we need the 'fusion' goal? 443# otherwise pdk only if: 444# 1) pdk is a command line build goal 445# or 446# 2) TARGET_BUILD_PDK is passed in from the environment 447 448# if PDK_FUSION_PLATFORM_ZIP or PDK_FUSION_PLATFORM_DIR is specified, do not override. 449ifeq (,$(strip $(PDK_FUSION_PLATFORM_ZIP)$(PDK_FUSION_PLATFORM_DIR))) 450 # Most PDK project paths should be using vendor/pdk/TARGET_DEVICE 451 # but some legacy ones (e.g. mini_armv7a_neon generic PDK) were setup 452 # with vendor/pdk/TARGET_PRODUCT. 453 # Others are set up with vendor/pdk/TARGET_DEVICE/TARGET_DEVICE-userdebug 454 _pdk_fusion_search_paths := \ 455 vendor/pdk/$(TARGET_DEVICE)/$(TARGET_DEVICE)-$(TARGET_BUILD_VARIANT)/platform \ 456 vendor/pdk/$(TARGET_DEVICE)/$(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)/platform \ 457 vendor/pdk/$(TARGET_DEVICE)/$(patsubst aosp_%,full_%,$(TARGET_PRODUCT))-$(TARGET_BUILD_VARIANT)/platform \ 458 vendor/pdk/$(TARGET_PRODUCT)/$(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)/platform \ 459 vendor/pdk/$(TARGET_PRODUCT)/$(patsubst aosp_%,full_%,$(TARGET_PRODUCT))-$(TARGET_BUILD_VARIANT)/platform 460 461 _pdk_fusion_default_platform_zip := $(strip $(foreach p,$(_pdk_fusion_search_paths),$(wildcard $(p)/platform.zip))) 462 ifneq (,$(_pdk_fusion_default_platform_zip)) 463 PDK_FUSION_PLATFORM_ZIP := $(word 1, $(_pdk_fusion_default_platform_zip)) 464 _pdk_fusion_default_platform_zip := 465 else 466 _pdk_fusion_default_platform_mk := $(strip $(foreach p,$(_pdk_fusion_search_paths),$(wildcard $(p)/pdk.mk))) 467 ifneq (,$(_pdk_fusion_default_platform_mk)) 468 PDK_FUSION_PLATFORM_DIR := $(dir $(word 1,$(_pdk_fusion_default_platform_mk))) 469 _pdk_fusion_default_platform_mk := 470 endif 471 endif # _pdk_fusion_default_platform_zip 472 _pdk_fusion_search_paths := 473endif # !PDK_FUSION_PLATFORM_ZIP && !PDK_FUSION_PLATFORM_DIR 474 475ifneq (,$(PDK_FUSION_PLATFORM_ZIP)) 476 ifneq (,$(PDK_FUSION_PLATFORM_DIR)) 477 $(error Only one of PDK_FUSION_PLATFORM_ZIP or PDK_FUSION_PLATFORM_DIR may be specified) 478 endif 479endif 480 481ifneq (,$(filter pdk fusion, $(MAKECMDGOALS))) 482TARGET_BUILD_PDK := true 483ifneq (,$(filter fusion, $(MAKECMDGOALS))) 484ifeq (,$(strip $(PDK_FUSION_PLATFORM_ZIP)$(PDK_FUSION_PLATFORM_DIR))) 485 $(error Specify PDK_FUSION_PLATFORM_ZIP or PDK_FUSION_PLATFORM_DIR to do a PDK fusion.) 486endif 487endif # fusion 488endif # pdk or fusion 489 490ifdef PDK_FUSION_PLATFORM_ZIP 491TARGET_BUILD_PDK := true 492ifeq (,$(wildcard $(PDK_FUSION_PLATFORM_ZIP))) 493 ifneq (,$(wildcard $(patsubst %.zip,%,$(PDK_FUSION_PLATFORM_ZIP))/pdk.mk)) 494 PDK_FUSION_PLATFORM_DIR := $(patsubst %.zip,%,$(PDK_FUSION_PLATFORM_ZIP)) 495 PDK_FUSION_PLATFORM_ZIP := 496 else 497 $(error Cannot find file $(PDK_FUSION_PLATFORM_ZIP).) 498 endif 499endif 500endif 501 502ifdef PDK_FUSION_PLATFORM_DIR 503TARGET_BUILD_PDK := true 504ifeq (,$(wildcard $(PDK_FUSION_PLATFORM_DIR)/pdk.mk)) 505 $(error Cannot find file $(PDK_FUSION_PLATFORM_DIR)/pdk.mk.) 506endif 507endif 508 509BUILD_PLATFORM_ZIP := $(filter platform platform-java,$(MAKECMDGOALS)) 510 511# --------------------------------------------------------------- 512# Whether we can expect a full build graph 513ALLOW_MISSING_DEPENDENCIES := $(filter true,$(ALLOW_MISSING_DEPENDENCIES)) 514ifneq ($(TARGET_BUILD_APPS),) 515ALLOW_MISSING_DEPENDENCIES := true 516endif 517ifeq ($(TARGET_BUILD_PDK),true) 518ALLOW_MISSING_DEPENDENCIES := true 519endif 520ifneq ($(filter true,$(SOONG_ALLOW_MISSING_DEPENDENCIES)),) 521ALLOW_MISSING_DEPENDENCIES := true 522endif 523.KATI_READONLY := ALLOW_MISSING_DEPENDENCIES 524 525TARGET_BUILD_APPS_USE_PREBUILT_SDK := 526ifdef TARGET_BUILD_APPS 527 ifndef UNBUNDLED_BUILD_SDKS_FROM_SOURCE 528 TARGET_BUILD_APPS_USE_PREBUILT_SDK := true 529 endif 530endif 531 532prebuilt_sdk_tools := prebuilts/sdk/tools 533prebuilt_sdk_tools_bin := $(prebuilt_sdk_tools)/$(HOST_OS)/bin 534 535prebuilt_build_tools := prebuilts/build-tools 536prebuilt_build_tools_wrappers := prebuilts/build-tools/common/bin 537prebuilt_build_tools_jars := prebuilts/build-tools/common/framework 538prebuilt_build_tools_bin_noasan := $(prebuilt_build_tools)/$(HOST_PREBUILT_TAG)/bin 539ifeq ($(filter address,$(SANITIZE_HOST)),) 540prebuilt_build_tools_bin := $(prebuilt_build_tools_bin_noasan) 541else 542prebuilt_build_tools_bin := $(prebuilt_build_tools)/$(HOST_PREBUILT_TAG)/asan/bin 543endif 544 545USE_PREBUILT_SDK_TOOLS_IN_PLACE := true 546 547# Work around for b/68406220 548# This should match the soong version. 549USE_D8 := true 550.KATI_READONLY := USE_D8 551 552# 553# Tools that are prebuilts for TARGET_BUILD_APPS 554# 555ifeq (,$(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK))) 556 AAPT := $(HOST_OUT_EXECUTABLES)/aapt 557 MAINDEXCLASSES := $(HOST_OUT_EXECUTABLES)/mainDexClasses 558 559else # TARGET_BUILD_APPS || TARGET_BUILD_PDK 560 AAPT := $(prebuilt_sdk_tools_bin)/aapt 561 MAINDEXCLASSES := $(prebuilt_sdk_tools)/mainDexClasses 562endif # TARGET_BUILD_APPS || TARGET_BUILD_PDK 563 564ifeq (,$(TARGET_BUILD_APPS)) 565 # Use RenderScript prebuilts for unbundled builds but not PDK builds 566 LLVM_RS_CC := $(HOST_OUT_EXECUTABLES)/llvm-rs-cc 567 BCC_COMPAT := $(HOST_OUT_EXECUTABLES)/bcc_compat 568else 569 LLVM_RS_CC := $(prebuilt_sdk_tools_bin)/llvm-rs-cc 570 BCC_COMPAT := $(prebuilt_sdk_tools_bin)/bcc_compat 571endif # TARGET_BUILD_PDK 572 573prebuilt_sdk_tools := 574prebuilt_sdk_tools_bin := 575 576ACP := $(prebuilt_build_tools_bin)/acp 577CKATI := $(prebuilt_build_tools_bin)/ckati 578DEPMOD := $(HOST_OUT_EXECUTABLES)/depmod 579FILESLIST := $(SOONG_HOST_OUT_EXECUTABLES)/fileslist 580FILESLIST_UTIL :=$= build/make/tools/fileslist_util.py 581HOST_INIT_VERIFIER := $(HOST_OUT_EXECUTABLES)/host_init_verifier 582XMLLINT := $(SOONG_HOST_OUT_EXECUTABLES)/xmllint 583 584# SOONG_ZIP is exported by Soong, but needs to be defined early for 585# $OUT/dexpreopt.global. It will be verified against the Soong version. 586SOONG_ZIP := $(SOONG_HOST_OUT_EXECUTABLES)/soong_zip 587 588# --------------------------------------------------------------- 589# Generic tools. 590 591LEX := $(prebuilt_build_tools_bin_noasan)/flex 592# The default PKGDATADIR built in the prebuilt bison is a relative path 593# prebuilts/build-tools/common/bison. 594# To run bison from elsewhere you need to set up enviromental variable 595# BISON_PKGDATADIR. 596BISON_PKGDATADIR := $(prebuilt_build_tools)/common/bison 597BISON := $(prebuilt_build_tools_bin_noasan)/bison 598YACC := $(BISON) -d 599BISON_DATA := $(wildcard $(BISON_PKGDATADIR)/* $(BISON_PKGDATADIR)/*/*) 600M4 :=$= $(prebuilt_build_tools_bin_noasan)/m4 601 602YASM := prebuilts/misc/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/yasm/yasm 603 604DOXYGEN:= doxygen 605ifeq ($(HOST_OS),linux) 606BREAKPAD_DUMP_SYMS := $(HOST_OUT_EXECUTABLES)/dump_syms 607else 608# For non-supported hosts, do not generate breakpad symbols. 609BREAKPAD_GENERATE_SYMBOLS := false 610endif 611PROTOC := $(HOST_OUT_EXECUTABLES)/aprotoc$(HOST_EXECUTABLE_SUFFIX) 612NANOPB_SRCS := $(HOST_OUT_EXECUTABLES)/protoc-gen-nanopb 613VTSC := $(HOST_OUT_EXECUTABLES)/vtsc$(HOST_EXECUTABLE_SUFFIX) 614MKBOOTFS := $(HOST_OUT_EXECUTABLES)/mkbootfs$(HOST_EXECUTABLE_SUFFIX) 615MINIGZIP := $(HOST_OUT_EXECUTABLES)/minigzip$(HOST_EXECUTABLE_SUFFIX) 616LZ4 := $(HOST_OUT_EXECUTABLES)/lz4$(HOST_EXECUTABLE_SUFFIX) 617ifeq (,$(strip $(BOARD_CUSTOM_MKBOOTIMG))) 618MKBOOTIMG := $(HOST_OUT_EXECUTABLES)/mkbootimg$(HOST_EXECUTABLE_SUFFIX) 619else 620MKBOOTIMG := $(BOARD_CUSTOM_MKBOOTIMG) 621endif 622ifeq (,$(strip $(BOARD_CUSTOM_BPTTOOL))) 623BPTTOOL := $(HOST_OUT_EXECUTABLES)/bpttool$(HOST_EXECUTABLE_SUFFIX) 624else 625BPTTOOL := $(BOARD_CUSTOM_BPTTOOL) 626endif 627ifeq (,$(strip $(BOARD_CUSTOM_AVBTOOL))) 628AVBTOOL := $(HOST_OUT_EXECUTABLES)/avbtool$(HOST_EXECUTABLE_SUFFIX) 629else 630AVBTOOL := $(BOARD_CUSTOM_AVBTOOL) 631endif 632APICHECK := $(HOST_OUT_JAVA_LIBRARIES)/metalava$(COMMON_JAVA_PACKAGE_SUFFIX) 633FS_GET_STATS := $(HOST_OUT_EXECUTABLES)/fs_get_stats$(HOST_EXECUTABLE_SUFFIX) 634MKEXTUSERIMG := $(HOST_OUT_EXECUTABLES)/mkuserimg_mke2fs 635MKE2FS_CONF := system/extras/ext4_utils/mke2fs.conf 636MKSQUASHFSUSERIMG := $(HOST_OUT_EXECUTABLES)/mksquashfsimage.sh 637MKF2FSUSERIMG := $(HOST_OUT_EXECUTABLES)/mkf2fsuserimg.sh 638SIMG2IMG := $(HOST_OUT_EXECUTABLES)/simg2img$(HOST_EXECUTABLE_SUFFIX) 639E2FSCK := $(HOST_OUT_EXECUTABLES)/e2fsck$(HOST_EXECUTABLE_SUFFIX) 640TUNE2FS := $(HOST_OUT_EXECUTABLES)/tune2fs$(HOST_EXECUTABLE_SUFFIX) 641JARJAR := $(HOST_OUT_JAVA_LIBRARIES)/jarjar.jar 642DATA_BINDING_COMPILER := $(HOST_OUT_JAVA_LIBRARIES)/databinding-compiler.jar 643FAT16COPY := build/make/tools/fat16copy.py 644CHECK_ELF_FILE := build/make/tools/check_elf_file.py 645LPMAKE := $(HOST_OUT_EXECUTABLES)/lpmake$(HOST_EXECUTABLE_SUFFIX) 646ADD_IMG_TO_TARGET_FILES := $(HOST_OUT_EXECUTABLES)/add_img_to_target_files$(HOST_EXECUTABLE_SUFFIX) 647BUILD_IMAGE := $(HOST_OUT_EXECUTABLES)/build_image$(HOST_EXECUTABLE_SUFFIX) 648BUILD_SUPER_IMAGE := $(HOST_OUT_EXECUTABLES)/build_super_image$(HOST_EXECUTABLE_SUFFIX) 649IMG_FROM_TARGET_FILES := $(HOST_OUT_EXECUTABLES)/img_from_target_files$(HOST_EXECUTABLE_SUFFIX) 650MAKE_RECOVERY_PATCH := $(HOST_OUT_EXECUTABLES)/make_recovery_patch$(HOST_EXECUTABLE_SUFFIX) 651OTA_FROM_TARGET_FILES := $(HOST_OUT_EXECUTABLES)/ota_from_target_files$(HOST_EXECUTABLE_SUFFIX) 652SPARSE_IMG := $(HOST_OUT_EXECUTABLES)/sparse_img$(HOST_EXECUTABLE_SUFFIX) 653CHECK_PARTITION_SIZES := $(HOST_OUT_EXECUTABLES)/check_partition_sizes$(HOST_EXECUTABLE_SUFFIX) 654 655PROGUARD_HOME := external/proguard 656PROGUARD := $(PROGUARD_HOME)/bin/proguard.sh 657PROGUARD_DEPS := $(PROGUARD) $(PROGUARD_HOME)/lib/proguard.jar 658JAVATAGS := build/make/tools/java-event-log-tags.py 659MERGETAGS := build/make/tools/merge-event-log-tags.py 660APPEND2SIMG := $(HOST_OUT_EXECUTABLES)/append2simg 661VERITY_SIGNER := $(HOST_OUT_EXECUTABLES)/verity_signer 662BUILD_VERITY_METADATA := $(HOST_OUT_EXECUTABLES)/build_verity_metadata 663BUILD_VERITY_TREE := $(HOST_OUT_EXECUTABLES)/build_verity_tree 664BOOT_SIGNER := $(HOST_OUT_EXECUTABLES)/boot_signer 665FUTILITY := $(HOST_OUT_EXECUTABLES)/futility-host 666VBOOT_SIGNER := $(HOST_OUT_EXECUTABLES)/vboot_signer 667FEC := $(HOST_OUT_EXECUTABLES)/fec 668 669DEXDUMP := $(HOST_OUT_EXECUTABLES)/dexdump$(BUILD_EXECUTABLE_SUFFIX) 670PROFMAN := $(HOST_OUT_EXECUTABLES)/profman 671 672FINDBUGS_DIR := external/owasp/sanitizer/tools/findbugs/bin 673FINDBUGS := $(FINDBUGS_DIR)/findbugs 674 675JETIFIER := prebuilts/sdk/tools/jetifier/jetifier-standalone/bin/jetifier-standalone 676 677EXTRACT_KERNEL := build/make/tools/extract_kernel.py 678 679# Path to tools.jar 680HOST_JDK_TOOLS_JAR := $(ANDROID_JAVA8_HOME)/lib/tools.jar 681 682APICHECK_COMMAND := $(JAVA) -Xmx4g -jar $(APICHECK) --no-banner --compatible-output=no 683 684# Boolean variable determining if the allow list for compatible properties is enabled 685PRODUCT_COMPATIBLE_PROPERTY := false 686ifneq ($(PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE),) 687 PRODUCT_COMPATIBLE_PROPERTY := $(PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE) 688else ifeq ($(PRODUCT_SHIPPING_API_LEVEL),) 689 #$(warning no product shipping level defined) 690else ifneq ($(call math_lt,27,$(PRODUCT_SHIPPING_API_LEVEL)),) 691 PRODUCT_COMPATIBLE_PROPERTY := true 692endif 693 694.KATI_READONLY := \ 695 PRODUCT_COMPATIBLE_PROPERTY 696 697# Boolean variable determining if Treble is fully enabled 698PRODUCT_FULL_TREBLE := false 699ifneq ($(PRODUCT_FULL_TREBLE_OVERRIDE),) 700 PRODUCT_FULL_TREBLE := $(PRODUCT_FULL_TREBLE_OVERRIDE) 701else ifeq ($(PRODUCT_SHIPPING_API_LEVEL),) 702 #$(warning no product shipping level defined) 703else ifneq ($(call math_gt_or_eq,$(PRODUCT_SHIPPING_API_LEVEL),26),) 704 PRODUCT_FULL_TREBLE := true 705endif 706 707# TODO(b/69865032): Make PRODUCT_NOTICE_SPLIT the default behavior and remove 708# references to it here and below. 709ifdef PRODUCT_NOTICE_SPLIT_OVERRIDE 710 $(error PRODUCT_NOTICE_SPLIT_OVERRIDE cannot be set.) 711endif 712 713requirements := \ 714 PRODUCT_TREBLE_LINKER_NAMESPACES \ 715 PRODUCT_SEPOLICY_SPLIT \ 716 PRODUCT_ENFORCE_VINTF_MANIFEST \ 717 PRODUCT_NOTICE_SPLIT 718 719# If it is overriden, then the requirement override is taken, otherwise it's 720# PRODUCT_FULL_TREBLE 721$(foreach req,$(requirements),$(eval \ 722 $(req) := $(if $($(req)_OVERRIDE),$($(req)_OVERRIDE),$(PRODUCT_FULL_TREBLE)))) 723# If the requirement is false for any reason, then it's not PRODUCT_FULL_TREBLE 724$(foreach req,$(requirements),$(eval \ 725 PRODUCT_FULL_TREBLE := $(if $(filter false,$($(req))),false,$(PRODUCT_FULL_TREBLE)))) 726 727PRODUCT_FULL_TREBLE_OVERRIDE ?= 728$(foreach req,$(requirements),$(eval $(req)_OVERRIDE ?=)) 729 730# TODO(b/114488870): disallow PRODUCT_FULL_TREBLE_OVERRIDE from being used. 731.KATI_READONLY := \ 732 PRODUCT_FULL_TREBLE_OVERRIDE \ 733 $(foreach req,$(requirements),$(req)_OVERRIDE) \ 734 $(requirements) \ 735 PRODUCT_FULL_TREBLE \ 736 737$(KATI_obsolete_var $(foreach req,$(requirements),$(req)_OVERRIDE) \ 738 ,This should be referenced without the _OVERRIDE suffix.) 739 740requirements := 741 742# BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED can be true only if early-mount of 743# partitions is supported. But the early-mount must be supported for full 744# treble products, and so BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED should be set 745# by default for full treble products. 746ifeq ($(PRODUCT_FULL_TREBLE),true) 747 BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED ?= true 748endif 749 750# If PRODUCT_USE_VNDK is true and BOARD_VNDK_VERSION is not defined yet, 751# BOARD_VNDK_VERSION will be set to "current" as default. 752# PRODUCT_USE_VNDK will be true in Android-P or later launching devices. 753PRODUCT_USE_VNDK := false 754ifneq ($(PRODUCT_USE_VNDK_OVERRIDE),) 755 PRODUCT_USE_VNDK := $(PRODUCT_USE_VNDK_OVERRIDE) 756else ifeq ($(PRODUCT_SHIPPING_API_LEVEL),) 757 # No shipping level defined 758else ifeq ($(call math_gt,$(PRODUCT_SHIPPING_API_LEVEL),27),true) 759 PRODUCT_USE_VNDK := $(PRODUCT_FULL_TREBLE) 760endif 761 762# Define PRODUCT_PRODUCT_VNDK_VERSION if PRODUCT_USE_VNDK is true and 763# PRODUCT_SHIPPING_API_LEVEL is greater than 29. 764PRODUCT_USE_PRODUCT_VNDK := false 765ifeq ($(PRODUCT_USE_VNDK),true) 766 ifneq ($(PRODUCT_USE_PRODUCT_VNDK_OVERRIDE),) 767 PRODUCT_USE_PRODUCT_VNDK := $(PRODUCT_USE_PRODUCT_VNDK_OVERRIDE) 768 else ifeq ($(PRODUCT_SHIPPING_API_LEVEL),) 769 # No shipping level defined 770 else ifeq ($(call math_gt,$(PRODUCT_SHIPPING_API_LEVEL),29),true) 771 PRODUCT_USE_PRODUCT_VNDK := true 772 endif 773 774 ifndef BOARD_VNDK_VERSION 775 BOARD_VNDK_VERSION := current 776 endif 777 778 ifeq ($(PRODUCT_USE_PRODUCT_VNDK),true) 779 ifndef PRODUCT_PRODUCT_VNDK_VERSION 780 PRODUCT_PRODUCT_VNDK_VERSION := current 781 endif 782 endif 783endif 784 785$(KATI_obsolete_var PRODUCT_USE_VNDK,Use BOARD_VNDK_VERSION instead) 786$(KATI_obsolete_var PRODUCT_USE_VNDK_OVERRIDE,Use BOARD_VNDK_VERSION instead) 787$(KATI_obsolete_var PRODUCT_USE_PRODUCT_VNDK,Use PRODUCT_PRODUCT_VNDK_VERSION instead) 788$(KATI_obsolete_var PRODUCT_USE_PRODUCT_VNDK_OVERRIDE,Use PRODUCT_PRODUCT_VNDK_VERSION instead) 789 790# Set BOARD_SYSTEMSDK_VERSIONS to the latest SystemSDK version starting from P-launching 791# devices if unset. 792ifndef BOARD_SYSTEMSDK_VERSIONS 793 ifdef PRODUCT_SHIPPING_API_LEVEL 794 ifneq ($(call math_gt_or_eq,$(PRODUCT_SHIPPING_API_LEVEL),28),) 795 ifeq (REL,$(PLATFORM_VERSION_CODENAME)) 796 BOARD_SYSTEMSDK_VERSIONS := $(PLATFORM_SDK_VERSION) 797 else 798 BOARD_SYSTEMSDK_VERSIONS := $(PLATFORM_VERSION_CODENAME) 799 endif 800 endif 801 endif 802endif 803 804 805ifdef PRODUCT_SHIPPING_API_LEVEL 806 ifneq ($(call numbers_less_than,$(PRODUCT_SHIPPING_API_LEVEL),$(BOARD_SYSTEMSDK_VERSIONS)),) 807 $(error BOARD_SYSTEMSDK_VERSIONS ($(BOARD_SYSTEMSDK_VERSIONS)) must all be greater than or equal to PRODUCT_SHIPPING_API_LEVEL ($(PRODUCT_SHIPPING_API_LEVEL))) 808 endif 809 ifneq ($(call math_gt_or_eq,$(PRODUCT_SHIPPING_API_LEVEL),28),) 810 ifneq ($(TARGET_IS_64_BIT), true) 811 ifneq ($(TARGET_USES_64_BIT_BINDER), true) 812 $(error When PRODUCT_SHIPPING_API_LEVEL >= 28, TARGET_USES_64_BIT_BINDER must be true) 813 endif 814 endif 815 endif 816 ifneq ($(call math_gt_or_eq,$(PRODUCT_SHIPPING_API_LEVEL),29),) 817 ifneq ($(BOARD_OTA_FRAMEWORK_VBMETA_VERSION_OVERRIDE),) 818 $(error When PRODUCT_SHIPPING_API_LEVEL >= 29, BOARD_OTA_FRAMEWORK_VBMETA_VERSION_OVERRIDE cannot be set) 819 endif 820 endif 821endif 822 823# The default key if not set as LOCAL_CERTIFICATE 824ifdef PRODUCT_DEFAULT_DEV_CERTIFICATE 825 DEFAULT_SYSTEM_DEV_CERTIFICATE := $(PRODUCT_DEFAULT_DEV_CERTIFICATE) 826else 827 DEFAULT_SYSTEM_DEV_CERTIFICATE := build/make/target/product/security/testkey 828endif 829.KATI_READONLY := DEFAULT_SYSTEM_DEV_CERTIFICATE 830 831# Certificate for the NetworkStack sepolicy context 832ifdef PRODUCT_MAINLINE_SEPOLICY_DEV_CERTIFICATES 833 MAINLINE_SEPOLICY_DEV_CERTIFICATES := $(PRODUCT_MAINLINE_SEPOLICY_DEV_CERTIFICATES) 834else 835 MAINLINE_SEPOLICY_DEV_CERTIFICATES := $(dir $(DEFAULT_SYSTEM_DEV_CERTIFICATE)) 836endif 837 838BUILD_NUMBER_FROM_FILE := $$(cat $(SOONG_OUT_DIR)/build_number.txt) 839BUILD_DATETIME_FROM_FILE := $$(cat $(BUILD_DATETIME_FILE)) 840 841# SEPolicy versions 842 843# PLATFORM_SEPOLICY_VERSION is a number of the form "NN.m" with "NN" mapping to 844# PLATFORM_SDK_VERSION and "m" as a minor number which allows for SELinux 845# changes independent of PLATFORM_SDK_VERSION. This value will be set to 846# 10000.0 to represent tip-of-tree development that is inherently unstable and 847# thus designed not to work with any shipping vendor policy. This is similar in 848# spirit to how DEFAULT_APP_TARGET_SDK is set. 849# The minor version ('m' component) must be updated every time a platform release 850# is made which breaks compatibility with the previous platform sepolicy version, 851# not just on every increase in PLATFORM_SDK_VERSION. The minor version should 852# be reset to 0 on every bump of the PLATFORM_SDK_VERSION. 853sepolicy_major_vers := 29 854sepolicy_minor_vers := 0 855 856ifneq ($(sepolicy_major_vers), $(PLATFORM_SDK_VERSION)) 857$(error sepolicy_major_version does not match PLATFORM_SDK_VERSION, please update.) 858endif 859 860TOT_SEPOLICY_VERSION := 10000.0 861ifneq (REL,$(PLATFORM_VERSION_CODENAME)) 862 PLATFORM_SEPOLICY_VERSION := $(TOT_SEPOLICY_VERSION) 863else 864 PLATFORM_SEPOLICY_VERSION := $(join $(addsuffix .,$(sepolicy_major_vers)), $(sepolicy_minor_vers)) 865endif 866sepolicy_major_vers := 867sepolicy_minor_vers := 868 869# A list of SEPolicy versions, besides PLATFORM_SEPOLICY_VERSION, that the framework supports. 870PLATFORM_SEPOLICY_COMPAT_VERSIONS := \ 871 26.0 \ 872 27.0 \ 873 28.0 \ 874 29.0 \ 875 30.0 \ 876 877.KATI_READONLY := \ 878 PLATFORM_SEPOLICY_COMPAT_VERSIONS \ 879 PLATFORM_SEPOLICY_VERSION \ 880 TOT_SEPOLICY_VERSION \ 881 882ifeq ($(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS),true) 883 ifneq ($(PRODUCT_USE_DYNAMIC_PARTITIONS),true) 884 $(error PRODUCT_USE_DYNAMIC_PARTITIONS must be true when PRODUCT_RETROFIT_DYNAMIC_PARTITIONS \ 885 is set) 886 endif 887 ifdef PRODUCT_SHIPPING_API_LEVEL 888 ifeq (true,$(call math_gt_or_eq,$(PRODUCT_SHIPPING_API_LEVEL),29)) 889 $(error Devices with shipping API level $(PRODUCT_SHIPPING_API_LEVEL) must not set \ 890 PRODUCT_RETROFIT_DYNAMIC_PARTITIONS) 891 endif 892 endif 893endif 894 895ifeq ($(PRODUCT_USE_DYNAMIC_PARTITIONS),true) 896 ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true) 897 $(error BOARD_BUILD_SYSTEM_ROOT_IMAGE cannot be true for devices with dynamic partitions) 898 endif 899 ifneq ($(PRODUCT_USE_DYNAMIC_PARTITION_SIZE),true) 900 $(error PRODUCT_USE_DYNAMIC_PARTITION_SIZE must be true for devices with dynamic partitions) 901 endif 902endif 903 904ifeq ($(PRODUCT_BUILD_SUPER_PARTITION),true) 905 ifneq ($(PRODUCT_USE_DYNAMIC_PARTITIONS),true) 906 $(error Can only build super partition for devices with dynamic partitions) 907 endif 908endif 909 910 911ifeq ($(PRODUCT_USE_DYNAMIC_PARTITION_SIZE),true) 912 913ifneq ($(BOARD_SYSTEMIMAGE_PARTITION_SIZE),) 914ifneq ($(BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE),) 915$(error Should not define BOARD_SYSTEMIMAGE_PARTITION_SIZE and \ 916 BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE together) 917endif 918endif 919 920ifneq ($(BOARD_VENDORIMAGE_PARTITION_SIZE),) 921ifneq ($(BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE),) 922$(error Should not define BOARD_VENDORIMAGE_PARTITION_SIZE and \ 923 BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE together) 924endif 925endif 926 927ifneq ($(BOARD_ODMIMAGE_PARTITION_SIZE),) 928ifneq ($(BOARD_ODMIMAGE_PARTITION_RESERVED_SIZE),) 929$(error Should not define BOARD_ODMIMAGE_PARTITION_SIZE and \ 930 BOARD_ODMIMAGE_PARTITION_RESERVED_SIZE together) 931endif 932endif 933 934ifneq ($(BOARD_VENDOR_DLKMIMAGE_PARTITION_SIZE),) 935ifneq ($(BOARD_VENDOR_DLKMIMAGE_PARTITION_RESERVED_SIZE),) 936$(error Should not define BOARD_VENDOR_DLKMIMAGE_PARTITION_SIZE and \ 937 BOARD_VENDOR_DLKMIMAGE_PARTITION_RESERVED_SIZE together) 938endif 939endif 940 941ifneq ($(BOARD_ODM_DLKMIMAGE_PARTITION_SIZE),) 942ifneq ($(BOARD_ODM_DLKMIMAGE_PARTITION_RESERVED_SIZE),) 943$(error Should not define BOARD_ODM_DLKMIMAGE_PARTITION_SIZE and \ 944 BOARD_ODM_DLKMIMAGE_PARTITION_RESERVED_SIZE together) 945endif 946endif 947 948ifneq ($(BOARD_PRODUCTIMAGE_PARTITION_SIZE),) 949ifneq ($(BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE),) 950$(error Should not define BOARD_PRODUCTIMAGE_PARTITION_SIZE and \ 951 BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE together) 952endif 953endif 954 955ifneq ($(BOARD_SYSTEM_EXTIMAGE_PARTITION_SIZE),) 956ifneq ($(BOARD_SYSTEM_EXTIMAGE_PARTITION_RESERVED_SIZE),) 957$(error Should not define BOARD_SYSTEM_EXTIMAGE_PARTITION_SIZE and \ 958 BOARD_SYSTEM_EXTIMAGE_PARTITION_RESERVED_SIZE together) 959endif 960endif 961 962endif # PRODUCT_USE_DYNAMIC_PARTITION_SIZE 963 964ifeq ($(PRODUCT_USE_DYNAMIC_PARTITIONS),true) 965 966# BOARD_SUPER_PARTITION_GROUPS defines a list of "updatable groups". Each updatable group is a 967# group of partitions that share the same pool of free spaces. 968# For each group in BOARD_SUPER_PARTITION_GROUPS, a BOARD_{GROUP}_SIZE and 969# BOARD_{GROUP}_PARTITION_PARTITION_LIST may be defined. 970# - BOARD_{GROUP}_SIZE: The maximum sum of sizes of all partitions in the group. 971# Must not be empty. 972# - BOARD_{GROUP}_PARTITION_PARTITION_LIST: the list of partitions that belongs to this group. 973# If empty, no partitions belong to this group, and the sum of sizes is effectively 0. 974$(foreach group,$(call to-upper,$(BOARD_SUPER_PARTITION_GROUPS)), \ 975 $(eval BOARD_$(group)_SIZE := $(strip $(BOARD_$(group)_SIZE))) \ 976 $(if $(BOARD_$(group)_SIZE),,$(error BOARD_$(group)_SIZE must not be empty)) \ 977 $(eval .KATI_READONLY := BOARD_$(group)_SIZE) \ 978 $(eval BOARD_$(group)_PARTITION_LIST ?=) \ 979 $(eval .KATI_READONLY := BOARD_$(group)_PARTITION_LIST) \ 980) 981 982# BOARD_*_PARTITION_LIST: a list of the following tokens 983valid_super_partition_list := system vendor product system_ext odm vendor_dlkm odm_dlkm 984$(foreach group,$(call to-upper,$(BOARD_SUPER_PARTITION_GROUPS)), \ 985 $(if $(filter-out $(valid_super_partition_list),$(BOARD_$(group)_PARTITION_LIST)), \ 986 $(error BOARD_$(group)_PARTITION_LIST contains invalid partition name \ 987 $(filter-out $(valid_super_partition_list),$(BOARD_$(group)_PARTITION_LIST)). \ 988 Valid names are $(valid_super_partition_list)))) 989valid_super_partition_list := 990 991 992# Define BOARD_SUPER_PARTITION_PARTITION_LIST, the sum of all BOARD_*_PARTITION_LIST 993ifdef BOARD_SUPER_PARTITION_PARTITION_LIST 994$(error BOARD_SUPER_PARTITION_PARTITION_LIST should not be defined, but computed from \ 995 BOARD_SUPER_PARTITION_GROUPS and BOARD_*_PARTITION_LIST) 996endif 997BOARD_SUPER_PARTITION_PARTITION_LIST := \ 998 $(foreach group,$(call to-upper,$(BOARD_SUPER_PARTITION_GROUPS)),$(BOARD_$(group)_PARTITION_LIST)) 999.KATI_READONLY := BOARD_SUPER_PARTITION_PARTITION_LIST 1000 1001ifneq ($(BOARD_SUPER_PARTITION_SIZE),) 1002ifeq ($(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS),true) 1003 1004# The metadata device must be specified manually for retrofitting. 1005ifeq ($(BOARD_SUPER_PARTITION_METADATA_DEVICE),) 1006$(error Must specify BOARD_SUPER_PARTITION_METADATA_DEVICE if PRODUCT_RETROFIT_DYNAMIC_PARTITIONS=true.) 1007endif 1008 1009# The super partition block device list must be specified manually for retrofitting. 1010ifeq ($(BOARD_SUPER_PARTITION_BLOCK_DEVICES),) 1011$(error Must specify BOARD_SUPER_PARTITION_BLOCK_DEVICES if PRODUCT_RETROFIT_DYNAMIC_PARTITIONS=true.) 1012endif 1013 1014# The metadata device must be included in the super partition block device list. 1015ifeq (,$(filter $(BOARD_SUPER_PARTITION_METADATA_DEVICE),$(BOARD_SUPER_PARTITION_BLOCK_DEVICES))) 1016$(error BOARD_SUPER_PARTITION_METADATA_DEVICE is not listed in BOARD_SUPER_PARTITION_BLOCK_DEVICES.) 1017endif 1018 1019# The metadata device must be supplied to init via the kernel command-line. 1020INTERNAL_KERNEL_CMDLINE += androidboot.super_partition=$(BOARD_SUPER_PARTITION_METADATA_DEVICE) 1021 1022BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE := true 1023 1024# If "vendor" is listed as one of the dynamic partitions but without its image available (e.g. an 1025# AOSP target built without vendor image), don't build the retrofit full OTA package. Because we 1026# won't be able to build meaningful super_* images for retrofitting purpose. 1027ifneq (,$(filter vendor,$(BOARD_SUPER_PARTITION_PARTITION_LIST))) 1028ifndef BUILDING_VENDOR_IMAGE 1029ifndef BOARD_PREBUILT_VENDORIMAGE 1030BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE := 1031endif # BOARD_PREBUILT_VENDORIMAGE 1032endif # BUILDING_VENDOR_IMAGE 1033endif # BOARD_SUPER_PARTITION_PARTITION_LIST 1034 1035else # PRODUCT_RETROFIT_DYNAMIC_PARTITIONS 1036 1037# For normal devices, we populate BOARD_SUPER_PARTITION_BLOCK_DEVICES so the 1038# build can handle both cases consistently. 1039ifeq ($(BOARD_SUPER_PARTITION_METADATA_DEVICE),) 1040BOARD_SUPER_PARTITION_METADATA_DEVICE := super 1041endif 1042 1043ifeq ($(BOARD_SUPER_PARTITION_BLOCK_DEVICES),) 1044BOARD_SUPER_PARTITION_BLOCK_DEVICES := $(BOARD_SUPER_PARTITION_METADATA_DEVICE) 1045endif 1046 1047# If only one super block device, default to super partition size. 1048ifeq ($(word 2,$(BOARD_SUPER_PARTITION_BLOCK_DEVICES)),) 1049BOARD_SUPER_PARTITION_$(call to-upper,$(strip $(BOARD_SUPER_PARTITION_BLOCK_DEVICES)))_DEVICE_SIZE ?= \ 1050 $(BOARD_SUPER_PARTITION_SIZE) 1051endif 1052 1053ifneq ($(BOARD_SUPER_PARTITION_METADATA_DEVICE),super) 1054INTERNAL_KERNEL_CMDLINE += androidboot.super_partition=$(BOARD_SUPER_PARTITION_METADATA_DEVICE) 1055endif 1056BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE := 1057 1058endif # PRODUCT_RETROFIT_DYNAMIC_PARTITIONS 1059endif # BOARD_SUPER_PARTITION_SIZE 1060BOARD_SUPER_PARTITION_BLOCK_DEVICES ?= 1061.KATI_READONLY := BOARD_SUPER_PARTITION_BLOCK_DEVICES 1062BOARD_SUPER_PARTITION_METADATA_DEVICE ?= 1063.KATI_READONLY := BOARD_SUPER_PARTITION_METADATA_DEVICE 1064BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE ?= 1065.KATI_READONLY := BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE 1066 1067$(foreach device,$(call to-upper,$(BOARD_SUPER_PARTITION_BLOCK_DEVICES)), \ 1068 $(eval BOARD_SUPER_PARTITION_$(device)_DEVICE_SIZE := $(strip $(BOARD_SUPER_PARTITION_$(device)_DEVICE_SIZE))) \ 1069 $(if $(BOARD_SUPER_PARTITION_$(device)_DEVICE_SIZE),, \ 1070 $(error BOARD_SUPER_PARTITION_$(device)_DEVICE_SIZE must not be empty)) \ 1071 $(eval .KATI_READONLY := BOARD_SUPER_PARTITION_$(device)_DEVICE_SIZE)) 1072 1073endif # PRODUCT_USE_DYNAMIC_PARTITIONS 1074 1075# ############################################################### 1076# Set up final options. 1077# ############################################################### 1078 1079# We run gcc/clang with PWD=/proc/self/cwd to remove the $TOP 1080# from the debug output. That way two builds in two different 1081# directories will create the same output. 1082# /proc doesn't exist on Darwin. 1083ifeq ($(HOST_OS),linux) 1084RELATIVE_PWD := PWD=/proc/self/cwd 1085else 1086RELATIVE_PWD := 1087endif 1088 1089# Flags for DEX2OAT 1090first_non_empty_of_three = $(if $(1),$(1),$(if $(2),$(2),$(3))) 1091DEX2OAT_TARGET_ARCH := $(TARGET_ARCH) 1092DEX2OAT_TARGET_CPU_VARIANT := $(call first_non_empty_of_three,$(TARGET_CPU_VARIANT),$(TARGET_ARCH_VARIANT),default) 1093DEX2OAT_TARGET_CPU_VARIANT_RUNTIME := $(call first_non_empty_of_three,$(TARGET_CPU_VARIANT_RUNTIME),$(TARGET_ARCH_VARIANT),default) 1094DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := default 1095 1096ifdef TARGET_2ND_ARCH 1097$(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH := $(TARGET_2ND_ARCH) 1098$(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT := $(call first_non_empty_of_three,$(TARGET_2ND_CPU_VARIANT),$(TARGET_2ND_ARCH_VARIANT),default) 1099$(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT_RUNTIME := $(call first_non_empty_of_three,$(TARGET_2ND_CPU_VARIANT_RUNTIME),$(TARGET_2ND_ARCH_VARIANT),default) 1100$(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := default 1101endif 1102 1103# ############################################################### 1104# Collect a list of the SDK versions that we could compile against 1105# For use with the LOCAL_SDK_VERSION variable for include $(BUILD_PACKAGE) 1106# ############################################################### 1107 1108HISTORICAL_SDK_VERSIONS_ROOT := $(TOPDIR)prebuilts/sdk 1109HISTORICAL_NDK_VERSIONS_ROOT := $(TOPDIR)prebuilts/ndk 1110 1111# The path where app can reference the support library resources. 1112ifdef TARGET_BUILD_APPS 1113SUPPORT_LIBRARY_ROOT := $(HISTORICAL_SDK_VERSIONS_ROOT)/current/support 1114else 1115SUPPORT_LIBRARY_ROOT := frameworks/support 1116endif 1117 1118get-sdk-version = $(if $(findstring _,$(1)),$(subst core_,,$(subst system_,,$(subst test_,,$(1)))),$(1)) 1119get-sdk-api = $(if $(findstring _,$(1)),$(patsubst %_$(call get-sdk-version,$(1)),%,$(1)),public) 1120get-prebuilt-sdk-dir = $(HISTORICAL_SDK_VERSIONS_ROOT)/$(call get-sdk-version,$(1))/$(call get-sdk-api,$(1)) 1121 1122# Resolve LOCAL_SDK_VERSION to prebuilt module name, e.g.: 1123# 23 -> sdk_public_23_android 1124# system_current -> sdk_system_current_android 1125# $(1): An sdk version (LOCAL_SDK_VERSION) 1126# $(2): optional library name (default: android) 1127define resolve-prebuilt-sdk-module 1128$(if $(findstring _,$(1)),\ 1129 sdk_$(1)_$(or $(2),android),\ 1130 sdk_public_$(1)_$(or $(2),android)) 1131endef 1132 1133# Resolve LOCAL_SDK_VERSION to prebuilt android.jar 1134# $(1): LOCAL_SDK_VERSION 1135resolve-prebuilt-sdk-jar-path = $(call get-prebuilt-sdk-dir,$(1))/android.jar 1136 1137# Resolve LOCAL_SDK_VERSION to prebuilt framework.aidl 1138# $(1): An sdk version (LOCAL_SDK_VERSION) 1139resolve-prebuilt-sdk-aidl-path = $(call get-prebuilt-sdk-dir,$(call get-sdk-version,$(1)))/framework.aidl 1140 1141# Historical SDK version N is stored in $(HISTORICAL_SDK_VERSIONS_ROOT)/N. 1142# The 'current' version is whatever this source tree is. 1143# 1144# sgrax is the opposite of xargs. It takes the list of args and puts them 1145# on each line for sort to process. 1146# sort -g is a numeric sort, so 1 2 3 10 instead of 1 10 2 3. 1147 1148# Numerically sort a list of numbers 1149# $(1): the list of numbers to be sorted 1150define numerically_sort 1151$(shell function sgrax() { \ 1152 while [ -n "$$1" ] ; do echo $$1 ; shift ; done \ 1153 } ; \ 1154 ( sgrax $(1) | sort -g ) ) 1155endef 1156 1157# This produces a list like "current/core current/public current/system 4/public" 1158TARGET_AVAILABLE_SDK_VERSIONS := $(wildcard $(HISTORICAL_SDK_VERSIONS_ROOT)/*/*/android.jar) 1159TARGET_AVAILABLE_SDK_VERSIONS := $(patsubst $(HISTORICAL_SDK_VERSIONS_ROOT)/%/android.jar,%,$(TARGET_AVAILABLE_SDK_VERSIONS)) 1160# Strips and reorganizes the "public", "core" and "system" subdirs. 1161TARGET_AVAILABLE_SDK_VERSIONS := $(subst /public,,$(TARGET_AVAILABLE_SDK_VERSIONS)) 1162TARGET_AVAILABLE_SDK_VERSIONS := $(patsubst %/core,core_%,$(TARGET_AVAILABLE_SDK_VERSIONS)) 1163TARGET_AVAILABLE_SDK_VERSIONS := $(patsubst %/system,system_%,$(TARGET_AVAILABLE_SDK_VERSIONS)) 1164# No prebuilt for test_current. 1165TARGET_AVAILABLE_SDK_VERSIONS += test_current 1166TARGET_AVAIALBLE_SDK_VERSIONS := $(call numerically_sort,$(TARGET_AVAILABLE_SDK_VERSIONS)) 1167 1168TARGET_SDK_VERSIONS_WITHOUT_JAVA_18_SUPPORT := $(call numbers_less_than,24,$(TARGET_AVAILABLE_SDK_VERSIONS)) 1169TARGET_SDK_VERSIONS_WITHOUT_JAVA_19_SUPPORT := $(call numbers_less_than,30,$(TARGET_AVAILABLE_SDK_VERSIONS)) 1170 1171# Missing optional uses-libraries so that the platform doesn't create build rules that depend on 1172# them. 1173INTERNAL_PLATFORM_MISSING_USES_LIBRARIES := \ 1174 com.google.android.ble \ 1175 com.google.android.media.effects \ 1176 com.google.android.wearable \ 1177 1178# This is the standard way to name a directory containing prebuilt target 1179# objects. E.g., prebuilt/$(TARGET_PREBUILT_TAG)/libc.so 1180TARGET_PREBUILT_TAG := android-$(TARGET_ARCH) 1181ifdef TARGET_2ND_ARCH 1182TARGET_2ND_PREBUILT_TAG := android-$(TARGET_2ND_ARCH) 1183endif 1184 1185# Set up RS prebuilt variables for compatibility library 1186 1187RS_PREBUILT_CLCORE := prebuilts/sdk/renderscript/lib/$(TARGET_ARCH)/librsrt_$(TARGET_ARCH).bc 1188RS_PREBUILT_COMPILER_RT := prebuilts/sdk/renderscript/lib/$(TARGET_ARCH)/libcompiler_rt.a 1189 1190# API Level lists for Renderscript Compat lib. 1191RSCOMPAT_32BIT_ONLY_API_LEVELS := 8 9 10 11 12 13 14 15 16 17 18 19 20 1192RSCOMPAT_NO_USAGEIO_API_LEVELS := 8 9 10 11 12 13 1193 1194# Add BUILD_NUMBER to apps default version name if it's unbundled build. 1195ifdef TARGET_BUILD_APPS 1196TARGET_BUILD_WITH_APPS_VERSION_NAME := true 1197endif 1198 1199ifdef TARGET_BUILD_WITH_APPS_VERSION_NAME 1200APPS_DEFAULT_VERSION_NAME := $(PLATFORM_VERSION)-$(BUILD_NUMBER_FROM_FILE) 1201else 1202APPS_DEFAULT_VERSION_NAME := $(PLATFORM_VERSION) 1203endif 1204 1205# ANDROID_WARNING_ALLOWED_PROJECTS is generated by build/soong. 1206define find_warning_allowed_projects 1207 $(filter $(ANDROID_WARNING_ALLOWED_PROJECTS),$(1)/) 1208endef 1209 1210GOMA_POOL := 1211RBE_POOL := 1212GOMA_OR_RBE_POOL := 1213# When goma or RBE are enabled, kati will be passed --default_pool=local_pool to put 1214# most rules into the local pool. Explicitly set the pool to "none" for rules that 1215# should be run outside the local pool, i.e. with -j500. 1216ifneq (,$(filter-out false,$(USE_GOMA))) 1217 GOMA_POOL := none 1218 GOMA_OR_RBE_POOL := none 1219else ifneq (,$(filter-out false,$(USE_RBE))) 1220 RBE_POOL := none 1221 GOMA_OR_RBE_POOL := none 1222endif 1223.KATI_READONLY := GOMA_POOL RBE_POOL GOMA_OR_RBE_POOL 1224 1225# These goals don't need to collect and include Android.mks/CleanSpec.mks 1226# in the source tree. 1227dont_bother_goals := out \ 1228 product-graph dump-products 1229 1230ifeq ($(CALLED_FROM_SETUP),true) 1231include $(BUILD_SYSTEM)/android_soong_config_vars.mk 1232include $(BUILD_SYSTEM)/ninja_config.mk 1233include $(BUILD_SYSTEM)/soong_config.mk 1234endif 1235 1236-include external/linux-kselftest/android/kselftest_test_list.mk 1237-include external/ltp/android/ltp_package_list.mk 1238DEFAULT_DATA_OUT_MODULES := ltp $(ltp_packages) $(kselftest_modules) 1239.KATI_READONLY := DEFAULT_DATA_OUT_MODULES 1240 1241# Make RECORD_ALL_DEPS readonly. 1242RECORD_ALL_DEPS :=$= $(filter true,$(RECORD_ALL_DEPS)) 1243 1244include $(BUILD_SYSTEM)/dumpvar.mk 1245