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 6 ifndef 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) 18 endif 19 20 # Only use ANDROID_BUILD_SHELL to wrap around bash. 21 # DO NOT use other shells such as zsh. 22 ifdef ANDROID_BUILD_SHELL 23 SHELL := $(ANDROID_BUILD_SHELL) 24 else 25 # Use bash, not whatever shell somebody has installed as /bin/sh 26 # This is repeated from main.mk, since envsetup.sh runs this file 27 # directly. 28 SHELL := /bin/bash 29 endif 30 31 # Utility variables. 32 empty := 33 space := $(empty) $(empty) 34 comma := , 35 # Note that make will eat the newline just before endef. 36 define newline 37 38 39 endef 40 # The pound character "#" 41 define pound 42 # 43 endef 44 # Unfortunately you can't simply define backslash as \ or \\. 45 backslash := \a 46 backslash := $(patsubst %a,%,$(backslash)) 47 48 # this turns off the suffix rules built into make 49 .SUFFIXES: 50 51 # this turns off the RCS / SCCS implicit rules of GNU Make 52 % : RCS/%,v 53 % : RCS/% 54 % : %,v 55 % : s.% 56 % : SCCS/s.% 57 58 # If a rule fails, delete $@. 59 .DELETE_ON_ERROR: 60 61 # Mark variables deprecated/obsolete 62 CHANGES_URL := https://android.googlesource.com/platform/build/+/master/Changes.md 63 $(KATI_obsolete_var PATH,Do not use PATH directly. See $(CHANGES_URL)#PATH) 64 $(KATI_obsolete_var PYTHONPATH,Do not use PYTHONPATH directly. See $(CHANGES_URL)#PYTHONPATH) 65 $(KATI_obsolete_var OUT,Use OUT_DIR instead. See $(CHANGES_URL)#OUT) 66 $(KATI_obsolete_var ANDROID_HOST_OUT,Use HOST_OUT instead. See $(CHANGES_URL)#ANDROID_HOST_OUT) 67 $(KATI_obsolete_var ANDROID_PRODUCT_OUT,Use PRODUCT_OUT instead. See $(CHANGES_URL)#ANDROID_PRODUCT_OUT) 68 $(KATI_obsolete_var ANDROID_HOST_OUT_TESTCASES,Use HOST_OUT_TESTCASES instead. See $(CHANGES_URL)#ANDROID_HOST_OUT_TESTCASES) 69 $(KATI_obsolete_var ANDROID_TARGET_OUT_TESTCASES,Use TARGET_OUT_TESTCASES instead. See $(CHANGES_URL)#ANDROID_TARGET_OUT_TESTCASES) 70 $(KATI_obsolete_var ANDROID_BUILD_TOP,Use '.' instead. See $(CHANGES_URL)#ANDROID_BUILD_TOP) 71 $(KATI_obsolete_var \ 72 ANDROID_TOOLCHAIN \ 73 ANDROID_TOOLCHAIN_2ND_ARCH \ 74 ANDROID_DEV_SCRIPTS \ 75 ANDROID_EMULATOR_PREBUILTS \ 76 ANDROID_PRE_BUILD_PATHS \ 77 ,See $(CHANGES_URL)#other_envsetup_variables) 78 $(KATI_obsolete_var PRODUCT_COMPATIBILITY_MATRIX_LEVEL_OVERRIDE,Set FCM Version in device manifest instead. See $(CHANGES_URL)#PRODUCT_COMPATIBILITY_MATRIX_LEVEL_OVERRIDE) 79 $(KATI_obsolete_var USE_CLANG_PLATFORM_BUILD,Clang is the only supported Android compiler. See $(CHANGES_URL)#USE_CLANG_PLATFORM_BUILD) 80 81 CHANGES_URL := 82 83 # Used to force goals to build. Only use for conditionally defined goals. 84 .PHONY: FORCE 85 FORCE: 86 87 ORIGINAL_MAKECMDGOALS := $(MAKECMDGOALS) 88 89 dist_goal := $(strip $(filter dist,$(MAKECMDGOALS))) 90 MAKECMDGOALS := $(strip $(filter-out dist,$(MAKECMDGOALS))) 91 92 UNAME := $(shell uname -sm) 93 94 SRC_TARGET_DIR := $(TOPDIR)build/target 95 SRC_API_DIR := $(TOPDIR)prebuilts/sdk/api 96 SRC_SYSTEM_API_DIR := $(TOPDIR)prebuilts/sdk/system-api 97 SRC_TEST_API_DIR := $(TOPDIR)prebuilts/sdk/test-api 98 99 # Some specific paths to tools 100 SRC_DROIDDOC_DIR := $(TOPDIR)build/make/tools/droiddoc 101 102 # Set up efficient math functions which are used in make. 103 # Here since this file is included by envsetup as well as during build. 104 include $(BUILD_SYSTEM)/math.mk 105 106 # Various mappings to avoid hard-coding paths all over the place 107 include $(BUILD_SYSTEM)/pathmap.mk 108 109 # Allow projects to define their own globally-available variables 110 include $(BUILD_SYSTEM)/project_definitions.mk 111 112 # ############################################################### 113 # Build system internal files 114 # ############################################################### 115 116 BUILD_COMBOS:= $(BUILD_SYSTEM)/combo 117 118 CLEAR_VARS:= $(BUILD_SYSTEM)/clear_vars.mk 119 BUILD_HOST_STATIC_LIBRARY:= $(BUILD_SYSTEM)/host_static_library.mk 120 BUILD_HOST_SHARED_LIBRARY:= $(BUILD_SYSTEM)/host_shared_library.mk 121 BUILD_STATIC_LIBRARY:= $(BUILD_SYSTEM)/static_library.mk 122 BUILD_HEADER_LIBRARY:= $(BUILD_SYSTEM)/header_library.mk 123 BUILD_AUX_STATIC_LIBRARY:= $(BUILD_SYSTEM)/aux_static_library.mk 124 BUILD_AUX_EXECUTABLE:= $(BUILD_SYSTEM)/aux_executable.mk 125 BUILD_SHARED_LIBRARY:= $(BUILD_SYSTEM)/shared_library.mk 126 BUILD_EXECUTABLE:= $(BUILD_SYSTEM)/executable.mk 127 BUILD_HOST_EXECUTABLE:= $(BUILD_SYSTEM)/host_executable.mk 128 BUILD_PACKAGE:= $(BUILD_SYSTEM)/package.mk 129 BUILD_PHONY_PACKAGE:= $(BUILD_SYSTEM)/phony_package.mk 130 BUILD_RRO_PACKAGE:= $(BUILD_SYSTEM)/build_rro_package.mk 131 BUILD_HOST_PREBUILT:= $(BUILD_SYSTEM)/host_prebuilt.mk 132 BUILD_PREBUILT:= $(BUILD_SYSTEM)/prebuilt.mk 133 BUILD_MULTI_PREBUILT:= $(BUILD_SYSTEM)/multi_prebuilt.mk 134 BUILD_JAVA_LIBRARY:= $(BUILD_SYSTEM)/java_library.mk 135 BUILD_STATIC_JAVA_LIBRARY:= $(BUILD_SYSTEM)/static_java_library.mk 136 BUILD_HOST_JAVA_LIBRARY:= $(BUILD_SYSTEM)/host_java_library.mk 137 BUILD_DROIDDOC:= $(BUILD_SYSTEM)/droiddoc.mk 138 BUILD_APIDIFF:= $(BUILD_SYSTEM)/apidiff.mk 139 BUILD_COPY_HEADERS := $(BUILD_SYSTEM)/copy_headers.mk 140 BUILD_NATIVE_TEST := $(BUILD_SYSTEM)/native_test.mk 141 BUILD_NATIVE_BENCHMARK := $(BUILD_SYSTEM)/native_benchmark.mk 142 BUILD_HOST_NATIVE_TEST := $(BUILD_SYSTEM)/host_native_test.mk 143 BUILD_FUZZ_TEST := $(BUILD_SYSTEM)/fuzz_test.mk 144 BUILD_HOST_FUZZ_TEST := $(BUILD_SYSTEM)/host_fuzz_test.mk 145 146 BUILD_SHARED_TEST_LIBRARY := $(BUILD_SYSTEM)/shared_test_lib.mk 147 BUILD_HOST_SHARED_TEST_LIBRARY := $(BUILD_SYSTEM)/host_shared_test_lib.mk 148 BUILD_STATIC_TEST_LIBRARY := $(BUILD_SYSTEM)/static_test_lib.mk 149 BUILD_HOST_STATIC_TEST_LIBRARY := $(BUILD_SYSTEM)/host_static_test_lib.mk 150 151 BUILD_NOTICE_FILE := $(BUILD_SYSTEM)/notice_files.mk 152 BUILD_HOST_DALVIK_JAVA_LIBRARY := $(BUILD_SYSTEM)/host_dalvik_java_library.mk 153 BUILD_HOST_DALVIK_STATIC_JAVA_LIBRARY := $(BUILD_SYSTEM)/host_dalvik_static_java_library.mk 154 155 BUILD_HOST_TEST_CONFIG := $(BUILD_SYSTEM)/host_test_config.mk 156 BUILD_TARGET_TEST_CONFIG := $(BUILD_SYSTEM)/target_test_config.mk 157 158 INSTRUMENTATION_TEST_CONFIG_TEMPLATE := $(BUILD_SYSTEM)/instrumentation_test_config_template.xml 159 NATIVE_TEST_CONFIG_TEMPLATE := $(BUILD_SYSTEM)/native_test_config_template.xml 160 EMPTY_TEST_CONFIG := $(BUILD_SYSTEM)/empty_test_config.xml 161 162 # Tool to generate TradeFed test config file automatically. 163 AUTOGEN_TEST_CONFIG_SCRIPT := build/make/tools/auto_gen_test_config.py 164 165 # ############################################################### 166 # Parse out any modifier targets. 167 # ############################################################### 168 169 hide := @ 170 171 ################################################################ 172 # Tools needed in product configuration makefiles. 173 ################################################################ 174 NORMALIZE_PATH := build/make/tools/normalize_path.py 175 176 # $(1): the paths to be normalized 177 define normalize-paths 178 $(if $(1),$(shell $(NORMALIZE_PATH) $(1))) 179 endef 180 181 # ############################################################### 182 # Set common values 183 # ############################################################### 184 185 # Initialize SOONG_CONFIG_NAMESPACES so that it isn't recursive. 186 SOONG_CONFIG_NAMESPACES := 187 188 # Set the extensions used for various packages 189 COMMON_PACKAGE_SUFFIX := .zip 190 COMMON_JAVA_PACKAGE_SUFFIX := .jar 191 COMMON_ANDROID_PACKAGE_SUFFIX := .apk 192 193 ifdef TMPDIR 194 JAVA_TMPDIR_ARG := -Djava.io.tmpdir=$(TMPDIR) 195 else 196 JAVA_TMPDIR_ARG := 197 endif 198 199 # Default to remove the org.apache.http.legacy from bootclasspath 200 ifeq ($(REMOVE_OAHL_FROM_BCP),) 201 REMOVE_OAHL_FROM_BCP := true 202 endif 203 204 # ############################################################### 205 # Include sub-configuration files 206 # ############################################################### 207 208 # --------------------------------------------------------------- 209 # Try to include buildspec.mk, which will try to set stuff up. 210 # If this file doesn't exist, the environment variables will 211 # be used, and if that doesn't work, then the default is an 212 # arm build 213 ifndef ANDROID_BUILDSPEC 214 ANDROID_BUILDSPEC := $(TOPDIR)buildspec.mk 215 endif 216 -include $(ANDROID_BUILDSPEC) 217 218 # --------------------------------------------------------------- 219 # Define most of the global variables. These are the ones that 220 # are specific to the user's build configuration. 221 include $(BUILD_SYSTEM)/envsetup.mk 222 223 # Pruned directory options used when using findleaves.py 224 # See envsetup.mk for a description of SCAN_EXCLUDE_DIRS 225 FIND_LEAVES_EXCLUDES := $(addprefix --prune=, $(SCAN_EXCLUDE_DIRS) .repo .git) 226 227 # The build system exposes several variables for where to find the kernel 228 # headers: 229 # TARGET_DEVICE_KERNEL_HEADERS is automatically created for the current 230 # device being built. It is set as $(TARGET_DEVICE_DIR)/kernel-headers, 231 # e.g. device/samsung/tuna/kernel-headers. This directory is not 232 # explicitly set by anyone, the build system always adds this subdir. 233 # 234 # TARGET_BOARD_KERNEL_HEADERS is specified by the BoardConfig.mk file 235 # to allow other directories to be included. This is useful if there's 236 # some common place where a few headers are being kept for a group 237 # of devices. For example, device/<vendor>/common/kernel-headers could 238 # contain some headers for several of <vendor>'s devices. 239 # 240 # TARGET_PRODUCT_KERNEL_HEADERS is generated by the product inheritance 241 # graph. This allows architecture products to provide headers for the 242 # devices using that architecture. For example, 243 # hardware/ti/omap4xxx/omap4.mk will specify 244 # PRODUCT_VENDOR_KERNEL_HEADERS variable that specify where the omap4 245 # specific headers are, e.g. hardware/ti/omap4xxx/kernel-headers. 246 # The build system then combines all the values specified by all the 247 # PRODUCT_VENDOR_KERNEL_HEADERS directives in the product inheritance 248 # tree and then exports a TARGET_PRODUCT_KERNEL_HEADERS variable. 249 # 250 # The layout of subdirs in any of the kernel-headers dir should mirror the 251 # layout of the kernel include/ directory. For example, 252 # device/samsung/tuna/kernel-headers/linux/, 253 # hardware/ti/omap4xxx/kernel-headers/media/, 254 # etc. 255 # 256 # NOTE: These directories MUST contain post-processed headers using the 257 # bionic/libc/kernel/tools/clean_header.py tool. Additionally, the original 258 # kernel headers must also be checked in, but in a different subdirectory. By 259 # convention, the originals should be checked into original-kernel-headers 260 # directory of the same parent dir. For example, 261 # device/samsung/tuna/kernel-headers <----- post-processed 262 # device/samsung/tuna/original-kernel-headers <----- originals 263 # 264 TARGET_DEVICE_KERNEL_HEADERS := $(strip $(wildcard $(TARGET_DEVICE_DIR)/kernel-headers)) 265 266 define validate-kernel-headers 267 $(if $(firstword $(foreach hdr_dir,$(1),\ 268 $(filter-out kernel-headers,$(notdir $(hdr_dir))))),\ 269 $(error Kernel header dirs must be end in kernel-headers: $(1))) 270 endef 271 # also allow the board config to provide additional directories since 272 # there could be device/oem/base_hw and device/oem/derived_hw 273 # that both are valid devices but derived_hw needs to use kernel headers 274 # from base_hw. 275 TARGET_BOARD_KERNEL_HEADERS := $(strip $(wildcard $(TARGET_BOARD_KERNEL_HEADERS))) 276 TARGET_BOARD_KERNEL_HEADERS := $(patsubst %/,%,$(TARGET_BOARD_KERNEL_HEADERS)) 277 $(call validate-kernel-headers,$(TARGET_BOARD_KERNEL_HEADERS)) 278 279 # then add product-inherited includes, to allow for 280 # hardware/sivendor/chip/chip.mk to include their own headers 281 TARGET_PRODUCT_KERNEL_HEADERS := $(strip $(wildcard $(PRODUCT_VENDOR_KERNEL_HEADERS))) 282 TARGET_PRODUCT_KERNEL_HEADERS := $(patsubst %/,%,$(TARGET_PRODUCT_KERNEL_HEADERS)) 283 $(call validate-kernel-headers,$(TARGET_PRODUCT_KERNEL_HEADERS)) 284 285 # Clean up/verify variables defined by the board config file. 286 TARGET_BOOTLOADER_BOARD_NAME := $(strip $(TARGET_BOOTLOADER_BOARD_NAME)) 287 TARGET_CPU_ABI := $(strip $(TARGET_CPU_ABI)) 288 ifeq ($(TARGET_CPU_ABI),) 289 $(error No TARGET_CPU_ABI defined by board config: $(board_config_mk)) 290 endif 291 TARGET_CPU_ABI2 := $(strip $(TARGET_CPU_ABI2)) 292 293 BOARD_KERNEL_BASE := $(strip $(BOARD_KERNEL_BASE)) 294 BOARD_KERNEL_PAGESIZE := $(strip $(BOARD_KERNEL_PAGESIZE)) 295 296 # Commands to generate .toc file common to ELF .so files. 297 define _gen_toc_command_for_elf 298 $(hide) ($($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)READELF) -d $(1) | grep SONAME || echo "No SONAME for $1") > $(2) 299 $(hide) $($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)READELF) --dyn-syms $(1) | awk '{$$2=""; $$3=""; print}' >> $(2) 300 endef 301 302 # Commands to generate .toc file from Darwin dynamic library. 303 define _gen_toc_command_for_macho 304 $(hide) otool -l $(1) | grep LC_ID_DYLIB -A 5 > $(2) 305 $(hide) nm -gP $(1) | cut -f1-2 -d" " | (grep -v U$$ >> $(2) || true) 306 endef 307 308 combo_target := HOST_ 309 combo_2nd_arch_prefix := 310 include $(BUILD_SYSTEM)/combo/select.mk 311 312 # Load the 2nd host arch if it's needed. 313 ifdef HOST_2ND_ARCH 314 combo_target := HOST_ 315 combo_2nd_arch_prefix := $(HOST_2ND_ARCH_VAR_PREFIX) 316 include $(BUILD_SYSTEM)/combo/select.mk 317 endif 318 319 # Load the windows cross compiler under Linux 320 ifdef HOST_CROSS_OS 321 combo_target := HOST_CROSS_ 322 combo_2nd_arch_prefix := 323 include $(BUILD_SYSTEM)/combo/select.mk 324 325 ifdef HOST_CROSS_2ND_ARCH 326 combo_target := HOST_CROSS_ 327 combo_2nd_arch_prefix := $(HOST_CROSS_2ND_ARCH_VAR_PREFIX) 328 include $(BUILD_SYSTEM)/combo/select.mk 329 endif 330 endif 331 332 # on windows, the tools have .exe at the end, and we depend on the 333 # host config stuff being done first 334 335 combo_target := TARGET_ 336 combo_2nd_arch_prefix := 337 include $(BUILD_SYSTEM)/combo/select.mk 338 339 # Load the 2nd target arch if it's needed. 340 ifdef TARGET_2ND_ARCH 341 combo_target := TARGET_ 342 combo_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX) 343 include $(BUILD_SYSTEM)/combo/select.mk 344 endif 345 346 ifeq ($(CALLED_FROM_SETUP),true) 347 include $(BUILD_SYSTEM)/ccache.mk 348 include $(BUILD_SYSTEM)/goma.mk 349 350 export CC_WRAPPER 351 export CXX_WRAPPER 352 export JAVAC_WRAPPER 353 endif 354 355 ifdef TARGET_PREFER_32_BIT 356 TARGET_PREFER_32_BIT_APPS := true 357 TARGET_PREFER_32_BIT_EXECUTABLES := true 358 endif 359 360 ifeq (,$(TARGET_SUPPORTS_32_BIT_APPS)$(TARGET_SUPPORTS_64_BIT_APPS)) 361 TARGET_SUPPORTS_32_BIT_APPS := true 362 endif 363 364 # "ro.product.cpu.abilist32" and "ro.product.cpu.abilist64" are 365 # comma separated lists of the 32 and 64 bit ABIs (in order of 366 # preference) that the target supports. If TARGET_CPU_ABI_LIST_{32,64}_BIT 367 # are defined by the board config, we use them. Else, we construct 368 # these lists based on whether TARGET_IS_64_BIT is set. 369 # 370 # Note that this assumes that the 2ND_CPU_ABI for a 64 bit target 371 # is always 32 bits. If this isn't the case, these variables should 372 # be overriden in the board configuration. 373 ifeq (,$(TARGET_CPU_ABI_LIST_64_BIT)) 374 ifeq (true|true,$(TARGET_IS_64_BIT)|$(TARGET_SUPPORTS_64_BIT_APPS)) 375 TARGET_CPU_ABI_LIST_64_BIT := $(TARGET_CPU_ABI) $(TARGET_CPU_ABI2) 376 endif 377 endif 378 379 ifeq (,$(TARGET_CPU_ABI_LIST_32_BIT)) 380 ifneq (true,$(TARGET_IS_64_BIT)) 381 TARGET_CPU_ABI_LIST_32_BIT := $(TARGET_CPU_ABI) $(TARGET_CPU_ABI2) 382 else 383 ifeq (true,$(TARGET_SUPPORTS_32_BIT_APPS)) 384 # For a 64 bit target, assume that the 2ND_CPU_ABI 385 # is a 32 bit ABI. 386 TARGET_CPU_ABI_LIST_32_BIT := $(TARGET_2ND_CPU_ABI) $(TARGET_2ND_CPU_ABI2) 387 endif 388 endif 389 endif 390 391 # "ro.product.cpu.abilist" is a comma separated list of ABIs (in order 392 # of preference) that the target supports. If a TARGET_CPU_ABI_LIST 393 # is specified by the board configuration, we use that. If not, we 394 # build a list out of the TARGET_CPU_ABIs specified by the config. 395 ifeq (,$(TARGET_CPU_ABI_LIST)) 396 ifeq ($(TARGET_IS_64_BIT)|$(TARGET_PREFER_32_BIT_APPS),true|true) 397 TARGET_CPU_ABI_LIST := $(TARGET_CPU_ABI_LIST_32_BIT) $(TARGET_CPU_ABI_LIST_64_BIT) 398 else 399 TARGET_CPU_ABI_LIST := $(TARGET_CPU_ABI_LIST_64_BIT) $(TARGET_CPU_ABI_LIST_32_BIT) 400 endif 401 endif 402 403 # Strip whitespace from the ABI list string. 404 TARGET_CPU_ABI_LIST := $(subst $(space),$(comma),$(strip $(TARGET_CPU_ABI_LIST))) 405 TARGET_CPU_ABI_LIST_32_BIT := $(subst $(space),$(comma),$(strip $(TARGET_CPU_ABI_LIST_32_BIT))) 406 TARGET_CPU_ABI_LIST_64_BIT := $(subst $(space),$(comma),$(strip $(TARGET_CPU_ABI_LIST_64_BIT))) 407 408 # GCC version selection 409 TARGET_GCC_VERSION := 4.9 410 ifdef TARGET_2ND_ARCH 411 2ND_TARGET_GCC_VERSION := 4.9 412 endif 413 414 # Normalize WITH_STATIC_ANALYZER 415 ifeq ($(strip $(WITH_STATIC_ANALYZER)),0) 416 WITH_STATIC_ANALYZER := 417 endif 418 419 # Unset WITH_TIDY_ONLY if global WITH_TIDY_ONLY is not true nor 1. 420 ifeq (,$(filter 1 true,$(WITH_TIDY_ONLY))) 421 WITH_TIDY_ONLY := 422 endif 423 424 # Pick a Java compiler. 425 include $(BUILD_SYSTEM)/combo/javac.mk 426 427 # --------------------------------------------------------------- 428 # Check that the configuration is current. We check that 429 # BUILD_ENV_SEQUENCE_NUMBER is current against this value. 430 # Don't fail if we're called from envsetup, so they have a 431 # chance to update their environment. 432 433 ifeq (,$(strip $(CALLED_FROM_SETUP))) 434 ifneq (,$(strip $(BUILD_ENV_SEQUENCE_NUMBER))) 435 ifneq ($(BUILD_ENV_SEQUENCE_NUMBER),$(CORRECT_BUILD_ENV_SEQUENCE_NUMBER)) 436 $(warning BUILD_ENV_SEQUENCE_NUMBER is set incorrectly.) 437 $(info *** If you use envsetup/lunch/choosecombo:) 438 $(info *** - Re-execute envsetup (". envsetup.sh")) 439 $(info *** - Re-run lunch or choosecombo) 440 $(info *** If you use buildspec.mk:) 441 $(info *** - Look at buildspec.mk.default to see what has changed) 442 $(info *** - Update BUILD_ENV_SEQUENCE_NUMBER to "$(CORRECT_BUILD_ENV_SEQUENCE_NUMBER)") 443 $(error bailing..) 444 endif 445 endif 446 endif 447 448 # Set up PDK so we can use TARGET_BUILD_PDK to select prebuilt tools below 449 .PHONY: pdk fusion 450 pdk fusion: $(DEFAULT_GOAL) 451 452 # What to build: 453 # pdk fusion if: 454 # 1) PDK_FUSION_PLATFORM_ZIP / PDK_FUSION_PLATFORM_DIR is passed in from the environment 455 # or 456 # 2) the platform.zip / pdk.mk exists in the default location 457 # or 458 # 3) fusion is a command line build goal, 459 # PDK_FUSION_PLATFORM_ZIP is needed anyway, then do we need the 'fusion' goal? 460 # otherwise pdk only if: 461 # 1) pdk is a command line build goal 462 # or 463 # 2) TARGET_BUILD_PDK is passed in from the environment 464 465 # if PDK_FUSION_PLATFORM_ZIP or PDK_FUSION_PLATFORM_DIR is specified, do not override. 466 ifeq (,$(strip $(PDK_FUSION_PLATFORM_ZIP)$(PDK_FUSION_PLATFORM_DIR))) 467 # Most PDK project paths should be using vendor/pdk/TARGET_DEVICE 468 # but some legacy ones (e.g. mini_armv7a_neon generic PDK) were setup 469 # with vendor/pdk/TARGET_PRODUCT. 470 # Others are set up with vendor/pdk/TARGET_DEVICE/TARGET_DEVICE-userdebug 471 _pdk_fusion_search_paths := \ 472 vendor/pdk/$(TARGET_DEVICE)/$(TARGET_DEVICE)-$(TARGET_BUILD_VARIANT)/platform \ 473 vendor/pdk/$(TARGET_DEVICE)/$(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)/platform \ 474 vendor/pdk/$(TARGET_DEVICE)/$(patsubst aosp_%,full_%,$(TARGET_PRODUCT))-$(TARGET_BUILD_VARIANT)/platform \ 475 vendor/pdk/$(TARGET_PRODUCT)/$(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)/platform \ 476 vendor/pdk/$(TARGET_PRODUCT)/$(patsubst aosp_%,full_%,$(TARGET_PRODUCT))-$(TARGET_BUILD_VARIANT)/platform 477 478 _pdk_fusion_default_platform_zip := $(strip $(foreach p,$(_pdk_fusion_search_paths),$(wildcard $(p)/platform.zip))) 479 ifneq (,$(_pdk_fusion_default_platform_zip)) 480 PDK_FUSION_PLATFORM_ZIP := $(word 1, $(_pdk_fusion_default_platform_zip)) 481 _pdk_fusion_default_platform_zip := 482 else 483 _pdk_fusion_default_platform_mk := $(strip $(foreach p,$(_pdk_fusion_search_paths),$(wildcard $(p)/pdk.mk))) 484 ifneq (,$(_pdk_fusion_default_platform_mk)) 485 PDK_FUSION_PLATFORM_DIR := $(dir $(word 1,$(_pdk_fusion_default_platform_mk))) 486 _pdk_fusion_default_platform_mk := 487 endif 488 endif # _pdk_fusion_default_platform_zip 489 _pdk_fusion_search_paths := 490 endif # !PDK_FUSION_PLATFORM_ZIP && !PDK_FUSION_PLATFORM_DIR 491 492 ifneq (,$(PDK_FUSION_PLATFORM_ZIP)) 493 ifneq (,$(PDK_FUSION_PLATFORM_DIR)) 494 $(error Only one of PDK_FUSION_PLATFORM_ZIP or PDK_FUSION_PLATFORM_DIR may be specified) 495 endif 496 endif 497 498 ifneq (,$(filter pdk fusion, $(MAKECMDGOALS))) 499 TARGET_BUILD_PDK := true 500 ifneq (,$(filter fusion, $(MAKECMDGOALS))) 501 ifeq (,$(strip $(PDK_FUSION_PLATFORM_ZIP)$(PDK_FUSION_PLATFORM_DIR))) 502 $(error Specify PDK_FUSION_PLATFORM_ZIP or PDK_FUSION_PLATFORM_DIR to do a PDK fusion.) 503 endif 504 endif # fusion 505 endif # pdk or fusion 506 507 ifdef PDK_FUSION_PLATFORM_ZIP 508 TARGET_BUILD_PDK := true 509 ifeq (,$(wildcard $(PDK_FUSION_PLATFORM_ZIP))) 510 ifneq (,$(wildcard $(dir $(PDK_FUSION_PLATFORM_ZIP))/pdk.mk)) 511 PDK_FUSION_PLATFORM_DIR := $(dir $(PDK_FUSION_PLATFORM_ZIP)) 512 PDK_FUSION_PLATFORM_ZIP := 513 else 514 $(error Cannot find file $(PDK_FUSION_PLATFORM_ZIP).) 515 endif 516 endif 517 endif 518 519 ifdef PDK_FUSION_PLATFORM_DIR 520 TARGET_BUILD_PDK := true 521 ifeq (,$(wildcard $(PDK_FUSION_PLATFORM_DIR)/pdk.mk)) 522 $(error Cannot find file $(PDK_FUSION_PLATFORM_DIR)/pdk.mk.) 523 endif 524 endif 525 526 BUILD_PLATFORM_ZIP := $(filter platform platform-java,$(MAKECMDGOALS)) 527 528 # --------------------------------------------------------------- 529 # Whether we can expect a full build graph 530 ALLOW_MISSING_DEPENDENCIES := $(filter true,$(ALLOW_MISSING_DEPENDENCIES)) 531 ifneq ($(TARGET_BUILD_APPS),) 532 ALLOW_MISSING_DEPENDENCIES := true 533 endif 534 ifeq ($(TARGET_BUILD_PDK),true) 535 ALLOW_MISSING_DEPENDENCIES := true 536 endif 537 ifneq ($(filter true,$(SOONG_ALLOW_MISSING_DEPENDENCIES)),) 538 ALLOW_MISSING_DEPENDENCIES := true 539 endif 540 ifneq ($(ONE_SHOT_MAKEFILE),) 541 ALLOW_MISSING_DEPENDENCIES := true 542 endif 543 .KATI_READONLY := ALLOW_MISSING_DEPENDENCIES 544 545 prebuilt_sdk_tools := prebuilts/sdk/tools 546 prebuilt_sdk_tools_bin := $(prebuilt_sdk_tools)/$(HOST_OS)/bin 547 548 # Always use prebuilts for ckati and makeparallel 549 prebuilt_build_tools := prebuilts/build-tools 550 prebuilt_build_tools_wrappers := prebuilts/build-tools/common/bin 551 prebuilt_build_tools_jars := prebuilts/build-tools/common/framework 552 ifeq ($(filter address,$(SANITIZE_HOST)),) 553 prebuilt_build_tools_bin := $(prebuilt_build_tools)/$(HOST_PREBUILT_TAG)/bin 554 else 555 prebuilt_build_tools_bin := $(prebuilt_build_tools)/$(HOST_PREBUILT_TAG)/asan/bin 556 endif 557 558 USE_PREBUILT_SDK_TOOLS_IN_PLACE := true 559 560 # Work around for b/68406220 561 # This should match the soong version. 562 ifndef USE_D8 563 USE_D8 := true 564 endif 565 566 # Default R8 behavior when USE_R8 is not specified. 567 ifndef USE_R8 568 USE_R8 := false 569 endif 570 571 # 572 # Tools that are prebuilts for TARGET_BUILD_APPS 573 # 574 ifeq (,$(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK))) 575 AIDL := $(HOST_OUT_EXECUTABLES)/aidl 576 AAPT := $(HOST_OUT_EXECUTABLES)/aapt 577 AAPT2 := $(HOST_OUT_EXECUTABLES)/aapt2 578 DESUGAR := $(HOST_OUT_JAVA_LIBRARIES)/desugar.jar 579 MAINDEXCLASSES := $(HOST_OUT_EXECUTABLES)/mainDexClasses 580 SIGNAPK_JAR := $(HOST_OUT_JAVA_LIBRARIES)/signapk$(COMMON_JAVA_PACKAGE_SUFFIX) 581 SIGNAPK_JNI_LIBRARY_PATH := $(HOST_OUT_SHARED_LIBRARIES) 582 ZIPALIGN := $(HOST_OUT_EXECUTABLES)/zipalign 583 584 else # TARGET_BUILD_APPS || TARGET_BUILD_PDK 585 AIDL := $(prebuilt_build_tools_bin)/aidl 586 AAPT := $(prebuilt_sdk_tools_bin)/aapt 587 AAPT2 := $(prebuilt_sdk_tools_bin)/aapt2 588 DESUGAR := $(prebuilt_build_tools_jars)/desugar.jar 589 MAINDEXCLASSES := $(prebuilt_sdk_tools)/mainDexClasses 590 SIGNAPK_JAR := $(prebuilt_sdk_tools)/lib/signapk$(COMMON_JAVA_PACKAGE_SUFFIX) 591 SIGNAPK_JNI_LIBRARY_PATH := $(prebuilt_sdk_tools)/$(HOST_OS)/lib64 592 ZIPALIGN := $(prebuilt_build_tools_bin)/zipalign 593 endif # TARGET_BUILD_APPS || TARGET_BUILD_PDK 594 595 ifeq (,$(TARGET_BUILD_APPS)) 596 # Use RenderScript prebuilts for unbundled builds but not PDK builds 597 LLVM_RS_CC := $(HOST_OUT_EXECUTABLES)/llvm-rs-cc 598 BCC_COMPAT := $(HOST_OUT_EXECUTABLES)/bcc_compat 599 else 600 LLVM_RS_CC := $(prebuilt_sdk_tools_bin)/llvm-rs-cc 601 BCC_COMPAT := $(prebuilt_sdk_tools_bin)/bcc_compat 602 endif # TARGET_BUILD_PDK 603 604 prebuilt_sdk_tools := 605 prebuilt_sdk_tools_bin := 606 607 ACP := $(prebuilt_build_tools_bin)/acp 608 CKATI := $(prebuilt_build_tools_bin)/ckati 609 DEPMOD := $(HOST_OUT_EXECUTABLES)/depmod 610 FILESLIST := $(SOONG_HOST_OUT_EXECUTABLES)/fileslist 611 MAKEPARALLEL := $(prebuilt_build_tools_bin)/makeparallel 612 SOONG_JAVAC_WRAPPER := $(SOONG_HOST_OUT_EXECUTABLES)/soong_javac_wrapper 613 SOONG_ZIP := $(SOONG_HOST_OUT_EXECUTABLES)/soong_zip 614 MERGE_ZIPS := $(SOONG_HOST_OUT_EXECUTABLES)/merge_zips 615 XMLLINT := $(SOONG_HOST_OUT_EXECUTABLES)/xmllint 616 ZIP2ZIP := $(SOONG_HOST_OUT_EXECUTABLES)/zip2zip 617 ZIPTIME := $(prebuilt_build_tools_bin)/ziptime 618 619 # --------------------------------------------------------------- 620 # Generic tools. 621 622 LEX := prebuilts/misc/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/flex/flex-2.5.39 623 # The default PKGDATADIR built in the prebuilt bison is a relative path 624 # prebuilts/build-tools/common/bison. 625 # To run bison from elsewhere you need to set up enviromental variable 626 # BISON_PKGDATADIR. 627 BISON_PKGDATADIR := $(PWD)/prebuilts/build-tools/common/bison 628 BISON := prebuilts/build-tools/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/bin/bison 629 YACC := $(BISON) -d 630 BISON_DATA := $(wildcard $(BISON_PKGDATADIR)/* $(BISON_PKGDATADIR)/*/*) 631 632 YASM := prebuilts/misc/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/yasm/yasm 633 634 DOXYGEN:= doxygen 635 ifeq ($(HOST_OS),linux) 636 BREAKPAD_DUMP_SYMS := $(HOST_OUT_EXECUTABLES)/dump_syms 637 else 638 # For non-supported hosts, do not generate breakpad symbols. 639 BREAKPAD_GENERATE_SYMBOLS := false 640 endif 641 PROTOC := $(HOST_OUT_EXECUTABLES)/aprotoc$(HOST_EXECUTABLE_SUFFIX) 642 NANOPB_SRCS := external/nanopb-c/generator/protoc-gen-nanopb \ 643 $(wildcard external/nanopb-c/generator/*.py \ 644 external/nanopb-c/generator/google/*.py \ 645 external/nanopb-c/generator/proto/*.py) 646 VTSC := $(HOST_OUT_EXECUTABLES)/vtsc$(HOST_EXECUTABLE_SUFFIX) 647 MKBOOTFS := $(HOST_OUT_EXECUTABLES)/mkbootfs$(HOST_EXECUTABLE_SUFFIX) 648 MINIGZIP := $(HOST_OUT_EXECUTABLES)/minigzip$(HOST_EXECUTABLE_SUFFIX) 649 BROTLI := $(HOST_OUT_EXECUTABLES)/brotli$(HOST_EXECUTABLE_SUFFIX) 650 ifeq (,$(strip $(BOARD_CUSTOM_MKBOOTIMG))) 651 MKBOOTIMG := $(HOST_OUT_EXECUTABLES)/mkbootimg$(HOST_EXECUTABLE_SUFFIX) 652 else 653 MKBOOTIMG := $(BOARD_CUSTOM_MKBOOTIMG) 654 endif 655 ifeq (,$(strip $(BOARD_CUSTOM_BPTTOOL))) 656 BPTTOOL := $(HOST_OUT_EXECUTABLES)/bpttool$(HOST_EXECUTABLE_SUFFIX) 657 else 658 BPTTOOL := $(BOARD_CUSTOM_BPTTOOL) 659 endif 660 ifeq (,$(strip $(BOARD_CUSTOM_AVBTOOL))) 661 AVBTOOL := $(HOST_OUT_EXECUTABLES)/avbtool$(HOST_EXECUTABLE_SUFFIX) 662 else 663 AVBTOOL := $(BOARD_CUSTOM_AVBTOOL) 664 endif 665 APICHECK := $(HOST_OUT_EXECUTABLES)/apicheck$(HOST_EXECUTABLE_SUFFIX) 666 FS_GET_STATS := $(HOST_OUT_EXECUTABLES)/fs_get_stats$(HOST_EXECUTABLE_SUFFIX) 667 MAKE_EXT4FS := $(HOST_OUT_EXECUTABLES)/mke2fs$(HOST_EXECUTABLE_SUFFIX) 668 MKEXTUSERIMG := $(HOST_OUT_EXECUTABLES)/mkuserimg_mke2fs.sh 669 MKE2FS_CONF := system/extras/ext4_utils/mke2fs.conf 670 BLK_ALLOC_TO_BASE_FS := $(HOST_OUT_EXECUTABLES)/blk_alloc_to_base_fs$(HOST_EXECUTABLE_SUFFIX) 671 MAKE_SQUASHFS := $(HOST_OUT_EXECUTABLES)/mksquashfs$(HOST_EXECUTABLE_SUFFIX) 672 MKSQUASHFSUSERIMG := $(HOST_OUT_EXECUTABLES)/mksquashfsimage.sh 673 MAKE_F2FS := $(HOST_OUT_EXECUTABLES)/make_f2fs$(HOST_EXECUTABLE_SUFFIX) 674 MKF2FSUSERIMG := $(HOST_OUT_EXECUTABLES)/mkf2fsuserimg.sh 675 SIMG2IMG := $(HOST_OUT_EXECUTABLES)/simg2img$(HOST_EXECUTABLE_SUFFIX) 676 IMG2SIMG := $(HOST_OUT_EXECUTABLES)/img2simg$(HOST_EXECUTABLE_SUFFIX) 677 E2FSCK := $(HOST_OUT_EXECUTABLES)/e2fsck$(HOST_EXECUTABLE_SUFFIX) 678 MKTARBALL := build/make/tools/mktarball.sh 679 TUNE2FS := $(HOST_OUT_EXECUTABLES)/tune2fs$(HOST_EXECUTABLE_SUFFIX) 680 JARJAR := $(HOST_OUT_JAVA_LIBRARIES)/jarjar.jar 681 DATA_BINDING_COMPILER := $(HOST_OUT_JAVA_LIBRARIES)/databinding-compiler.jar 682 FAT16COPY := build/make/tools/fat16copy.py 683 CHECK_LINK_TYPE := build/make/tools/check_link_type.py 684 685 PROGUARD := external/proguard/bin/proguard.sh 686 JAVATAGS := build/make/tools/java-event-log-tags.py 687 MERGETAGS := build/make/tools/merge-event-log-tags.py 688 BUILD_IMAGE_SRCS := $(wildcard build/make/tools/releasetools/*.py) 689 APPEND2SIMG := $(HOST_OUT_EXECUTABLES)/append2simg 690 VERITY_SIGNER := $(HOST_OUT_EXECUTABLES)/verity_signer 691 BUILD_VERITY_TREE := $(HOST_OUT_EXECUTABLES)/build_verity_tree 692 BOOT_SIGNER := $(HOST_OUT_EXECUTABLES)/boot_signer 693 FUTILITY := $(HOST_OUT_EXECUTABLES)/futility-host 694 VBOOT_SIGNER := prebuilts/misc/scripts/vboot_signer/vboot_signer.sh 695 FEC := $(HOST_OUT_EXECUTABLES)/fec 696 BRILLO_UPDATE_PAYLOAD := $(HOST_OUT_EXECUTABLES)/brillo_update_payload 697 698 DEXDUMP := $(HOST_OUT_EXECUTABLES)/dexdump2$(BUILD_EXECUTABLE_SUFFIX) 699 PROFMAN := $(HOST_OUT_EXECUTABLES)/profman 700 HIDDENAPI := $(HOST_OUT_EXECUTABLES)/hiddenapi 701 702 # relocation packer 703 RELOCATION_PACKER := prebuilts/misc/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/relocation_packer/relocation_packer 704 705 FINDBUGS_DIR := external/owasp/sanitizer/tools/findbugs/bin 706 FINDBUGS := $(FINDBUGS_DIR)/findbugs 707 708 JETIFIER := prebuilts/sdk/tools/jetifier/jetifier-standalone/bin/jetifier-standalone 709 710 # Tool to merge AndroidManifest.xmls 711 ANDROID_MANIFEST_MERGER_CLASSPATH := \ 712 prebuilts/gradle-plugin/com/android/tools/build/manifest-merger/26.0.0-beta2/manifest-merger-26.0.0-beta2.jar \ 713 prebuilts/gradle-plugin/com/android/tools/sdk-common/26.0.0-beta2/sdk-common-26.0.0-beta2.jar \ 714 prebuilts/gradle-plugin/com/android/tools/common/26.0.0-beta2/common-26.0.0-beta2.jar \ 715 prebuilts/misc/common/guava/guava-21.0.jar 716 ANDROID_MANIFEST_MERGER := $(JAVA) \ 717 -classpath $(subst $(space),:,$(strip $(ANDROID_MANIFEST_MERGER_CLASSPATH))) \ 718 com.android.manifmerger.Merger 719 720 COLUMN:= column 721 722 ifeq ($(EXPERIMENTAL_USE_OPENJDK9),) 723 ifeq ($(RUN_ERROR_PRONE),true) 724 USE_OPENJDK9 := 725 else 726 USE_OPENJDK9 := true 727 endif 728 TARGET_OPENJDK9 := 729 else ifeq ($(EXPERIMENTAL_USE_OPENJDK9),false) 730 USE_OPENJDK9 := 731 TARGET_OPENJDK9 := 732 else ifeq ($(EXPERIMENTAL_USE_OPENJDK9),1.8) 733 USE_OPENJDK9 := true 734 TARGET_OPENJDK9 := 735 else ifeq ($(EXPERIMENTAL_USE_OPENJDK9),true) 736 USE_OPENJDK9 := true 737 TARGET_OPENJDK9 := true 738 endif 739 740 # Path to tools.jar 741 HOST_JDK_TOOLS_JAR := $(ANDROID_JAVA8_HOME)/lib/tools.jar 742 743 # It's called md5 on Mac OS and md5sum on Linux 744 ifeq ($(HOST_OS),darwin) 745 MD5SUM:=md5 -q 746 else 747 MD5SUM:=md5sum 748 endif 749 750 APICHECK_CLASSPATH_ENTRIES := \ 751 $(HOST_OUT_JAVA_LIBRARIES)/doclava$(COMMON_JAVA_PACKAGE_SUFFIX) \ 752 $(HOST_OUT_JAVA_LIBRARIES)/jsilver$(COMMON_JAVA_PACKAGE_SUFFIX) \ 753 $(HOST_JDK_TOOLS_JAR) \ 754 ) 755 APICHECK_CLASSPATH := $(subst $(space),:,$(strip $(APICHECK_CLASSPATH_ENTRIES))) 756 757 APICHECK_COMMAND := $(APICHECK) -JXmx1024m -J"classpath $(APICHECK_CLASSPATH)" 758 759 # Boolean variable determining if the whitelist for compatible properties is enabled 760 PRODUCT_COMPATIBLE_PROPERTY := false 761 ifneq ($(PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE),) 762 PRODUCT_COMPATIBLE_PROPERTY := $(PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE) 763 else ifeq ($(PRODUCT_SHIPPING_API_LEVEL),) 764 #$(warning no product shipping level defined) 765 else ifneq ($(call math_lt,27,$(PRODUCT_SHIPPING_API_LEVEL)),) 766 PRODUCT_COMPATIBLE_PROPERTY := true 767 endif 768 769 .KATI_READONLY := \ 770 PRODUCT_COMPATIBLE_PROPERTY 771 772 # Boolean variable determining if Treble is fully enabled 773 PRODUCT_FULL_TREBLE := false 774 ifneq ($(PRODUCT_FULL_TREBLE_OVERRIDE),) 775 PRODUCT_FULL_TREBLE := $(PRODUCT_FULL_TREBLE_OVERRIDE) 776 else ifeq ($(PRODUCT_SHIPPING_API_LEVEL),) 777 #$(warning no product shipping level defined) 778 else ifneq ($(call math_gt_or_eq,$(PRODUCT_SHIPPING_API_LEVEL),26),) 779 PRODUCT_FULL_TREBLE := true 780 endif 781 782 # TODO(b/69865032): Make PRODUCT_NOTICE_SPLIT the default behavior and remove 783 # references to it here and below. 784 ifdef PRODUCT_NOTICE_SPLIT_OVERRIDE 785 $(error PRODUCT_NOTICE_SPLIT_OVERRIDE cannot be set.) 786 endif 787 788 requirements := \ 789 PRODUCT_TREBLE_LINKER_NAMESPACES \ 790 PRODUCT_SEPOLICY_SPLIT \ 791 PRODUCT_ENFORCE_VINTF_MANIFEST \ 792 PRODUCT_NOTICE_SPLIT 793 794 # If it is overriden, then the requirement override is taken, otherwise it's 795 # PRODUCT_FULL_TREBLE 796 $(foreach req,$(requirements),$(eval \ 797 $(req) := $(if $($(req)_OVERRIDE),$($(req)_OVERRIDE),$(PRODUCT_FULL_TREBLE)))) 798 # If the requirement is false for any reason, then it's not PRODUCT_FULL_TREBLE 799 $(foreach req,$(requirements),$(eval \ 800 PRODUCT_FULL_TREBLE := $(if $(filter false,$($(req))),false,$(PRODUCT_FULL_TREBLE)))) 801 802 PRODUCT_FULL_TREBLE_OVERRIDE ?= 803 $(foreach req,$(requirements),$(eval $(req)_OVERRIDE ?=)) 804 805 .KATI_READONLY := \ 806 PRODUCT_FULL_TREBLE_OVERRIDE \ 807 $(foreach req,$(requirements),$(req)_OVERRIDE) \ 808 $(requirements) \ 809 PRODUCT_FULL_TREBLE \ 810 811 requirements := 812 813 # BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED can be true only if early-mount of 814 # partitions is supported. But the early-mount must be supported for full 815 # treble products, and so BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED should be set 816 # by default for full treble products. 817 ifeq ($(PRODUCT_FULL_TREBLE),true) 818 BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED ?= true 819 endif 820 821 # If PRODUCT_USE_VNDK is true and BOARD_VNDK_VERSION is not defined yet, 822 # BOARD_VNDK_VERSION will be set to "current" as default. 823 # PRODUCT_USE_VNDK will be true in Android-P or later launching devices. 824 PRODUCT_USE_VNDK := false 825 ifneq ($(PRODUCT_USE_VNDK_OVERRIDE),) 826 PRODUCT_USE_VNDK := $(PRODUCT_USE_VNDK_OVERRIDE) 827 else ifeq ($(PRODUCT_SHIPPING_API_LEVEL),) 828 # No shipping level defined 829 else ifeq ($(call math_gt_or_eq,27,$(PRODUCT_SHIPPING_API_LEVEL)),) 830 PRODUCT_USE_VNDK := $(PRODUCT_FULL_TREBLE) 831 endif 832 833 ifeq ($(PRODUCT_USE_VNDK),true) 834 ifndef BOARD_VNDK_VERSION 835 BOARD_VNDK_VERSION := current 836 endif 837 endif 838 839 $(KATI_obsolete_var PRODUCT_USE_VNDK_OVERRIDE,Use PRODUCT_USE_VNDK instead) 840 .KATI_READONLY := \ 841 PRODUCT_USE_VNDK 842 843 # Set BOARD_SYSTEMSDK_VERSIONS to the latest SystemSDK version starting from P-launching 844 # devices if unset. 845 ifndef BOARD_SYSTEMSDK_VERSIONS 846 ifdef PRODUCT_SHIPPING_API_LEVEL 847 ifneq ($(call math_gt_or_eq,$(PRODUCT_SHIPPING_API_LEVEL),28),) 848 ifeq (REL,$(PLATFORM_VERSION_CODENAME)) 849 BOARD_SYSTEMSDK_VERSIONS := $(PLATFORM_SDK_VERSION) 850 else 851 BOARD_SYSTEMSDK_VERSIONS := $(PLATFORM_VERSION_CODENAME) 852 endif 853 endif 854 endif 855 endif 856 857 858 ifdef PRODUCT_SHIPPING_API_LEVEL 859 ifneq ($(call math_gt_or_eq,$(PRODUCT_SHIPPING_API_LEVEL),27),) 860 ifneq ($(TARGET_USES_MKE2FS),true) 861 $(error When PRODUCT_SHIPPING_API_LEVEL >= 27, TARGET_USES_MKE2FS must be true) 862 endif 863 endif 864 ifneq ($(call numbers_less_than,$(PRODUCT_SHIPPING_API_LEVEL),$(BOARD_SYSTEMSDK_VERSIONS)),) 865 $(error BOARD_SYSTEMSDK_VERSIONS ($(BOARD_SYSTEMSDK_VERSIONS)) must all be greater than or equal to PRODUCT_SHIPPING_API_LEVEL ($(PRODUCT_SHIPPING_API_LEVEL))) 866 endif 867 ifneq ($(call math_gt_or_eq,$(PRODUCT_SHIPPING_API_LEVEL),28),) 868 ifneq ($(TARGET_IS_64_BIT), true) 869 ifneq ($(TARGET_USES_64_BIT_BINDER), true) 870 $(error When PRODUCT_SHIPPING_API_LEVEL >= 28, TARGET_USES_64_BIT_BINDER must be true) 871 endif 872 endif 873 ifeq ($(PRODUCT_FULL_TREBLE),true) 874 ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE), true) 875 $(error When PRODUCT_SHIPPING_API_LEVEL >= 28, BOARD_BUILD_SYSTEM_ROOT_IMAGE must be true) 876 endif 877 endif 878 endif 879 endif 880 881 # The default key if not set as LOCAL_CERTIFICATE 882 ifdef PRODUCT_DEFAULT_DEV_CERTIFICATE 883 DEFAULT_SYSTEM_DEV_CERTIFICATE := $(PRODUCT_DEFAULT_DEV_CERTIFICATE) 884 else 885 DEFAULT_SYSTEM_DEV_CERTIFICATE := build/target/product/security/testkey 886 endif 887 888 BUILD_NUMBER_FROM_FILE := $$(cat $(OUT_DIR)/build_number.txt) 889 BUILD_DATETIME_FROM_FILE := $$(cat $(BUILD_DATETIME_FILE)) 890 891 # SEPolicy versions 892 893 # PLATFORM_SEPOLICY_VERSION is a number of the form "NN.m" with "NN" mapping to 894 # PLATFORM_SDK_VERSION and "m" as a minor number which allows for SELinux 895 # changes independent of PLATFORM_SDK_VERSION. This value will be set to 896 # 10000.0 to represent tip-of-tree development that is inherently unstable and 897 # thus designed not to work with any shipping vendor policy. This is similar in 898 # spirit to how DEFAULT_APP_TARGET_SDK is set. 899 # The minor version ('m' component) must be updated every time a platform release 900 # is made which breaks compatibility with the previous platform sepolicy version, 901 # not just on every increase in PLATFORM_SDK_VERSION. The minor version should 902 # be reset to 0 on every bump of the PLATFORM_SDK_VERSION. 903 sepolicy_major_vers := 28 904 sepolicy_minor_vers := 0 905 906 ifneq ($(sepolicy_major_vers), $(PLATFORM_SDK_VERSION)) 907 $(error sepolicy_major_version does not match PLATFORM_SDK_VERSION, please update.) 908 endif 909 910 TOT_SEPOLICY_VERSION := 10000.0 911 ifneq (REL,$(PLATFORM_VERSION_CODENAME)) 912 PLATFORM_SEPOLICY_VERSION := $(TOT_SEPOLICY_VERSION) 913 else 914 PLATFORM_SEPOLICY_VERSION := $(join $(addsuffix .,$(sepolicy_major_vers)), $(sepolicy_minor_vers)) 915 endif 916 sepolicy_major_vers := 917 sepolicy_minor_vers := 918 919 # A list of SEPolicy versions, besides PLATFORM_SEPOLICY_VERSION, that the framework supports. 920 PLATFORM_SEPOLICY_COMPAT_VERSIONS := \ 921 26.0 \ 922 27.0 923 924 .KATI_READONLY := \ 925 PLATFORM_SEPOLICY_COMPAT_VERSIONS \ 926 PLATFORM_SEPOLICY_VERSION \ 927 TOT_SEPOLICY_VERSION \ 928 929 # ############################################################### 930 # Set up final options. 931 # ############################################################### 932 933 # We run gcc/clang with PWD=/proc/self/cwd to remove the $TOP 934 # from the debug output. That way two builds in two different 935 # directories will create the same output. 936 # /proc doesn't exist on Darwin. 937 ifeq ($(HOST_OS),linux) 938 RELATIVE_PWD := PWD=/proc/self/cwd 939 else 940 RELATIVE_PWD := 941 endif 942 943 TARGET_PROJECT_INCLUDES := 944 TARGET_PROJECT_SYSTEM_INCLUDES := \ 945 $(TARGET_DEVICE_KERNEL_HEADERS) $(TARGET_BOARD_KERNEL_HEADERS) \ 946 $(TARGET_PRODUCT_KERNEL_HEADERS) 947 948 ifdef TARGET_2ND_ARCH 949 $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_PROJECT_INCLUDES := $(TARGET_PROJECT_INCLUDES) 950 $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_PROJECT_SYSTEM_INCLUDES := $(TARGET_PROJECT_SYSTEM_INCLUDES) 951 endif 952 953 # Flags for DEX2OAT 954 first_non_empty_of_three = $(if $(1),$(1),$(if $(2),$(2),$(3))) 955 DEX2OAT_TARGET_ARCH := $(TARGET_ARCH) 956 DEX2OAT_TARGET_CPU_VARIANT := $(call first_non_empty_of_three,$(TARGET_CPU_VARIANT),$(TARGET_ARCH_VARIANT),default) 957 DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := default 958 959 ifdef TARGET_2ND_ARCH 960 $(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH := $(TARGET_2ND_ARCH) 961 $(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT := $(call first_non_empty_of_three,$(TARGET_2ND_CPU_VARIANT),$(TARGET_2ND_ARCH_VARIANT),default) 962 $(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := default 963 endif 964 965 # ############################################################### 966 # Collect a list of the SDK versions that we could compile against 967 # For use with the LOCAL_SDK_VERSION variable for include $(BUILD_PACKAGE) 968 # ############################################################### 969 970 HISTORICAL_SDK_VERSIONS_ROOT := $(TOPDIR)prebuilts/sdk 971 HISTORICAL_NDK_VERSIONS_ROOT := $(TOPDIR)prebuilts/ndk 972 973 # The path where app can reference the support library resources. 974 ifdef TARGET_BUILD_APPS 975 SUPPORT_LIBRARY_ROOT := $(HISTORICAL_SDK_VERSIONS_ROOT)/current/support 976 else 977 SUPPORT_LIBRARY_ROOT := frameworks/support 978 endif 979 980 # Historical SDK version N is stored in $(HISTORICAL_SDK_VERSIONS_ROOT)/N. 981 # The 'current' version is whatever this source tree is. 982 # 983 # sgrax is the opposite of xargs. It takes the list of args and puts them 984 # on each line for sort to process. 985 # sort -g is a numeric sort, so 1 2 3 10 instead of 1 10 2 3. 986 987 # Numerically sort a list of numbers 988 # $(1): the list of numbers to be sorted 989 define numerically_sort 990 $(shell function sgrax() { \ 991 while [ -n "$$1" ] ; do echo $$1 ; shift ; done \ 992 } ; \ 993 ( sgrax $(1) | sort -g ) ) 994 endef 995 996 TARGET_AVAILABLE_SDK_VERSIONS := $(call numerically_sort,\ 997 $(patsubst $(HISTORICAL_SDK_VERSIONS_ROOT)/%/android.jar,%, \ 998 $(wildcard $(HISTORICAL_SDK_VERSIONS_ROOT)/*/android.jar))) 999 1000 TARGET_AVAILABLE_SDK_VERSIONS := $(addprefix system_,$(call numerically_sort,\ 1001 $(patsubst $(HISTORICAL_SDK_VERSIONS_ROOT)/%/android_system.jar,%, \ 1002 $(wildcard $(HISTORICAL_SDK_VERSIONS_ROOT)/*/android_system.jar)))) \ 1003 $(TARGET_AVAILABLE_SDK_VERSIONS) 1004 1005 # We don't have prebuilt test_current and core_current SDK yet. 1006 TARGET_AVAILABLE_SDK_VERSIONS := test_current core_current $(TARGET_AVAILABLE_SDK_VERSIONS) 1007 1008 TARGET_SDK_VERSIONS_WITHOUT_JAVA_18_SUPPORT := $(call numbers_less_than,24,$(TARGET_AVAILABLE_SDK_VERSIONS)) 1009 TARGET_SDK_VERSIONS_WITHOUT_JAVA_19_SUPPORT := $(call numbers_less_than,27,$(TARGET_AVAILABLE_SDK_VERSIONS)) 1010 1011 INTERNAL_PLATFORM_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/public_api.txt 1012 INTERNAL_PLATFORM_DEX_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/public-dex.txt 1013 INTERNAL_PLATFORM_PRIVATE_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/private.txt 1014 INTERNAL_PLATFORM_PRIVATE_DEX_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/private-dex.txt 1015 INTERNAL_PLATFORM_REMOVED_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/removed.txt 1016 INTERNAL_PLATFORM_REMOVED_DEX_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/removed-dex.txt 1017 INTERNAL_PLATFORM_SYSTEM_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/system-api.txt 1018 INTERNAL_PLATFORM_SYSTEM_PRIVATE_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/system-private.txt 1019 INTERNAL_PLATFORM_SYSTEM_PRIVATE_DEX_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/system-private-dex.txt 1020 INTERNAL_PLATFORM_SYSTEM_REMOVED_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/system-removed.txt 1021 INTERNAL_PLATFORM_SYSTEM_EXACT_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/system-exact.txt 1022 INTERNAL_PLATFORM_TEST_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/test-api.txt 1023 INTERNAL_PLATFORM_TEST_REMOVED_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/test-removed.txt 1024 INTERNAL_PLATFORM_TEST_EXACT_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/test-exact.txt 1025 1026 INTERNAL_PLATFORM_HIDDENAPI_LIGHT_GREYLIST := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/hiddenapi-light-greylist.txt 1027 INTERNAL_PLATFORM_HIDDENAPI_DARK_GREYLIST := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/hiddenapi-dark-greylist.txt 1028 INTERNAL_PLATFORM_HIDDENAPI_BLACKLIST := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/hiddenapi-blacklist.txt 1029 1030 # Missing optional uses-libraries so that the platform doesn't create build rules that depend on 1031 # them. See setup_one_odex.mk. 1032 INTERNAL_PLATFORM_MISSING_USES_LIBRARIES := com.google.android.ble com.google.android.wearable 1033 1034 # This is the standard way to name a directory containing prebuilt target 1035 # objects. E.g., prebuilt/$(TARGET_PREBUILT_TAG)/libc.so 1036 TARGET_PREBUILT_TAG := android-$(TARGET_ARCH) 1037 ifdef TARGET_2ND_ARCH 1038 TARGET_2ND_PREBUILT_TAG := android-$(TARGET_2ND_ARCH) 1039 endif 1040 1041 # Set up RS prebuilt variables for compatibility library 1042 1043 RS_PREBUILT_CLCORE := prebuilts/sdk/renderscript/lib/$(TARGET_ARCH)/librsrt_$(TARGET_ARCH).bc 1044 RS_PREBUILT_COMPILER_RT := prebuilts/sdk/renderscript/lib/$(TARGET_ARCH)/libcompiler_rt.a 1045 1046 # API Level lists for Renderscript Compat lib. 1047 RSCOMPAT_32BIT_ONLY_API_LEVELS := 8 9 10 11 12 13 14 15 16 17 18 19 20 1048 RSCOMPAT_NO_USAGEIO_API_LEVELS := 8 9 10 11 12 13 1049 1050 # Add BUILD_NUMBER to apps default version name if it's unbundled build. 1051 ifdef TARGET_BUILD_APPS 1052 TARGET_BUILD_WITH_APPS_VERSION_NAME := true 1053 endif 1054 1055 ifdef TARGET_BUILD_WITH_APPS_VERSION_NAME 1056 APPS_DEFAULT_VERSION_NAME := $(PLATFORM_VERSION)-$(BUILD_NUMBER_FROM_FILE) 1057 else 1058 APPS_DEFAULT_VERSION_NAME := $(PLATFORM_VERSION) 1059 endif 1060 1061 # ANDROID_WARNING_ALLOWED_PROJECTS is generated by build/soong. 1062 define find_warning_allowed_projects 1063 $(filter $(ANDROID_WARNING_ALLOWED_PROJECTS),$(1)/) 1064 endef 1065 1066 # These goals don't need to collect and include Android.mks/CleanSpec.mks 1067 # in the source tree. 1068 dont_bother_goals := out \ 1069 snod systemimage-nodeps \ 1070 stnod systemtarball-nodeps \ 1071 userdataimage-nodeps userdatatarball-nodeps \ 1072 cacheimage-nodeps \ 1073 bptimage-nodeps \ 1074 vnod vendorimage-nodeps \ 1075 pnod productimage-nodeps \ 1076 systemotherimage-nodeps \ 1077 ramdisk-nodeps \ 1078 bootimage-nodeps \ 1079 recoveryimage-nodeps \ 1080 vbmetaimage-nodeps \ 1081 product-graph dump-products 1082 1083 ifeq ($(CALLED_FROM_SETUP),true) 1084 include $(BUILD_SYSTEM)/ninja_config.mk 1085 include $(BUILD_SYSTEM)/soong_config.mk 1086 endif 1087 1088 include $(BUILD_SYSTEM)/dumpvar.mk 1089