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