1# Variables we check: 2# HOST_BUILD_TYPE = { release debug } 3# TARGET_BUILD_TYPE = { release debug } 4# and we output a bunch of variables, see the case statement at 5# the bottom for the full list 6# OUT_DIR is also set to "out" if it's not already set. 7# this allows you to set it to somewhere else if you like 8# SCAN_EXCLUDE_DIRS is an optional, whitespace separated list of 9# directories that will also be excluded from full checkout tree 10# searches for source or make files, in addition to OUT_DIR. 11# This can be useful if you set OUT_DIR to be a different directory 12# than other outputs of your build system. 13 14# Returns all words in $1 up to and including $2 15define find_and_earlier 16 $(strip $(if $(1), 17 $(firstword $(1)) 18 $(if $(filter $(firstword $(1)),$(2)),, 19 $(call find_and_earlier,$(wordlist 2,$(words $(1)),$(1)),$(2))))) 20endef 21 22#$(warning $(call find_and_earlier,A B C,A)) 23#$(warning $(call find_and_earlier,A B C,B)) 24#$(warning $(call find_and_earlier,A B C,C)) 25#$(warning $(call find_and_earlier,A B C,D)) 26 27define version-list 28$(1)PR1 $(1)PD1 $(1)PD2 $(1)PM1 $(1)PM2 29endef 30 31ALL_VERSIONS := O P Q R S T U V W X Y Z 32ALL_VERSIONS := $(foreach v,$(ALL_VERSIONS),$(call version-list,$(v))) 33 34# Filters ALL_VERSIONS down to the range [$1, $2], and errors if $1 > $2 or $3 is 35# not in [$1, $2] 36# $(1): min platform version 37# $(2): max platform version 38# $(3): default platform version 39define allowed-platform-versions 40$(strip \ 41 $(if $(filter $(ALL_VERSIONS),$(1)),, 42 $(error Invalid MIN_PLATFORM_VERSION '$(1)')) 43 $(if $(filter $(ALL_VERSIONS),$(2)),, 44 $(error Invalid MAX_PLATFORM_VERSION '$(2)')) 45 $(if $(filter $(ALL_VERSIONS),$(3)),, 46 $(error Invalid DEFAULT_PLATFORM_VERSION '$(3)')) 47 48 $(eval allowed_versions_ := $(call find_and_earlier,$(ALL_VERSIONS),$(2))) 49 50 $(if $(filter $(allowed_versions_),$(1)),, 51 $(error MIN_PLATFORM_VERSION '$(1)' must be before MAX_PLATFORM_VERSION '$(2)')) 52 53 $(eval allowed_versions_ := $(1) \ 54 $(filter-out $(call find_and_earlier,$(allowed_versions_),$(1)),$(allowed_versions_))) 55 56 $(if $(filter $(allowed_versions_),$(3)),, 57 $(error DEFAULT_PLATFORM_VERSION '$(3)' must be between MIN_PLATFORM_VERSION '$(1)' and MAX_PLATFORM_VERSION '$(2)')) 58 59 $(allowed_versions_)) 60endef 61 62#$(warning $(call allowed-platform-versions,OPR1,PPR1,OPR1)) 63#$(warning $(call allowed-platform-versions,OPM1,PPR1,OPR1)) 64 65# Set up version information. 66include $(BUILD_SYSTEM)/version_defaults.mk 67 68ENABLED_VERSIONS := $(call find_and_earlier,$(ALL_VERSIONS),$(TARGET_PLATFORM_VERSION)) 69 70$(foreach v,$(ENABLED_VERSIONS), \ 71 $(eval IS_AT_LEAST_$(v) := true)) 72 73# --------------------------------------------------------------- 74# If you update the build system such that the environment setup 75# or buildspec.mk need to be updated, increment this number, and 76# people who haven't re-run those will have to do so before they 77# can build. Make sure to also update the corresponding value in 78# buildspec.mk.default and envsetup.sh. 79CORRECT_BUILD_ENV_SEQUENCE_NUMBER := 13 80 81# --------------------------------------------------------------- 82# The product defaults to generic on hardware 83# NOTE: This will be overridden in product_config.mk if make 84# was invoked with a PRODUCT-xxx-yyy goal. 85ifeq ($(TARGET_PRODUCT),) 86TARGET_PRODUCT := aosp_arm 87endif 88 89 90# the variant -- the set of files that are included for a build 91ifeq ($(strip $(TARGET_BUILD_VARIANT)),) 92TARGET_BUILD_VARIANT := eng 93endif 94 95# --------------------------------------------------------------- 96# Set up configuration for host machine. We don't do cross- 97# compiles except for arm/mips, so the HOST is whatever we are 98# running on 99 100# HOST_OS 101ifneq (,$(findstring Linux,$(UNAME))) 102 HOST_OS := linux 103endif 104ifneq (,$(findstring Darwin,$(UNAME))) 105 HOST_OS := darwin 106endif 107ifneq (,$(findstring Macintosh,$(UNAME))) 108 HOST_OS := darwin 109endif 110 111HOST_OS_EXTRA := $(shell uname -rsm) 112ifeq ($(HOST_OS),linux) 113 ifneq ($(wildcard /etc/os-release),) 114 HOST_OS_EXTRA += $(shell source /etc/os-release; echo $$PRETTY_NAME) 115 endif 116else ifeq ($(HOST_OS),darwin) 117 HOST_OS_EXTRA += $(shell sw_vers -productVersion) 118endif 119HOST_OS_EXTRA := $(subst $(space),-,$(HOST_OS_EXTRA)) 120 121# BUILD_OS is the real host doing the build. 122BUILD_OS := $(HOST_OS) 123 124HOST_CROSS_OS := 125# We can cross-build Windows binaries on Linux 126ifeq ($(HOST_OS),linux) 127ifeq ($(BUILD_HOST_static),) 128HOST_CROSS_OS := windows 129HOST_CROSS_ARCH := x86 130HOST_CROSS_2ND_ARCH := x86_64 1312ND_HOST_CROSS_IS_64_BIT := true 132endif 133endif 134 135ifeq ($(HOST_OS),) 136$(error Unable to determine HOST_OS from uname -sm: $(UNAME)!) 137endif 138 139# HOST_ARCH 140ifneq (,$(findstring x86_64,$(UNAME))) 141 HOST_ARCH := x86_64 142 HOST_2ND_ARCH := x86 143 HOST_IS_64_BIT := true 144else 145ifneq (,$(findstring i686,$(UNAME))$(findstring x86,$(UNAME))) 146$(error Building on a 32-bit x86 host is not supported: $(UNAME)!) 147endif 148endif 149 150BUILD_ARCH := $(HOST_ARCH) 151BUILD_2ND_ARCH := $(HOST_2ND_ARCH) 152 153ifeq ($(HOST_ARCH),) 154$(error Unable to determine HOST_ARCH from uname -sm: $(UNAME)!) 155endif 156 157# the host build defaults to release, and it must be release or debug 158ifeq ($(HOST_BUILD_TYPE),) 159HOST_BUILD_TYPE := release 160endif 161 162ifneq ($(HOST_BUILD_TYPE),release) 163ifneq ($(HOST_BUILD_TYPE),debug) 164$(error HOST_BUILD_TYPE must be either release or debug, not '$(HOST_BUILD_TYPE)') 165endif 166endif 167 168# We don't want to move all the prebuilt host tools to a $(HOST_OS)-x86_64 dir. 169HOST_PREBUILT_ARCH := x86 170# This is the standard way to name a directory containing prebuilt host 171# objects. E.g., prebuilt/$(HOST_PREBUILT_TAG)/cc 172HOST_PREBUILT_TAG := $(BUILD_OS)-$(HOST_PREBUILT_ARCH) 173 174# TARGET_COPY_OUT_* are all relative to the staging directory, ie PRODUCT_OUT. 175# Define them here so they can be used in product config files. 176TARGET_COPY_OUT_SYSTEM := system 177TARGET_COPY_OUT_SYSTEM_OTHER := system_other 178TARGET_COPY_OUT_DATA := data 179TARGET_COPY_OUT_ASAN := $(TARGET_COPY_OUT_DATA)/asan 180TARGET_COPY_OUT_OEM := oem 181TARGET_COPY_OUT_ODM := odm 182TARGET_COPY_OUT_PRODUCT := product 183TARGET_COPY_OUT_ROOT := root 184TARGET_COPY_OUT_RECOVERY := recovery 185 186# Returns the non-sanitized version of the path provided in $1. 187define get_non_asan_path 188$(patsubst $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/%,$(PRODUCT_OUT)/%,$1) 189endef 190 191########################################### 192# Define TARGET_COPY_OUT_VENDOR to a placeholder, for at this point 193# we don't know if the device wants to build a separate vendor.img 194# or just build vendor stuff into system.img. 195# A device can set up TARGET_COPY_OUT_VENDOR to "vendor" in its 196# BoardConfig.mk. 197# We'll substitute with the real value after loading BoardConfig.mk. 198_vendor_path_placeholder := ||VENDOR-PATH-PH|| 199TARGET_COPY_OUT_VENDOR := $(_vendor_path_placeholder) 200########################################### 201 202########################################### 203# Define TARGET_COPY_OUT_PRODUCT to a placeholder, for at this point 204# we don't know if the device wants to build a separate product.img 205# or just build product stuff into system.img. 206# A device can set up TARGET_COPY_OUT_PRODUCT to "product" in its 207# BoardConfig.mk. 208# We'll substitute with the real value after loading BoardConfig.mk. 209_product_path_placeholder := ||PRODUCT-PATH-PH|| 210TARGET_COPY_OUT_PRODUCT := $(_product_path_placeholder) 211########################################### 212 213################################################################# 214# Set up minimal BOOTCLASSPATH list of jars to build/execute 215# java code with dalvikvm/art. 216TARGET_CORE_JARS := core-oj core-libart conscrypt okhttp bouncycastle apache-xml 217ifeq ($(EMMA_INSTRUMENT),true) 218 ifneq ($(EMMA_INSTRUMENT_STATIC),true) 219 # For instrumented build, if Jacoco is not being included statically 220 # in instrumented packages then include Jacoco classes into the 221 # bootclasspath. 222 TARGET_CORE_JARS += jacocoagent 223 endif # EMMA_INSTRUMENT_STATIC 224endif # EMMA_INSTRUMENT 225HOST_CORE_JARS := $(addsuffix -hostdex,$(TARGET_CORE_JARS)) 226################################################################# 227 228# Read the product specs so we can get TARGET_DEVICE and other 229# variables that we need in order to locate the output files. 230include $(BUILD_SYSTEM)/product_config.mk 231 232build_variant := $(filter-out eng user userdebug,$(TARGET_BUILD_VARIANT)) 233ifneq ($(build_variant)-$(words $(TARGET_BUILD_VARIANT)),-1) 234$(warning bad TARGET_BUILD_VARIANT: $(TARGET_BUILD_VARIANT)) 235$(error must be empty or one of: eng user userdebug) 236endif 237 238SDK_HOST_ARCH := x86 239 240# Boards may be defined under $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE) 241# or under vendor/*/$(TARGET_DEVICE). Search in both places, but 242# make sure only one exists. 243# Real boards should always be associated with an OEM vendor. 244board_config_mk := \ 245 $(strip $(sort $(wildcard \ 246 $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)/BoardConfig.mk \ 247 $(shell test -d device && find -L device -maxdepth 4 -path '*/$(TARGET_DEVICE)/BoardConfig.mk') \ 248 $(shell test -d vendor && find -L vendor -maxdepth 4 -path '*/$(TARGET_DEVICE)/BoardConfig.mk') \ 249 ))) 250ifeq ($(board_config_mk),) 251 $(error No config file found for TARGET_DEVICE $(TARGET_DEVICE)) 252endif 253ifneq ($(words $(board_config_mk)),1) 254 $(error Multiple board config files for TARGET_DEVICE $(TARGET_DEVICE): $(board_config_mk)) 255endif 256include $(board_config_mk) 257ifeq ($(TARGET_ARCH),) 258 $(error TARGET_ARCH not defined by board config: $(board_config_mk)) 259endif 260ifneq ($(MALLOC_IMPL),) 261 $(warning *** Unsupported option MALLOC_IMPL defined by board config: $(board_config_mk).) 262 $(error Use `MALLOC_SVELTE := true` to configure jemalloc for low-memory) 263endif 264TARGET_DEVICE_DIR := $(patsubst %/,%,$(dir $(board_config_mk))) 265board_config_mk := 266 267########################################### 268# Now we can substitute with the real value of TARGET_COPY_OUT_VENDOR 269ifeq ($(TARGET_COPY_OUT_VENDOR),$(_vendor_path_placeholder)) 270TARGET_COPY_OUT_VENDOR := system/vendor 271else ifeq ($(filter vendor system/vendor,$(TARGET_COPY_OUT_VENDOR)),) 272$(error TARGET_COPY_OUT_VENDOR must be either 'vendor' or 'system/vendor', seeing '$(TARGET_COPY_OUT_VENDOR)'.) 273endif 274PRODUCT_COPY_FILES := $(subst $(_vendor_path_placeholder),$(TARGET_COPY_OUT_VENDOR),$(PRODUCT_COPY_FILES)) 275 276BOARD_USES_VENDORIMAGE := 277ifdef BOARD_PREBUILT_VENDORIMAGE 278BOARD_USES_VENDORIMAGE := true 279endif 280ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE 281BOARD_USES_VENDORIMAGE := true 282endif 283ifeq ($(TARGET_COPY_OUT_VENDOR),vendor) 284BOARD_USES_VENDORIMAGE := true 285else ifdef BOARD_USES_VENDORIMAGE 286$(error TARGET_COPY_OUT_VENDOR must be set to 'vendor' to use a vendor image) 287endif 288 289########################################### 290# Now we can substitute with the real value of TARGET_COPY_OUT_PRODUCT 291ifeq ($(TARGET_COPY_OUT_PRODUCT),$(_product_path_placeholder)) 292TARGET_COPY_OUT_PRODUCT := system/product 293else ifeq ($(filter product system/product,$(TARGET_COPY_OUT_PRODUCT)),) 294$(error TARGET_COPY_OUT_PRODUCT must be either 'product' or 'system/product', seeing '$(TARGET_COPY_OUT_PRODUCT)'.) 295endif 296PRODUCT_COPY_FILES := $(subst $(_product_path_placeholder),$(TARGET_COPY_OUT_PRODUCT),$(PRODUCT_COPY_FILES)) 297 298BOARD_USES_PRODUCTIMAGE := 299ifdef BOARD_PREBUILT_PRODUCTIMAGE 300BOARD_USES_PRODUCTIMAGE := true 301endif 302ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE 303BOARD_USES_PRODUCTIMAGE := true 304endif 305ifeq ($(TARGET_COPY_OUT_PRODUCT),product) 306BOARD_USES_PRODUCTIMAGE := true 307else ifdef BOARD_USES_PRODUCTIMAGE 308$(error TARGET_COPY_OUT_PRODUCT must be set to 'product' to use a product image) 309endif 310 311########################################### 312# Ensure that only TARGET_RECOVERY_UPDATER_LIBS *or* AB_OTA_UPDATER is set. 313TARGET_RECOVERY_UPDATER_LIBS ?= 314AB_OTA_UPDATER ?= 315.KATI_READONLY := TARGET_RECOVERY_UPDATER_LIBS AB_OTA_UPDATER 316ifeq ($(AB_OTA_UPDATER),true) 317 ifneq ($(strip $(TARGET_RECOVERY_UPDATER_LIBS)),) 318 $(error Do not use TARGET_RECOVERY_UPDATER_LIBS when using AB_OTA_UPDATER) 319 endif 320endif 321 322# Check BOARD_VNDK_VERSION 323define check_vndk_version 324 $(eval vndk_path := prebuilts/vndk/v$(1)) \ 325 $(if $(wildcard $(vndk_path)/*/Android.bp),,$(error VNDK version $(1) not found)) 326endef 327 328ifdef BOARD_VNDK_VERSION 329 ifneq ($(BOARD_VNDK_VERSION),current) 330 $(error BOARD_VNDK_VERSION: Only "current" is implemented) 331 endif 332 333 TARGET_VENDOR_TEST_SUFFIX := /vendor 334else 335 TARGET_VENDOR_TEST_SUFFIX := 336endif 337 338ifdef PRODUCT_EXTRA_VNDK_VERSIONS 339 $(foreach v,$(PRODUCT_EXTRA_VNDK_VERSIONS),$(call check_vndk_version,$(v))) 340endif 341 342# Ensure that BOARD_SYSTEMSDK_VERSIONS are all within PLATFORM_SYSTEMSDK_VERSIONS 343_unsupported_systemsdk_versions := $(filter-out $(PLATFORM_SYSTEMSDK_VERSIONS),$(BOARD_SYSTEMSDK_VERSIONS)) 344ifneq (,$(_unsupported_systemsdk_versions)) 345 $(error System SDK versions '$(_unsupported_systemsdk_versions)' in BOARD_SYSTEMSDK_VERSIONS are not supported.\ 346 Supported versions are $(PLATFORM_SYSTEMSDK_VERSIONS)) 347endif 348 349# --------------------------------------------------------------- 350# Set up configuration for target machine. 351# The following must be set: 352# TARGET_OS = { linux } 353# TARGET_ARCH = { arm | x86 | mips } 354 355TARGET_OS := linux 356# TARGET_ARCH should be set by BoardConfig.mk and will be checked later 357ifneq ($(filter %64,$(TARGET_ARCH)),) 358TARGET_IS_64_BIT := true 359endif 360 361# the target build type defaults to release 362ifneq ($(TARGET_BUILD_TYPE),debug) 363TARGET_BUILD_TYPE := release 364endif 365 366# --------------------------------------------------------------- 367# figure out the output directories 368 369ifeq (,$(strip $(OUT_DIR))) 370ifeq (,$(strip $(OUT_DIR_COMMON_BASE))) 371OUT_DIR := $(TOPDIR)out 372else 373OUT_DIR := $(OUT_DIR_COMMON_BASE)/$(notdir $(PWD)) 374endif 375endif 376 377SOONG_OUT_DIR := $(OUT_DIR)/soong 378 379TARGET_OUT_ROOT := $(OUT_DIR)/target 380 381HOST_OUT_ROOT := $(OUT_DIR)/host 382 383# We want to avoid two host bin directories in multilib build. 384HOST_OUT := $(HOST_OUT_ROOT)/$(HOST_OS)-$(HOST_PREBUILT_ARCH) 385SOONG_HOST_OUT := $(SOONG_OUT_DIR)/host/$(HOST_OS)-$(HOST_PREBUILT_ARCH) 386# TODO: remove 387BUILD_OUT := $(HOST_OUT) 388 389HOST_CROSS_OUT := $(HOST_OUT_ROOT)/windows-$(HOST_PREBUILT_ARCH) 390 391TARGET_PRODUCT_OUT_ROOT := $(TARGET_OUT_ROOT)/product 392 393TARGET_COMMON_OUT_ROOT := $(TARGET_OUT_ROOT)/common 394HOST_COMMON_OUT_ROOT := $(HOST_OUT_ROOT)/common 395 396PRODUCT_OUT := $(TARGET_PRODUCT_OUT_ROOT)/$(TARGET_DEVICE) 397 398OUT_DOCS := $(TARGET_COMMON_OUT_ROOT)/docs 399OUT_NDK_DOCS := $(TARGET_COMMON_OUT_ROOT)/ndk-docs 400 401BUILD_OUT_EXECUTABLES := $(BUILD_OUT)/bin 402SOONG_HOST_OUT_EXECUTABLES := $(SOONG_HOST_OUT)/bin 403 404HOST_OUT_EXECUTABLES := $(HOST_OUT)/bin 405HOST_OUT_SHARED_LIBRARIES := $(HOST_OUT)/lib64 406HOST_OUT_RENDERSCRIPT_BITCODE := $(HOST_OUT_SHARED_LIBRARIES) 407HOST_OUT_JAVA_LIBRARIES := $(HOST_OUT)/framework 408HOST_OUT_SDK_ADDON := $(HOST_OUT)/sdk_addon 409HOST_OUT_NATIVE_TESTS := $(HOST_OUT)/nativetest64 410HOST_OUT_COVERAGE := $(HOST_OUT)/coverage 411HOST_OUT_TESTCASES := $(HOST_OUT)/testcases 412 413HOST_CROSS_OUT_EXECUTABLES := $(HOST_CROSS_OUT)/bin 414HOST_CROSS_OUT_SHARED_LIBRARIES := $(HOST_CROSS_OUT)/lib 415HOST_CROSS_OUT_NATIVE_TESTS := $(HOST_CROSS_OUT)/nativetest 416HOST_CROSS_OUT_COVERAGE := $(HOST_CROSS_OUT)/coverage 417HOST_CROSS_OUT_TESTCASES := $(HOST_CROSS_OUT)/testcases 418 419HOST_OUT_INTERMEDIATES := $(HOST_OUT)/obj 420HOST_OUT_INTERMEDIATE_LIBRARIES := $(HOST_OUT_INTERMEDIATES)/lib 421HOST_OUT_NOTICE_FILES := $(HOST_OUT_INTERMEDIATES)/NOTICE_FILES 422HOST_OUT_COMMON_INTERMEDIATES := $(HOST_COMMON_OUT_ROOT)/obj 423HOST_OUT_FAKE := $(HOST_OUT)/fake_packages 424 425# Nano environment config 426include $(BUILD_SYSTEM)/aux_config.mk 427 428HOST_CROSS_OUT_INTERMEDIATES := $(HOST_CROSS_OUT)/obj 429HOST_CROSS_OUT_INTERMEDIATE_LIBRARIES := $(HOST_CROSS_OUT_INTERMEDIATES)/lib 430HOST_CROSS_OUT_NOTICE_FILES := $(HOST_CROSS_OUT_INTERMEDIATES)/NOTICE_FILES 431 432HOST_OUT_GEN := $(HOST_OUT)/gen 433HOST_OUT_COMMON_GEN := $(HOST_COMMON_OUT_ROOT)/gen 434 435HOST_CROSS_OUT_GEN := $(HOST_CROSS_OUT)/gen 436 437HOST_OUT_TEST_CONFIG := $(HOST_OUT)/test_config 438 439# Out for HOST_2ND_ARCH 440HOST_2ND_ARCH_VAR_PREFIX := 2ND_ 441HOST_2ND_ARCH_MODULE_SUFFIX := _32 442$(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_INTERMEDIATES := $(HOST_OUT)/obj32 443$(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_INTERMEDIATE_LIBRARIES := $($(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_INTERMEDIATES)/lib 444$(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_SHARED_LIBRARIES := $(HOST_OUT)/lib 445$(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_EXECUTABLES := $(HOST_OUT_EXECUTABLES) 446$(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_JAVA_LIBRARIES := $(HOST_OUT_JAVA_LIBRARIES) 447$(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_NATIVE_TESTS := $(HOST_OUT)/nativetest 448$(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_TESTCASES := $(HOST_OUT_TESTCASES) 449 450# The default host library path. 451# It always points to the path where we build libraries in the default bitness. 452HOST_LIBRARY_PATH := $(HOST_OUT_SHARED_LIBRARIES) 453 454# Out for HOST_CROSS_2ND_ARCH 455HOST_CROSS_2ND_ARCH_VAR_PREFIX := 2ND_ 456HOST_CROSS_2ND_ARCH_MODULE_SUFFIX := _64 457$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_INTERMEDIATES := $(HOST_CROSS_OUT)/obj64 458$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_INTERMEDIATE_LIBRARIES := $($(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_INTERMEDIATES)/lib 459$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_SHARED_LIBRARIES := $(HOST_CROSS_OUT)/lib64 460$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_EXECUTABLES := $(HOST_CROSS_OUT_EXECUTABLES) 461$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_NATIVE_TESTS := $(HOST_CROSS_OUT)/nativetest64 462 463ifneq ($(filter address,$(SANITIZE_TARGET)),) 464 TARGET_OUT_INTERMEDIATES := $(PRODUCT_OUT)/obj_asan 465else 466 TARGET_OUT_INTERMEDIATES := $(PRODUCT_OUT)/obj 467endif 468TARGET_OUT_HEADERS := $(TARGET_OUT_INTERMEDIATES)/include 469TARGET_OUT_INTERMEDIATE_LIBRARIES := $(TARGET_OUT_INTERMEDIATES)/lib 470 471ifneq ($(filter address,$(SANITIZE_TARGET)),) 472 TARGET_OUT_COMMON_INTERMEDIATES := $(TARGET_COMMON_OUT_ROOT)/obj_asan 473else 474 TARGET_OUT_COMMON_INTERMEDIATES := $(TARGET_COMMON_OUT_ROOT)/obj 475endif 476 477TARGET_OUT_GEN := $(PRODUCT_OUT)/gen 478TARGET_OUT_COMMON_GEN := $(TARGET_COMMON_OUT_ROOT)/gen 479 480TARGET_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_SYSTEM) 481ifneq ($(filter address,$(SANITIZE_TARGET)),) 482target_out_shared_libraries_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/system 483ifeq ($(SANITIZE_LITE),true) 484# When using SANITIZE_LITE, APKs must not be packaged with sanitized libraries, as they will not 485# work with unsanitized app_process. For simplicity, generate APKs into /data/asan/. 486target_out_app_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/system 487else 488target_out_app_base := $(TARGET_OUT) 489endif 490else 491target_out_shared_libraries_base := $(TARGET_OUT) 492target_out_app_base := $(TARGET_OUT) 493endif 494 495TARGET_OUT_EXECUTABLES := $(TARGET_OUT)/bin 496TARGET_OUT_OPTIONAL_EXECUTABLES := $(TARGET_OUT)/xbin 497ifeq ($(TARGET_IS_64_BIT),true) 498# /system/lib always contains 32-bit libraries, 499# and /system/lib64 (if present) always contains 64-bit libraries. 500TARGET_OUT_SHARED_LIBRARIES := $(target_out_shared_libraries_base)/lib64 501else 502TARGET_OUT_SHARED_LIBRARIES := $(target_out_shared_libraries_base)/lib 503endif 504TARGET_OUT_RENDERSCRIPT_BITCODE := $(TARGET_OUT_SHARED_LIBRARIES) 505TARGET_OUT_JAVA_LIBRARIES := $(TARGET_OUT)/framework 506TARGET_OUT_APPS := $(target_out_app_base)/app 507TARGET_OUT_APPS_PRIVILEGED := $(target_out_app_base)/priv-app 508TARGET_OUT_KEYLAYOUT := $(TARGET_OUT)/usr/keylayout 509TARGET_OUT_KEYCHARS := $(TARGET_OUT)/usr/keychars 510TARGET_OUT_ETC := $(TARGET_OUT)/etc 511TARGET_OUT_NOTICE_FILES := $(TARGET_OUT_INTERMEDIATES)/NOTICE_FILES 512TARGET_OUT_FAKE := $(PRODUCT_OUT)/fake_packages 513TARGET_OUT_TESTCASES := $(PRODUCT_OUT)/testcases 514TARGET_OUT_TEST_CONFIG := $(PRODUCT_OUT)/test_config 515 516ifeq ($(SANITIZE_LITE),true) 517# When using SANITIZE_LITE, APKs must not be packaged with sanitized libraries, as they will not 518# work with unsanitized app_process. For simplicity, generate APKs into /data/asan/. 519TARGET_OUT_SYSTEM_OTHER := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/$(TARGET_COPY_OUT_SYSTEM_OTHER) 520else 521TARGET_OUT_SYSTEM_OTHER := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_SYSTEM_OTHER) 522endif 523 524# Out for TARGET_2ND_ARCH 525TARGET_2ND_ARCH_VAR_PREFIX := $(HOST_2ND_ARCH_VAR_PREFIX) 526ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true) 527# With this you can reference the arm binary translation library with libfoo_arm in PRODUCT_PACKAGES. 528TARGET_2ND_ARCH_MODULE_SUFFIX := _$(TARGET_2ND_ARCH) 529else 530TARGET_2ND_ARCH_MODULE_SUFFIX := $(HOST_2ND_ARCH_MODULE_SUFFIX) 531endif 532 533ifneq ($(filter address,$(SANITIZE_TARGET)),) 534 $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATES := $(PRODUCT_OUT)/obj_$(TARGET_2ND_ARCH)_asan 535else 536 $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATES := $(PRODUCT_OUT)/obj_$(TARGET_2ND_ARCH) 537endif 538$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES := $($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATES)/lib 539ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true) 540$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SHARED_LIBRARIES := $(target_out_shared_libraries_base)/lib/$(TARGET_2ND_ARCH) 541else 542$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SHARED_LIBRARIES := $(target_out_shared_libraries_base)/lib 543endif 544$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_RENDERSCRIPT_BITCODE := $($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SHARED_LIBRARIES) 545$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_EXECUTABLES := $(TARGET_OUT_EXECUTABLES) 546$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_APPS := $(TARGET_OUT_APPS) 547$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_APPS_PRIVILEGED := $(TARGET_OUT_APPS_PRIVILEGED) 548$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_TESTCASES := $(TARGET_OUT_TESTCASES) 549 550TARGET_OUT_DATA := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_DATA) 551TARGET_OUT_DATA_EXECUTABLES := $(TARGET_OUT_EXECUTABLES) 552TARGET_OUT_DATA_SHARED_LIBRARIES := $(TARGET_OUT_SHARED_LIBRARIES) 553TARGET_OUT_DATA_JAVA_LIBRARIES := $(TARGET_OUT_DATA)/framework 554TARGET_OUT_DATA_APPS := $(TARGET_OUT_DATA)/app 555TARGET_OUT_DATA_KEYLAYOUT := $(TARGET_OUT_KEYLAYOUT) 556TARGET_OUT_DATA_KEYCHARS := $(TARGET_OUT_KEYCHARS) 557TARGET_OUT_DATA_ETC := $(TARGET_OUT_ETC) 558ifeq ($(TARGET_IS_64_BIT),true) 559TARGET_OUT_DATA_NATIVE_TESTS := $(TARGET_OUT_DATA)/nativetest64 560TARGET_OUT_DATA_METRIC_TESTS := $(TARGET_OUT_DATA)/benchmarktest64 561TARGET_OUT_VENDOR_NATIVE_TESTS := $(TARGET_OUT_DATA)/nativetest64$(TARGET_VENDOR_TEST_SUFFIX) 562TARGET_OUT_VENDOR_METRIC_TESTS := $(TARGET_OUT_DATA)/benchmarktest64$(TARGET_VENDOR_TEST_SUFFIX) 563else 564TARGET_OUT_DATA_NATIVE_TESTS := $(TARGET_OUT_DATA)/nativetest 565TARGET_OUT_DATA_METRIC_TESTS := $(TARGET_OUT_DATA)/benchmarktest 566TARGET_OUT_VENDOR_NATIVE_TESTS := $(TARGET_OUT_DATA)/nativetest$(TARGET_VENDOR_TEST_SUFFIX) 567TARGET_OUT_VENDOR_METRIC_TESTS := $(TARGET_OUT_DATA)/benchmarktest$(TARGET_VENDOR_TEST_SUFFIX) 568endif 569TARGET_OUT_DATA_FAKE := $(TARGET_OUT_DATA)/fake_packages 570 571$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_EXECUTABLES := $(TARGET_OUT_DATA_EXECUTABLES) 572$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_SHARED_LIBRARIES := $($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SHARED_LIBRARIES) 573$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_APPS := $(TARGET_OUT_DATA_APPS) 574ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true) 575$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_NATIVE_TESTS := $(TARGET_OUT_DATA)/nativetest/$(TARGET_2ND_ARCH) 576$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_METRIC_TESTS := $(TARGET_OUT_DATA)/benchmarktest/$(TARGET_2ND_ARCH) 577$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_NATIVE_TESTS := $(TARGET_OUT_DATA)/nativetest/$(TARGET_2ND_ARCH)$(TARGET_VENDOR_TEST_SUFFIX) 578$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_METRIC_TESTS := $(TARGET_OUT_DATA)/benchmarktest/$(TARGET_2ND_ARCH)$(TARGET_VENDOR_TEST_SUFFIX) 579else 580$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_NATIVE_TESTS := $(TARGET_OUT_DATA)/nativetest 581$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_METRIC_TESTS := $(TARGET_OUT_DATA)/benchmarktest 582$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_NATIVE_TESTS := $(TARGET_OUT_DATA)/nativetest$(TARGET_VENDOR_TEST_SUFFIX) 583$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_METRIC_TESTS := $(TARGET_OUT_DATA)/benchmarktest$(TARGET_VENDOR_TEST_SUFFIX) 584endif 585 586TARGET_OUT_CACHE := $(PRODUCT_OUT)/cache 587 588TARGET_OUT_VENDOR := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_VENDOR) 589ifneq ($(filter address,$(SANITIZE_TARGET)),) 590target_out_vendor_shared_libraries_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/vendor 591ifeq ($(SANITIZE_LITE),true) 592# When using SANITIZE_LITE, APKs must not be packaged with sanitized libraries, as they will not 593# work with unsanitized app_process. For simplicity, generate APKs into /data/asan/. 594target_out_vendor_app_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/vendor 595else 596target_out_vendor_app_base := $(TARGET_OUT_VENDOR) 597endif 598else 599target_out_vendor_shared_libraries_base := $(TARGET_OUT_VENDOR) 600target_out_vendor_app_base := $(TARGET_OUT_VENDOR) 601endif 602 603TARGET_OUT_VENDOR_EXECUTABLES := $(TARGET_OUT_VENDOR)/bin 604TARGET_OUT_VENDOR_OPTIONAL_EXECUTABLES := $(TARGET_OUT_VENDOR)/xbin 605ifeq ($(TARGET_IS_64_BIT),true) 606TARGET_OUT_VENDOR_SHARED_LIBRARIES := $(target_out_vendor_shared_libraries_base)/lib64 607else 608TARGET_OUT_VENDOR_SHARED_LIBRARIES := $(target_out_vendor_shared_libraries_base)/lib 609endif 610TARGET_OUT_VENDOR_RENDERSCRIPT_BITCODE := $(TARGET_OUT_VENDOR_SHARED_LIBRARIES) 611TARGET_OUT_VENDOR_JAVA_LIBRARIES := $(TARGET_OUT_VENDOR)/framework 612TARGET_OUT_VENDOR_APPS := $(target_out_vendor_app_base)/app 613TARGET_OUT_VENDOR_APPS_PRIVILEGED := $(target_out_vendor_app_base)/priv-app 614TARGET_OUT_VENDOR_ETC := $(TARGET_OUT_VENDOR)/etc 615 616$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_EXECUTABLES := $(TARGET_OUT_VENDOR_EXECUTABLES) 617ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true) 618$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_SHARED_LIBRARIES := $(target_out_vendor_shared_libraries_base)/lib/$(TARGET_2ND_ARCH) 619else 620$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_SHARED_LIBRARIES := $(target_out_vendor_shared_libraries_base)/lib 621endif 622$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_RENDERSCRIPT_BITCODE := $($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_SHARED_LIBRARIES) 623$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_APPS := $(TARGET_OUT_VENDOR_APPS) 624$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_APPS_PRIVILEGED := $(TARGET_OUT_VENDOR_APPS_PRIVILEGED) 625 626TARGET_OUT_OEM := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_OEM) 627TARGET_OUT_OEM_EXECUTABLES := $(TARGET_OUT_OEM)/bin 628ifeq ($(TARGET_IS_64_BIT),true) 629TARGET_OUT_OEM_SHARED_LIBRARIES := $(TARGET_OUT_OEM)/lib64 630else 631TARGET_OUT_OEM_SHARED_LIBRARIES := $(TARGET_OUT_OEM)/lib 632endif 633# We don't expect Java libraries in the oem.img. 634# TARGET_OUT_OEM_JAVA_LIBRARIES:= $(TARGET_OUT_OEM)/framework 635TARGET_OUT_OEM_APPS := $(TARGET_OUT_OEM)/app 636TARGET_OUT_OEM_ETC := $(TARGET_OUT_OEM)/etc 637 638$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_OEM_EXECUTABLES := $(TARGET_OUT_OEM_EXECUTABLES) 639ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true) 640$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_OEM_SHARED_LIBRARIES := $(TARGET_OUT_OEM)/lib/$(TARGET_2ND_ARCH) 641else 642$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_OEM_SHARED_LIBRARIES := $(TARGET_OUT_OEM)/lib 643endif 644$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_OEM_APPS := $(TARGET_OUT_OEM_APPS) 645 646TARGET_OUT_ODM := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ODM) 647TARGET_OUT_ODM_EXECUTABLES := $(TARGET_OUT_ODM)/bin 648ifeq ($(TARGET_IS_64_BIT),true) 649TARGET_OUT_ODM_SHARED_LIBRARIES := $(TARGET_OUT_ODM)/lib64 650else 651TARGET_OUT_ODM_SHARED_LIBRARIES := $(TARGET_OUT_ODM)/lib 652endif 653TARGET_OUT_ODM_APPS := $(TARGET_OUT_ODM)/app 654TARGET_OUT_ODM_ETC := $(TARGET_OUT_ODM)/etc 655 656$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_EXECUTABLES := $(TARGET_OUT_ODM_EXECUTABLES) 657ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true) 658$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_SHARED_LIBRARIES := $(TARGET_OUT_ODM)/lib/$(TARGET_2ND_ARCH) 659else 660$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_SHARED_LIBRARIES := $(TARGET_OUT_ODM)/lib 661endif 662$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_APPS := $(TARGET_OUT_ODM_APPS) 663 664TARGET_OUT_PRODUCT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_PRODUCT) 665ifneq ($(filter address,$(SANITIZE_TARGET)),) 666target_out_product_shared_libraries_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/product 667ifeq ($(SANITIZE_LITE),true) 668# When using SANITIZE_LITE, APKs must not be packaged with sanitized libraries, as they will not 669# work with unsanitized app_process. For simplicity, generate APKs into /data/asan/. 670target_out_product_app_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/product 671else 672target_out_product_app_base := $(TARGET_OUT_PRODUCT) 673endif 674else 675target_out_product_shared_libraries_base := $(TARGET_OUT_PRODUCT) 676target_out_product_app_base := $(TARGET_OUT_PRODUCT) 677endif 678 679ifeq ($(TARGET_IS_64_BIT),true) 680TARGET_OUT_PRODUCT_SHARED_LIBRARIES := $(target_out_product_shared_libraries_base)/lib64 681else 682TARGET_OUT_PRODUCT_SHARED_LIBRARIES := $(target_out_product_shared_libraries_base)/lib 683endif 684TARGET_OUT_PRODUCT_JAVA_LIBRARIES:= $(TARGET_OUT_PRODUCT)/framework 685TARGET_OUT_PRODUCT_APPS := $(target_out_product_app_base)/app 686TARGET_OUT_PRODUCT_APPS_PRIVILEGED := $(target_out_product_app_base)/priv-app 687TARGET_OUT_PRODUCT_ETC := $(TARGET_OUT_PRODUCT)/etc 688 689ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true) 690$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_PRODUCT_SHARED_LIBRARIES := $(target_out_product_shared_libraries_base)/lib/$(TARGET_2ND_ARCH) 691else 692$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_PRODUCT_SHARED_LIBRARIES := $(target_out_product_shared_libraries_base)/lib 693endif 694$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_PRODUCT_APPS := $(TARGET_OUT_PRODUCT_APPS) 695$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_PRODUCT_APPS_PRIVILEGED := $(TARGET_OUT_PRODUCT_APPS_PRIVILEGED) 696 697TARGET_OUT_BREAKPAD := $(PRODUCT_OUT)/breakpad 698 699TARGET_OUT_UNSTRIPPED := $(PRODUCT_OUT)/symbols 700TARGET_OUT_EXECUTABLES_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)/system/bin 701TARGET_OUT_SHARED_LIBRARIES_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)/system/lib 702TARGET_OUT_VENDOR_SHARED_LIBRARIES_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)/$(TARGET_COPY_OUT_VENDOR)/lib 703TARGET_ROOT_OUT_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED) 704TARGET_ROOT_OUT_SBIN_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)/sbin 705TARGET_ROOT_OUT_BIN_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)/bin 706TARGET_OUT_COVERAGE := $(PRODUCT_OUT)/coverage 707 708TARGET_ROOT_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ROOT) 709TARGET_ROOT_OUT_BIN := $(TARGET_ROOT_OUT)/bin 710TARGET_ROOT_OUT_SBIN := $(TARGET_ROOT_OUT)/sbin 711TARGET_ROOT_OUT_ETC := $(TARGET_ROOT_OUT)/etc 712TARGET_ROOT_OUT_USR := $(TARGET_ROOT_OUT)/usr 713 714TARGET_RECOVERY_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_RECOVERY) 715TARGET_RECOVERY_ROOT_OUT := $(TARGET_RECOVERY_OUT)/root 716 717TARGET_SYSLOADER_OUT := $(PRODUCT_OUT)/sysloader 718TARGET_SYSLOADER_ROOT_OUT := $(TARGET_SYSLOADER_OUT)/root 719TARGET_SYSLOADER_SYSTEM_OUT := $(TARGET_SYSLOADER_OUT)/root/system 720 721TARGET_INSTALLER_OUT := $(PRODUCT_OUT)/installer 722TARGET_INSTALLER_DATA_OUT := $(TARGET_INSTALLER_OUT)/data 723TARGET_INSTALLER_ROOT_OUT := $(TARGET_INSTALLER_OUT)/root 724TARGET_INSTALLER_SYSTEM_OUT := $(TARGET_INSTALLER_OUT)/root/system 725 726COMMON_MODULE_CLASSES := TARGET-NOTICE_FILES HOST-NOTICE_FILES HOST-JAVA_LIBRARIES 727PER_ARCH_MODULE_CLASSES := SHARED_LIBRARIES STATIC_LIBRARIES EXECUTABLES GYP RENDERSCRIPT_BITCODE NATIVE_TESTS HEADER_LIBRARIES 728 729ifeq (,$(strip $(DIST_DIR))) 730 DIST_DIR := $(OUT_DIR)/dist 731endif 732 733ifeq ($(CALLED_FROM_SETUP),true) 734PRINT_BUILD_CONFIG ?= true 735endif 736