1# 2# Copyright (C) 2011 The Android Open Source Project 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# 16 17LOCAL_PATH := $(call my-dir) 18 19art_path := $(LOCAL_PATH) 20 21######################################################################## 22# clean-oat rules 23# 24 25include $(art_path)/build/Android.common_path.mk 26include $(art_path)/build/Android.oat.mk 27 28.PHONY: clean-oat 29clean-oat: clean-oat-host clean-oat-target 30 31.PHONY: clean-oat-host 32clean-oat-host: 33 find $(OUT_DIR) '(' -name '*.oat' -o -name '*.odex' -o -name '*.art' -o -name '*.vdex' ')' -a -type f | xargs rm -f 34 rm -rf $(TMPDIR)/*/test-*/dalvik-cache/* 35 rm -rf $(TMPDIR)/android-data/dalvik-cache/* 36 37.PHONY: clean-oat-target 38clean-oat-target: 39 $(ADB) root 40 $(ADB) wait-for-device remount 41 $(ADB) shell rm -rf $(ART_TARGET_NATIVETEST_DIR) 42 $(ADB) shell rm -rf $(ART_TARGET_TEST_DIR) 43 $(ADB) shell rm -rf $(ART_TARGET_DALVIK_CACHE_DIR)/*/* 44 $(ADB) shell rm -rf $(ART_DEXPREOPT_BOOT_JAR_DIR)/$(DEX2OAT_TARGET_ARCH) 45 $(ADB) shell rm -rf system/app/$(DEX2OAT_TARGET_ARCH) 46ifdef TARGET_2ND_ARCH 47 $(ADB) shell rm -rf $(ART_DEXPREOPT_BOOT_JAR_DIR)/$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH) 48 $(ADB) shell rm -rf system/app/$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH) 49endif 50 $(ADB) shell rm -rf data/run-test/test-*/dalvik-cache/* 51 52######################################################################## 53# cpplint rules to style check art source files 54 55include $(art_path)/build/Android.cpplint.mk 56 57######################################################################## 58# product rules 59 60include $(art_path)/oatdump/Android.mk 61include $(art_path)/tools/ahat/Android.mk 62include $(art_path)/tools/dexfuzz/Android.mk 63include $(art_path)/tools/veridex/Android.mk 64 65ART_HOST_DEPENDENCIES := \ 66 $(ART_HOST_EXECUTABLES) \ 67 $(ART_HOST_DEX_DEPENDENCIES) \ 68 $(ART_HOST_SHARED_LIBRARY_DEPENDENCIES) 69 70ifeq ($(ART_BUILD_HOST_DEBUG),true) 71ART_HOST_DEPENDENCIES += $(ART_HOST_SHARED_LIBRARY_DEBUG_DEPENDENCIES) 72endif 73 74ART_TARGET_DEPENDENCIES := \ 75 $(ART_TARGET_DEX_DEPENDENCIES) 76 77######################################################################## 78# test rules 79 80# All the dependencies that must be built ahead of sync-ing them onto the target device. 81TEST_ART_TARGET_SYNC_DEPS := $(ADB_EXECUTABLE) 82 83include $(art_path)/build/Android.common_test.mk 84include $(art_path)/build/Android.gtest.mk 85include $(art_path)/test/Android.run-test.mk 86 87TEST_ART_TARGET_SYNC_DEPS += $(ART_TEST_TARGET_GTEST_DEPENDENCIES) $(ART_TEST_TARGET_RUN_TEST_DEPENDENCIES) 88 89# Make sure /system is writable on the device. 90TEST_ART_ADB_ROOT_AND_REMOUNT := \ 91 ($(ADB) root && \ 92 $(ADB) wait-for-device remount && \ 93 (($(ADB) shell touch /system/testfile && \ 94 ($(ADB) shell rm /system/testfile || true)) || \ 95 ($(ADB) disable-verity && \ 96 $(ADB) reboot && \ 97 $(ADB) wait-for-device root && \ 98 $(ADB) wait-for-device remount))) 99 100# "mm test-art" to build and run all tests on host and device 101.PHONY: test-art 102test-art: test-art-host test-art-target 103 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 104 105.PHONY: test-art-gtest 106test-art-gtest: test-art-host-gtest test-art-target-gtest 107 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 108 109.PHONY: test-art-run-test 110test-art-run-test: test-art-host-run-test test-art-target-run-test 111 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 112 113######################################################################## 114# host test rules 115 116VIXL_TEST_DEPENDENCY := 117# We can only run the vixl tests on 64-bit hosts (vixl testing issue) when its a 118# top-level build (to declare the vixl test rule). 119ifneq ($(HOST_PREFER_32_BIT),true) 120ifeq ($(ONE_SHOT_MAKEFILE),) 121VIXL_TEST_DEPENDENCY := run-vixl-tests 122endif 123endif 124 125.PHONY: test-art-host-vixl 126test-art-host-vixl: $(VIXL_TEST_DEPENDENCY) 127 128# "mm test-art-host" to build and run all host tests. 129.PHONY: test-art-host 130test-art-host: test-art-host-gtest test-art-host-run-test \ 131 test-art-host-vixl test-art-host-dexdump 132 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 133 134# All host tests that run solely with the default compiler. 135.PHONY: test-art-host-default 136test-art-host-default: test-art-host-run-test-default 137 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 138 139# All host tests that run solely with the optimizing compiler. 140.PHONY: test-art-host-optimizing 141test-art-host-optimizing: test-art-host-run-test-optimizing 142 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 143 144# All host tests that run solely on the interpreter. 145.PHONY: test-art-host-interpreter 146test-art-host-interpreter: test-art-host-run-test-interpreter 147 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 148 149# All host tests that run solely on the jit. 150.PHONY: test-art-host-jit 151test-art-host-jit: test-art-host-run-test-jit 152 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 153 154# Primary host architecture variants: 155.PHONY: test-art-host$(ART_PHONY_TEST_HOST_SUFFIX) 156test-art-host$(ART_PHONY_TEST_HOST_SUFFIX): test-art-host-gtest$(ART_PHONY_TEST_HOST_SUFFIX) \ 157 test-art-host-run-test$(ART_PHONY_TEST_HOST_SUFFIX) 158 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 159 160.PHONY: test-art-host-default$(ART_PHONY_TEST_HOST_SUFFIX) 161test-art-host-default$(ART_PHONY_TEST_HOST_SUFFIX): test-art-host-run-test-default$(ART_PHONY_TEST_HOST_SUFFIX) 162 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 163 164.PHONY: test-art-host-optimizing$(ART_PHONY_TEST_HOST_SUFFIX) 165test-art-host-optimizing$(ART_PHONY_TEST_HOST_SUFFIX): test-art-host-run-test-optimizing$(ART_PHONY_TEST_HOST_SUFFIX) 166 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 167 168.PHONY: test-art-host-interpreter$(ART_PHONY_TEST_HOST_SUFFIX) 169test-art-host-interpreter$(ART_PHONY_TEST_HOST_SUFFIX): test-art-host-run-test-interpreter$(ART_PHONY_TEST_HOST_SUFFIX) 170 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 171 172.PHONY: test-art-host-jit$(ART_PHONY_TEST_HOST_SUFFIX) 173test-art-host-jit$(ART_PHONY_TEST_HOST_SUFFIX): test-art-host-run-test-jit$(ART_PHONY_TEST_HOST_SUFFIX) 174 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 175 176# Secondary host architecture variants: 177ifneq ($(HOST_PREFER_32_BIT),true) 178.PHONY: test-art-host$(2ND_ART_PHONY_TEST_HOST_SUFFIX) 179test-art-host$(2ND_ART_PHONY_TEST_HOST_SUFFIX): test-art-host-gtest$(2ND_ART_PHONY_TEST_HOST_SUFFIX) \ 180 test-art-host-run-test$(2ND_ART_PHONY_TEST_HOST_SUFFIX) 181 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 182 183.PHONY: test-art-host-default$(2ND_ART_PHONY_TEST_HOST_SUFFIX) 184test-art-host-default$(2ND_ART_PHONY_TEST_HOST_SUFFIX): test-art-host-run-test-default$(2ND_ART_PHONY_TEST_HOST_SUFFIX) 185 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 186 187.PHONY: test-art-host-optimizing$(2ND_ART_PHONY_TEST_HOST_SUFFIX) 188test-art-host-optimizing$(2ND_ART_PHONY_TEST_HOST_SUFFIX): test-art-host-run-test-optimizing$(2ND_ART_PHONY_TEST_HOST_SUFFIX) 189 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 190 191.PHONY: test-art-host-interpreter$(2ND_ART_PHONY_TEST_HOST_SUFFIX) 192test-art-host-interpreter$(2ND_ART_PHONY_TEST_HOST_SUFFIX): test-art-host-run-test-interpreter$(2ND_ART_PHONY_TEST_HOST_SUFFIX) 193 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 194 195.PHONY: test-art-host-jit$(2ND_ART_PHONY_TEST_HOST_SUFFIX) 196test-art-host-jit$(2ND_ART_PHONY_TEST_HOST_SUFFIX): test-art-host-run-test-jit$(2ND_ART_PHONY_TEST_HOST_SUFFIX) 197 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 198endif 199 200# Dexdump/list regression test. 201.PHONY: test-art-host-dexdump 202test-art-host-dexdump: $(addprefix $(HOST_OUT_EXECUTABLES)/, dexdump dexlist) 203 ANDROID_HOST_OUT=$(realpath $(HOST_OUT)) art/test/dexdump/run-all-tests 204 205######################################################################## 206# target test rules 207 208# "mm test-art-target" to build and run all target tests. 209.PHONY: test-art-target 210test-art-target: test-art-target-gtest test-art-target-run-test 211 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 212 213# All target tests that run solely with the default compiler. 214.PHONY: test-art-target-default 215test-art-target-default: test-art-target-run-test-default 216 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 217 218# All target tests that run solely with the optimizing compiler. 219.PHONY: test-art-target-optimizing 220test-art-target-optimizing: test-art-target-run-test-optimizing 221 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 222 223# All target tests that run solely on the interpreter. 224.PHONY: test-art-target-interpreter 225test-art-target-interpreter: test-art-target-run-test-interpreter 226 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 227 228# All target tests that run solely on the jit. 229.PHONY: test-art-target-jit 230test-art-target-jit: test-art-target-run-test-jit 231 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 232 233# Primary target architecture variants: 234.PHONY: test-art-target$(ART_PHONY_TEST_TARGET_SUFFIX) 235test-art-target$(ART_PHONY_TEST_TARGET_SUFFIX): test-art-target-gtest$(ART_PHONY_TEST_TARGET_SUFFIX) \ 236 test-art-target-run-test$(ART_PHONY_TEST_TARGET_SUFFIX) 237 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 238 239.PHONY: test-art-target-default$(ART_PHONY_TEST_TARGET_SUFFIX) 240test-art-target-default$(ART_PHONY_TEST_TARGET_SUFFIX): test-art-target-run-test-default$(ART_PHONY_TEST_TARGET_SUFFIX) 241 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 242 243.PHONY: test-art-target-optimizing$(ART_PHONY_TEST_TARGET_SUFFIX) 244test-art-target-optimizing$(ART_PHONY_TEST_TARGET_SUFFIX): test-art-target-run-test-optimizing$(ART_PHONY_TEST_TARGET_SUFFIX) 245 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 246 247.PHONY: test-art-target-interpreter$(ART_PHONY_TEST_TARGET_SUFFIX) 248test-art-target-interpreter$(ART_PHONY_TEST_TARGET_SUFFIX): test-art-target-run-test-interpreter$(ART_PHONY_TEST_TARGET_SUFFIX) 249 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 250 251.PHONY: test-art-target-jit$(ART_PHONY_TEST_TARGET_SUFFIX) 252test-art-target-jit$(ART_PHONY_TEST_TARGET_SUFFIX): test-art-target-run-test-jit$(ART_PHONY_TEST_TARGET_SUFFIX) 253 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 254 255# Secondary target architecture variants: 256ifdef 2ND_ART_PHONY_TEST_TARGET_SUFFIX 257.PHONY: test-art-target$(2ND_ART_PHONY_TEST_TARGET_SUFFIX) 258test-art-target$(2ND_ART_PHONY_TEST_TARGET_SUFFIX): test-art-target-gtest$(2ND_ART_PHONY_TEST_TARGET_SUFFIX) \ 259 test-art-target-run-test$(2ND_ART_PHONY_TEST_TARGET_SUFFIX) 260 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 261 262.PHONY: test-art-target-default$(2ND_ART_PHONY_TEST_TARGET_SUFFIX) 263test-art-target-default$(2ND_ART_PHONY_TEST_TARGET_SUFFIX): test-art-target-run-test-default$(2ND_ART_PHONY_TEST_TARGET_SUFFIX) 264 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 265 266.PHONY: test-art-target-optimizing$(2ND_ART_PHONY_TEST_TARGET_SUFFIX) 267test-art-target-optimizing$(2ND_ART_PHONY_TEST_TARGET_SUFFIX): test-art-target-run-test-optimizing$(2ND_ART_PHONY_TEST_TARGET_SUFFIX) 268 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 269 270.PHONY: test-art-target-interpreter$(2ND_ART_PHONY_TEST_TARGET_SUFFIX) 271test-art-target-interpreter$(2ND_ART_PHONY_TEST_TARGET_SUFFIX): test-art-target-run-test-interpreter$(2ND_ART_PHONY_TEST_TARGET_SUFFIX) 272 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 273 274.PHONY: test-art-target-jit$(2ND_ART_PHONY_TEST_TARGET_SUFFIX) 275test-art-target-jit$(2ND_ART_PHONY_TEST_TARGET_SUFFIX): test-art-target-run-test-jit$(2ND_ART_PHONY_TEST_TARGET_SUFFIX) 276 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 277endif 278 279 280####################### 281# ART APEX. 282 283include $(CLEAR_VARS) 284 285# The ART APEX comes in three flavors: 286# - the release module (`com.android.art.release`), containing 287# only "release" artifacts; 288# - the debug module (`com.android.art.debug`), containing both 289# "release" and "debug" artifacts, as well as additional tools; 290# - the testing module (`com.android.art.testing`), containing 291# both "release" and "debug" artifacts, as well as additional tools 292# and ART gtests). 293# 294# The ART APEX module (`com.android.art`) is an "alias" for either the 295# release or the debug module. By default, "user" build variants contain 296# the release module, while "userdebug" and "eng" build variants contain 297# the debug module. However, if `PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD` 298# is defined, it overrides the previous logic: 299# - if `PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD` is set to `false`, the 300# build will include the release module (whatever the build 301# variant); 302# - if `PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD` is set to `true`, the 303# build will include the debug module (whatever the build variant). 304 305art_target_include_debug_build := $(PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD) 306ifneq (false,$(art_target_include_debug_build)) 307 ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT))) 308 art_target_include_debug_build := true 309 endif 310endif 311ifeq (true,$(art_target_include_debug_build)) 312 # Module with both release and debug variants, as well as 313 # additional tools. 314 TARGET_ART_APEX := $(DEBUG_ART_APEX) 315 APEX_TEST_MODULE := art-check-debug-apex-gen-fakebin 316else 317 # Release module (without debug variants nor tools). 318 TARGET_ART_APEX := $(RELEASE_ART_APEX) 319 APEX_TEST_MODULE := art-check-release-apex-gen-fakebin 320endif 321 322LOCAL_MODULE := com.android.art 323LOCAL_REQUIRED_MODULES := $(TARGET_ART_APEX) 324LOCAL_REQUIRED_MODULES += art_apex_boot_integrity 325 326# Clear locally used variable. 327art_target_include_debug_build := 328 329include $(BUILD_PHONY_PACKAGE) 330 331include $(CLEAR_VARS) 332LOCAL_MODULE := com.android.art 333LOCAL_IS_HOST_MODULE := true 334ifneq ($(HOST_OS),darwin) 335 LOCAL_REQUIRED_MODULES += $(APEX_TEST_MODULE) 336endif 337include $(BUILD_PHONY_PACKAGE) 338 339# Create canonical name -> file name symlink in the symbol directory 340# The symbol files for the debug or release variant are installed to 341# $(TARGET_OUT_UNSTRIPPED)/$(TARGET_ART_APEX) directory. However, 342# since they are available via /apex/com.android.art at runtime 343# regardless of which variant is installed, create a symlink so that 344# $(TARGET_OUT_UNSTRIPPED)/apex/com.android.art is linked to 345# $(TARGET_OUT_UNSTRIPPED)/apex/$(TARGET_ART_APEX). 346# Note that installation of the symlink is triggered by the apex_manifest.pb 347# file which is the file that is guaranteed to be created regardless of the 348# value of TARGET_FLATTEN_APEX. 349ifeq ($(TARGET_FLATTEN_APEX),true) 350art_apex_manifest_file := $(PRODUCT_OUT)/system/apex/$(TARGET_ART_APEX)/apex_manifest.pb 351else 352art_apex_manifest_file := $(PRODUCT_OUT)/apex/$(TARGET_ART_APEX)/apex_manifest.pb 353endif 354 355art_apex_symlink_timestamp := $(call intermediates-dir-for,FAKE,com.android.art)/symlink.timestamp 356$(art_apex_manifest_file): $(art_apex_symlink_timestamp) 357$(art_apex_manifest_file): PRIVATE_LINK_NAME := $(TARGET_OUT_UNSTRIPPED)/apex/com.android.art 358$(art_apex_symlink_timestamp): 359 $(hide) mkdir -p $(dir $(PRIVATE_LINK_NAME)) 360 $(hide) ln -sf $(TARGET_ART_APEX) $(PRIVATE_LINK_NAME) 361 $(hide) touch $@ 362 363art_apex_manifest_file := 364 365####################### 366# Fake packages for ART 367 368# The art-runtime package depends on the core ART libraries and binaries. It exists so we can 369# manipulate the set of things shipped, e.g., add debug versions and so on. 370 371include $(CLEAR_VARS) 372LOCAL_MODULE := art-runtime 373 374# Base requirements. 375LOCAL_REQUIRED_MODULES := \ 376 dalvikvm.com.android.art.release \ 377 dex2oat.com.android.art.release \ 378 dexoptanalyzer.com.android.art.release \ 379 libart.com.android.art.release \ 380 libart-compiler.com.android.art.release \ 381 libopenjdkjvm.com.android.art.release \ 382 libopenjdkjvmti.com.android.art.release \ 383 profman.com.android.art.release \ 384 libadbconnection.com.android.art.release \ 385 libperfetto_hprof.com.android.art.release \ 386 387# Potentially add in debug variants: 388# 389# * We will never add them if PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD = false. 390# * We will always add them if PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD = true. 391# * Otherwise, we will add them by default to userdebug and eng builds. 392art_target_include_debug_build := $(PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD) 393ifneq (false,$(art_target_include_debug_build)) 394ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT))) 395 art_target_include_debug_build := true 396endif 397ifeq (true,$(art_target_include_debug_build)) 398LOCAL_REQUIRED_MODULES += \ 399 dex2oatd.com.android.art.debug \ 400 dexoptanalyzerd.com.android.art.debug \ 401 libartd.com.android.art.debug \ 402 libartd-compiler.com.android.art.debug \ 403 libopenjdkd.com.android.art.debug \ 404 libopenjdkjvmd.com.android.art.debug \ 405 libopenjdkjvmtid.com.android.art.debug \ 406 profmand.com.android.art.debug \ 407 libadbconnectiond.com.android.art.debug \ 408 libperfetto_hprofd.com.android.art.debug \ 409 410endif 411endif 412 413include $(BUILD_PHONY_PACKAGE) 414 415# The art-tools package depends on helpers and tools that are useful for developers. Similar 416# dependencies exist for the APEX builds for these tools (see build/apex/Android.bp). 417 418include $(CLEAR_VARS) 419LOCAL_MODULE := art-tools 420LOCAL_IS_HOST_MODULE := true 421LOCAL_REQUIRED_MODULES := \ 422 ahat \ 423 dexdump \ 424 hprof-conv \ 425 426# A subset of the tools are disabled when HOST_PREFER_32_BIT is defined as make reports that 427# they are not supported on host (b/129323791). This is likely due to art_apex disabling host 428# APEX builds when HOST_PREFER_32_BIT is set (b/120617876). 429ifneq ($(HOST_PREFER_32_BIT),true) 430LOCAL_REQUIRED_MODULES += \ 431 dexdiag \ 432 dexlist \ 433 oatdump \ 434 435endif 436 437include $(BUILD_PHONY_PACKAGE) 438 439#################################################################################################### 440# Fake packages to ensure generation of libopenjdkd when one builds with mm/mmm/mmma. 441# 442# The library is required for starting a runtime in debug mode, but libartd does not depend on it 443# (dependency cycle otherwise). 444# 445# Note: * As the package is phony to create a dependency the package name is irrelevant. 446# * We make MULTILIB explicit to "both," just to state here that we want both libraries on 447# 64-bit systems, even if it is the default. 448 449# ART on the host. 450ifeq ($(ART_BUILD_HOST_DEBUG),true) 451include $(CLEAR_VARS) 452LOCAL_MODULE := art-libartd-libopenjdkd-host-dependency 453LOCAL_MULTILIB := both 454LOCAL_REQUIRED_MODULES := libopenjdkd 455LOCAL_IS_HOST_MODULE := true 456include $(BUILD_PHONY_PACKAGE) 457endif 458 459# ART on the target. 460ifeq ($(ART_BUILD_TARGET_DEBUG),true) 461include $(CLEAR_VARS) 462LOCAL_MODULE := art-libartd-libopenjdkd-target-dependency 463LOCAL_MULTILIB := both 464LOCAL_REQUIRED_MODULES := libopenjdkd 465include $(BUILD_PHONY_PACKAGE) 466endif 467 468######################################################################## 469# "m build-art" for quick minimal build 470.PHONY: build-art 471build-art: build-art-host build-art-target 472 473.PHONY: build-art-host 474build-art-host: $(HOST_OUT_EXECUTABLES)/art $(ART_HOST_DEPENDENCIES) $(HOST_CORE_IMG_OUTS) 475 476.PHONY: build-art-target 477build-art-target: $(TARGET_OUT_EXECUTABLES)/art $(ART_TARGET_DEPENDENCIES) $(TARGET_CORE_IMG_OUTS) 478 479######################################################################## 480# Workaround for not using symbolic links for linker and bionic libraries 481# in a minimal setup (eg buildbot or golem). 482######################################################################## 483 484PRIVATE_BIONIC_FILES := \ 485 bin/bootstrap/linker \ 486 bin/bootstrap/linker64 \ 487 lib/bootstrap/libc.so \ 488 lib/bootstrap/libm.so \ 489 lib/bootstrap/libdl.so \ 490 lib/bootstrap/libdl_android.so \ 491 lib64/bootstrap/libc.so \ 492 lib64/bootstrap/libm.so \ 493 lib64/bootstrap/libdl.so \ 494 lib64/bootstrap/libdl_android.so \ 495 496PRIVATE_ART_APEX_DEPENDENCY_FILES := \ 497 bin/dalvikvm32 \ 498 bin/dalvikvm64 \ 499 bin/dalvikvm \ 500 bin/dex2oat \ 501 bin/dex2oatd \ 502 bin/dexdump \ 503 504PRIVATE_ART_APEX_DEPENDENCY_LIBS := \ 505 lib/libadbconnectiond.so \ 506 lib/libadbconnection.so \ 507 lib/libandroidicu.so \ 508 lib/libandroidio.so \ 509 lib/libartbased.so \ 510 lib/libartbase.so \ 511 lib/libart-compiler.so \ 512 lib/libartd-compiler.so \ 513 lib/libartd-dexlayout.so \ 514 lib/libartd-disassembler.so \ 515 lib/libart-dexlayout.so \ 516 lib/libart-disassembler.so \ 517 lib/libartd.so \ 518 lib/libartpalette.so \ 519 lib/libart.so \ 520 lib/libbacktrace.so \ 521 lib/libbase.so \ 522 lib/libcrypto.so \ 523 lib/libdexfiled_external.so \ 524 lib/libdexfiled.so \ 525 lib/libdexfile_external.so \ 526 lib/libdexfile.so \ 527 lib/libdexfile_support.so \ 528 lib/libdt_fd_forward.so \ 529 lib/libdt_socket.so \ 530 lib/libexpat.so \ 531 lib/libicui18n.so \ 532 lib/libicu_jni.so \ 533 lib/libicuuc.so \ 534 lib/libjavacore.so \ 535 lib/libjdwp.so \ 536 lib/liblzma.so \ 537 lib/libmeminfo.so \ 538 lib/libnativebridge.so \ 539 lib/libnativehelper.so \ 540 lib/libnativeloader.so \ 541 lib/libnpt.so \ 542 lib/libopenjdkd.so \ 543 lib/libopenjdkjvmd.so \ 544 lib/libopenjdkjvm.so \ 545 lib/libopenjdkjvmtid.so \ 546 lib/libopenjdkjvmti.so \ 547 lib/libopenjdk.so \ 548 lib/libpac.so \ 549 lib/libprocinfo.so \ 550 lib/libprofiled.so \ 551 lib/libprofile.so \ 552 lib/libsigchain.so \ 553 lib/libunwindstack.so \ 554 lib/libvixld.so \ 555 lib/libvixl.so \ 556 lib/libziparchive.so \ 557 lib/libz.so \ 558 lib64/libadbconnectiond.so \ 559 lib64/libadbconnection.so \ 560 lib64/libandroidicu.so \ 561 lib64/libandroidio.so \ 562 lib64/libartbased.so \ 563 lib64/libartbase.so \ 564 lib64/libart-compiler.so \ 565 lib64/libartd-compiler.so \ 566 lib64/libartd-dexlayout.so \ 567 lib64/libartd-disassembler.so \ 568 lib64/libart-dexlayout.so \ 569 lib64/libart-disassembler.so \ 570 lib64/libartd.so \ 571 lib64/libartpalette.so \ 572 lib64/libart.so \ 573 lib64/libbacktrace.so \ 574 lib64/libbase.so \ 575 lib64/libcrypto.so \ 576 lib64/libdexfiled_external.so \ 577 lib64/libdexfiled.so \ 578 lib64/libdexfile_external.so \ 579 lib64/libdexfile.so \ 580 lib64/libdexfile_support.so \ 581 lib64/libdt_fd_forward.so \ 582 lib64/libdt_socket.so \ 583 lib64/libexpat.so \ 584 lib64/libicui18n.so \ 585 lib64/libicu_jni.so \ 586 lib64/libicuuc.so \ 587 lib64/libjavacore.so \ 588 lib64/libjdwp.so \ 589 lib64/liblzma.so \ 590 lib64/libmeminfo.so \ 591 lib64/libnativebridge.so \ 592 lib64/libnativehelper.so \ 593 lib64/libnativeloader.so \ 594 lib64/libnpt.so \ 595 lib64/libopenjdkd.so \ 596 lib64/libopenjdkjvmd.so \ 597 lib64/libopenjdkjvm.so \ 598 lib64/libopenjdkjvmtid.so \ 599 lib64/libopenjdkjvmti.so \ 600 lib64/libopenjdk.so \ 601 lib64/libpac.so \ 602 lib64/libprocinfo.so \ 603 lib64/libprofiled.so \ 604 lib64/libprofile.so \ 605 lib64/libsigchain.so \ 606 lib64/libunwindstack.so \ 607 lib64/libvixld.so \ 608 lib64/libvixl.so \ 609 lib64/libziparchive.so \ 610 lib64/libz.so \ 611 612PRIVATE_CONSCRYPT_APEX_DEPENDENCY_LIBS := \ 613 lib/libcrypto.so \ 614 lib/libjavacrypto.so \ 615 lib/libssl.so \ 616 lib64/libcrypto.so \ 617 lib64/libjavacrypto.so \ 618 lib64/libssl.so \ 619 620# Generate copies of Bionic bootstrap artifacts and ART APEX 621# libraries in the `system` (TARGET_OUT) directory. This is dangerous 622# as these files could inadvertently stay in this directory and be 623# included in a system image. 624# 625# Copy some libraries into `$(TARGET_OUT)/lib(64)` (the 626# `/system/lib(64)` directory to be sync'd to the target) for ART testing 627# purposes: 628# - Bionic bootstrap libraries, copied from 629# `$(TARGET_OUT)/lib(64)/bootstrap` (the `/system/lib(64)/bootstrap` 630# directory to be sync'd to the target); 631# - Programs and libraries from the ART APEX; if the product 632# to build uses flattened APEXes, these libraries are copied from 633# `$(TARGET_OUT)/apex/com.android.art.debug` (the flattened 634# (Debug) ART APEX directory to be sync'd to the target); 635# otherwise, they are copied from 636# `$(TARGET_OUT)/../apex/com.android.art.debug` (the local 637# directory under the build tree containing the (Debug) ART APEX 638# artifacts, which is not sync'd to the target). 639# - Libraries from the Conscrypt APEX may be loaded during golem runs. 640# 641# This target is only used by Golem now. 642# 643# NB Android build does not use cp from: 644# $ANDROID_BUILD_TOP/prebuilts/build-tools/path/{linux-x86,darwin-x86} 645# which has a non-standard set of command-line flags. 646# 647# TODO(b/129332183): Remove this when Golem has full support for the 648# ART APEX. 649.PHONY: standalone-apex-files 650standalone-apex-files: libc.bootstrap \ 651 libdl.bootstrap \ 652 libdl_android.bootstrap \ 653 libm.bootstrap \ 654 linker \ 655 $(DEBUG_ART_APEX) \ 656 $(CONSCRYPT_APEX) 657 for f in $(PRIVATE_BIONIC_FILES); do \ 658 tf=$(TARGET_OUT)/$$f; \ 659 if [ -f $$tf ]; then cp -f $$tf $$(echo $$tf | sed 's,bootstrap/,,'); fi; \ 660 done 661 if [ "x$(TARGET_FLATTEN_APEX)" = xtrue ]; then \ 662 apex_orig_dir=$(TARGET_OUT)/apex; \ 663 else \ 664 apex_orig_dir=""; \ 665 fi; \ 666 art_apex_orig_dir=$$apex_orig_dir/$(DEBUG_ART_APEX); \ 667 for f in $(PRIVATE_ART_APEX_DEPENDENCY_LIBS) $(PRIVATE_ART_APEX_DEPENDENCY_FILES); do \ 668 tf="$$art_apex_orig_dir/$$f"; \ 669 df="$(TARGET_OUT)/$$f"; \ 670 if [ -f $$tf ]; then \ 671 if [ -h $$df ]; then rm $$df; fi; \ 672 cp -fd $$tf $$df; \ 673 fi; \ 674 done; \ 675 conscrypt_apex_orig_dir=$$apex_orig_dir/$(CONSCRYPT_APEX); \ 676 for f in $(PRIVATE_CONSCRYPT_APEX_DEPENDENCY_LIBS); do \ 677 tf="$$conscrypt_apex_orig_dir/$$f"; \ 678 if [ -f $$tf ]; then cp -f $$tf $(TARGET_OUT)/$$f; fi; \ 679 done; \ 680 681######################################################################## 682# Phony target for only building what go/lem requires for pushing ART on /data. 683 684.PHONY: build-art-target-golem 685# Also include libartbenchmark, we always include it when running golem. 686# libstdc++ is needed when building for ART_TARGET_LINUX. 687 688# Also include the bootstrap Bionic libraries (libc, libdl, libdl_android, 689# libm). These are required as the "main" libc, libdl, libdl_android, and libm 690# have moved to the ART APEX. This is a temporary change needed until Golem 691# fully supports the ART APEX. 692# 693# TODO(b/129332183): Remove this when Golem has full support for the 694# ART APEX. 695 696# Also include: 697# - a copy of the ICU prebuilt .dat file in /system/etc/icu on target 698# (see module `icu-data-art-test-i18n`); and 699# so that it can be found even if the ART APEX is not available, by setting the 700# environment variable `ART_TEST_ANDROID_ART_ROOT` to "/system" on device. This 701# is a temporary change needed until Golem fully supports the ART APEX. 702# 703# TODO(b/129332183): Remove this when Golem has full support for the 704# ART APEX. 705 706# Also include: 707# - a copy of the time zone data prebuilt files in 708# /system/etc/tzdata_module/etc/tz and /system/etc/tzdata_module/etc/icu 709# on target, (see modules `tzdata-art-test-tzdata`, 710# `tzlookup.xml-art-test-tzdata`, and `tz_version-art-test-tzdata`, and 711# `icu_overlay-art-test-tzdata`) 712# so that they can be found even if the Time Zone Data APEX is not available, 713# by setting the environment variable `ART_TEST_ANDROID_TZDATA_ROOT` 714# to "/system/etc/tzdata_module" on device. This is a temporary change needed 715# until Golem fully supports the Time Zone Data APEX. 716# 717# TODO(b/129332183): Remove this when Golem has full support for the 718# ART APEX (and TZ Data APEX). 719 720ART_TARGET_SHARED_LIBRARY_BENCHMARK := $(TARGET_OUT_SHARED_LIBRARIES)/libartbenchmark.so 721build-art-target-golem: dex2oat dalvikvm linker libstdc++ \ 722 $(TARGET_OUT_EXECUTABLES)/art \ 723 $(TARGET_OUT)/etc/public.libraries.txt \ 724 $(ART_TARGET_DEX_DEPENDENCIES) \ 725 $(ART_DEBUG_TARGET_SHARED_LIBRARY_DEPENDENCIES) \ 726 $(ART_TARGET_SHARED_LIBRARY_BENCHMARK) \ 727 $(TARGET_CORE_IMG_OUT_BASE).art \ 728 $(TARGET_CORE_IMG_OUT_BASE)-interpreter.art \ 729 libartpalette-system \ 730 libc.bootstrap libdl.bootstrap libdl_android.bootstrap libm.bootstrap \ 731 icu-data-art-test-i18n \ 732 tzdata-art-test-tzdata tzlookup.xml-art-test-tzdata \ 733 tz_version-art-test-tzdata icu_overlay-art-test-tzdata \ 734 standalone-apex-files 735 # remove debug libraries from public.libraries.txt because golem builds 736 # won't have it. 737 sed -i '/libartd.so/d' $(TARGET_OUT)/etc/public.libraries.txt 738 sed -i '/libdexfiled.so/d' $(TARGET_OUT)/etc/public.libraries.txt 739 sed -i '/libprofiled.so/d' $(TARGET_OUT)/etc/public.libraries.txt 740 sed -i '/libartbased.so/d' $(TARGET_OUT)/etc/public.libraries.txt 741 742######################################################################## 743# Phony target for building what go/lem requires on host. 744.PHONY: build-art-host-golem 745# Also include libartbenchmark, we always include it when running golem. 746ART_HOST_SHARED_LIBRARY_BENCHMARK := $(ART_HOST_OUT_SHARED_LIBRARIES)/libartbenchmark.so 747build-art-host-golem: build-art-host \ 748 $(ART_HOST_SHARED_LIBRARY_BENCHMARK) 749 750######################################################################## 751# Phony target for building what go/lem requires for syncing /system to target. 752.PHONY: build-art-unbundled-golem 753build-art-unbundled-golem: art-runtime linker oatdump $(ART_APEX_JARS) conscrypt crash_dump 754 755######################################################################## 756# Rules for building all dependencies for tests. 757 758.PHONY: build-art-host-tests 759build-art-host-tests: build-art-host $(TEST_ART_RUN_TEST_DEPENDENCIES) $(ART_TEST_HOST_RUN_TEST_DEPENDENCIES) $(ART_TEST_HOST_GTEST_DEPENDENCIES) | $(TEST_ART_RUN_TEST_ORDERONLY_DEPENDENCIES) 760 761.PHONY: build-art-target-tests 762build-art-target-tests: build-art-target $(TEST_ART_RUN_TEST_DEPENDENCIES) $(ART_TEST_TARGET_RUN_TEST_DEPENDENCIES) $(ART_TEST_TARGET_GTEST_DEPENDENCIES) | $(TEST_ART_RUN_TEST_ORDERONLY_DEPENDENCIES) 763 764######################################################################## 765# targets to switch back and forth from libdvm to libart 766 767.PHONY: use-art 768use-art: 769 $(ADB) root 770 $(ADB) wait-for-device shell stop 771 $(ADB) shell setprop persist.sys.dalvik.vm.lib.2 libart.so 772 $(ADB) shell start 773 774.PHONY: use-artd 775use-artd: 776 $(ADB) root 777 $(ADB) wait-for-device shell stop 778 $(ADB) shell setprop persist.sys.dalvik.vm.lib.2 libartd.so 779 $(ADB) shell start 780 781.PHONY: use-dalvik 782use-dalvik: 783 $(ADB) root 784 $(ADB) wait-for-device shell stop 785 $(ADB) shell setprop persist.sys.dalvik.vm.lib.2 libdvm.so 786 $(ADB) shell start 787 788.PHONY: use-art-full 789use-art-full: 790 $(ADB) root 791 $(ADB) wait-for-device shell stop 792 $(ADB) shell rm -rf $(ART_TARGET_DALVIK_CACHE_DIR)/* 793 $(ADB) shell setprop dalvik.vm.dex2oat-filter \"\" 794 $(ADB) shell setprop dalvik.vm.image-dex2oat-filter \"\" 795 $(ADB) shell setprop persist.sys.dalvik.vm.lib.2 libart.so 796 $(ADB) shell setprop dalvik.vm.usejit false 797 $(ADB) shell start 798 799.PHONY: use-artd-full 800use-artd-full: 801 $(ADB) root 802 $(ADB) wait-for-device shell stop 803 $(ADB) shell rm -rf $(ART_TARGET_DALVIK_CACHE_DIR)/* 804 $(ADB) shell setprop dalvik.vm.dex2oat-filter \"\" 805 $(ADB) shell setprop dalvik.vm.image-dex2oat-filter \"\" 806 $(ADB) shell setprop persist.sys.dalvik.vm.lib.2 libartd.so 807 $(ADB) shell setprop dalvik.vm.usejit false 808 $(ADB) shell start 809 810.PHONY: use-art-jit 811use-art-jit: 812 $(ADB) root 813 $(ADB) wait-for-device shell stop 814 $(ADB) shell rm -rf $(ART_TARGET_DALVIK_CACHE_DIR)/* 815 $(ADB) shell setprop dalvik.vm.dex2oat-filter "verify-at-runtime" 816 $(ADB) shell setprop dalvik.vm.image-dex2oat-filter "verify-at-runtime" 817 $(ADB) shell setprop persist.sys.dalvik.vm.lib.2 libart.so 818 $(ADB) shell setprop dalvik.vm.usejit true 819 $(ADB) shell start 820 821.PHONY: use-art-interpret-only 822use-art-interpret-only: 823 $(ADB) root 824 $(ADB) wait-for-device shell stop 825 $(ADB) shell rm -rf $(ART_TARGET_DALVIK_CACHE_DIR)/* 826 $(ADB) shell setprop dalvik.vm.dex2oat-filter "interpret-only" 827 $(ADB) shell setprop dalvik.vm.image-dex2oat-filter "interpret-only" 828 $(ADB) shell setprop persist.sys.dalvik.vm.lib.2 libart.so 829 $(ADB) shell setprop dalvik.vm.usejit false 830 $(ADB) shell start 831 832.PHONY: use-artd-interpret-only 833use-artd-interpret-only: 834 $(ADB) root 835 $(ADB) wait-for-device shell stop 836 $(ADB) shell rm -rf $(ART_TARGET_DALVIK_CACHE_DIR)/* 837 $(ADB) shell setprop dalvik.vm.dex2oat-filter "interpret-only" 838 $(ADB) shell setprop dalvik.vm.image-dex2oat-filter "interpret-only" 839 $(ADB) shell setprop persist.sys.dalvik.vm.lib.2 libartd.so 840 $(ADB) shell setprop dalvik.vm.usejit false 841 $(ADB) shell start 842 843.PHONY: use-art-verify-none 844use-art-verify-none: 845 $(ADB) root 846 $(ADB) wait-for-device shell stop 847 $(ADB) shell rm -rf $(ART_TARGET_DALVIK_CACHE_DIR)/* 848 $(ADB) shell setprop dalvik.vm.dex2oat-filter "verify-none" 849 $(ADB) shell setprop dalvik.vm.image-dex2oat-filter "verify-none" 850 $(ADB) shell setprop persist.sys.dalvik.vm.lib.2 libart.so 851 $(ADB) shell setprop dalvik.vm.usejit false 852 $(ADB) shell start 853 854######################################################################## 855 856# Clear locally used variables. 857TEST_ART_TARGET_SYNC_DEPS := 858 859# Helper target that depends on boot image creation. 860# 861# Can be used, for example, to dump initialization failures: 862# m art-boot-image ART_BOOT_IMAGE_EXTRA_ARGS=--dump-init-failures=fails.txt 863.PHONY: art-boot-image 864art-boot-image: $(DEXPREOPT_IMAGE_boot_$(TARGET_ARCH)) 865 866.PHONY: art-job-images 867art-job-images: \ 868 art-boot-image \ 869 $(2ND_DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) \ 870 $(HOST_OUT_EXECUTABLES)/dex2oats \ 871 $(HOST_OUT_EXECUTABLES)/dex2oatds \ 872 $(HOST_OUT_EXECUTABLES)/profman 873