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 21include $(art_path)/tools/veridex/Android.mk 22 23######################################################################## 24# clean-oat rules 25# 26 27include $(art_path)/build/Android.common_path.mk 28 29.PHONY: clean-oat 30clean-oat: clean-oat-host clean-oat-target 31 32.PHONY: clean-oat-host 33clean-oat-host: 34 find $(OUT_DIR) '(' -name '*.oat' -o -name '*.odex' -o -name '*.art' -o -name '*.vdex' ')' -a -type f | xargs rm -f 35 rm -rf $(TMPDIR)/*/test-*/dalvik-cache/* 36 rm -rf $(TMPDIR)/android-data/dalvik-cache/* 37 38.PHONY: clean-oat-target 39clean-oat-target: 40 $(ADB) root 41 $(ADB) wait-for-device remount 42 $(ADB) shell rm -rf $(ART_TARGET_NATIVETEST_DIR) 43 $(ADB) shell rm -rf $(ART_TARGET_TEST_DIR) 44 $(ADB) shell rm -rf $(ART_TARGET_DALVIK_CACHE_DIR)/*/* 45 $(ADB) shell rm -rf $(ART_DEXPREOPT_BOOT_JAR_DIR)/$(DEX2OAT_TARGET_ARCH) 46 $(ADB) shell rm -rf system/app/$(DEX2OAT_TARGET_ARCH) 47ifdef TARGET_2ND_ARCH 48 $(ADB) shell rm -rf $(ART_DEXPREOPT_BOOT_JAR_DIR)/$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH) 49 $(ADB) shell rm -rf system/app/$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH) 50endif 51 $(ADB) shell rm -rf data/run-test/test-*/dalvik-cache/* 52 53######################################################################## 54# cpplint rules to style check art source files 55 56include $(art_path)/build/Android.cpplint.mk 57 58######################################################################## 59# The art-tools package depends on helpers and tools that are useful for developers. Similar 60# dependencies exist for the APEX builds for these tools (see build/apex/Android.bp). 61 62ifneq ($(HOST_OS),darwin) 63include $(CLEAR_VARS) 64LOCAL_MODULE := art-tools 65LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 66LOCAL_LICENSE_CONDITIONS := notice 67LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE 68LOCAL_IS_HOST_MODULE := true 69 70ifeq (true,$(my_art_module_source_build)) 71 72LOCAL_REQUIRED_MODULES := \ 73 ahat \ 74 dexdump \ 75 hprof-conv \ 76 77# A subset of the tools are disabled when HOST_PREFER_32_BIT is defined as make reports that 78# they are not supported on host (b/129323791). This is likely due to art_apex disabling host 79# APEX builds when HOST_PREFER_32_BIT is set (b/120617876). 80ifneq ($(HOST_PREFER_32_BIT),true) 81LOCAL_REQUIRED_MODULES += \ 82 dexdiag \ 83 dexlist \ 84 oatdump \ 85 86endif 87 88else 89 90# The developer tools available as prebuilts. 91LOCAL_REQUIRED_MODULES := \ 92 dexdump \ 93 oatdump \ 94 95endif # ifeq (true,$(my_art_module_source_build)) 96 97include $(BUILD_PHONY_PACKAGE) 98endif # HOST_OS != darwin 99 100 101######################################################################## 102# Everything below is only available in ART source builds 103# (ART_MODULE_BUILD_FROM_SOURCE=true). 104######################################################################## 105 106# TODO(b/172480617): Clean up the platform dependencies on everything above and 107# remove this condition. 108ifeq (true,$(my_art_module_source_build)) 109 110 111######################################################################## 112# product rules 113 114include $(art_path)/oatdump/Android.mk 115include $(art_path)/tools/ahat/Android.mk 116include $(art_path)/tools/dexfuzz/Android.mk 117 118ART_HOST_DEPENDENCIES := \ 119 $(ART_HOST_EXECUTABLES) \ 120 $(ART_HOST_DEX_DEPENDENCIES) \ 121 $(ART_HOST_SHARED_LIBRARY_DEPENDENCIES) 122 123ifeq ($(ART_BUILD_HOST_DEBUG),true) 124ART_HOST_DEPENDENCIES += $(ART_HOST_SHARED_LIBRARY_DEBUG_DEPENDENCIES) 125endif 126 127ART_TARGET_DEPENDENCIES := \ 128 $(ART_TARGET_DEX_DEPENDENCIES) 129 130######################################################################## 131# test rules 132 133# All the dependencies that must be built ahead of sync-ing them onto the target device. 134TEST_ART_TARGET_SYNC_DEPS := $(ADB_EXECUTABLE) 135 136include $(art_path)/build/Android.common_test.mk 137include $(art_path)/build/Android.gtest.mk 138include $(art_path)/test/Android.run-test.mk 139 140TEST_ART_TARGET_SYNC_DEPS += $(ART_TEST_TARGET_GTEST_DEPENDENCIES) $(ART_TEST_TARGET_RUN_TEST_DEPENDENCIES) 141 142# Make sure /system is writable on the device. 143TEST_ART_ADB_ROOT_AND_REMOUNT := \ 144 ($(ADB) root && \ 145 $(ADB) wait-for-device remount && \ 146 (($(ADB) shell touch /system/testfile && \ 147 ($(ADB) shell rm /system/testfile || true)) || \ 148 ($(ADB) disable-verity && \ 149 $(ADB) reboot && \ 150 $(ADB) wait-for-device root && \ 151 $(ADB) wait-for-device remount))) 152 153# "mm test-art" to build and run all tests on host and device 154.PHONY: test-art 155test-art: 156 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 157 158.PHONY: test-art-gtest 159test-art-gtest: 160 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 161 162.PHONY: test-art-run-test 163test-art-run-test: 164 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 165 166######################################################################## 167# host test rules 168 169test-art: test-art-host 170test-art-gtest: test-art-host-gtest 171test-art-run-test: test-art-host-run-test 172 173VIXL_TEST_DEPENDENCY := 174# We can only run the vixl tests on 64-bit hosts (vixl testing issue) when its a 175# top-level build (to declare the vixl test rule). 176ifneq ($(HOST_PREFER_32_BIT),true) 177ifeq ($(ONE_SHOT_MAKEFILE),) 178VIXL_TEST_DEPENDENCY := run-vixl-tests 179endif 180endif 181 182.PHONY: test-art-host-vixl 183test-art-host-vixl: $(VIXL_TEST_DEPENDENCY) 184 185# "mm test-art-host" to build and run all host tests. 186.PHONY: test-art-host 187test-art-host: test-art-host-gtest test-art-host-run-test \ 188 test-art-host-vixl test-art-host-dexdump 189 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 190 191# All host tests that run solely with the default compiler. 192.PHONY: test-art-host-default 193test-art-host-default: test-art-host-run-test-default 194 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 195 196# All host tests that run solely with the optimizing compiler. 197.PHONY: test-art-host-optimizing 198test-art-host-optimizing: test-art-host-run-test-optimizing 199 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 200 201# All host tests that run solely on the interpreter. 202.PHONY: test-art-host-interpreter 203test-art-host-interpreter: test-art-host-run-test-interpreter 204 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 205 206# All host tests that run solely on the jit. 207.PHONY: test-art-host-jit 208test-art-host-jit: test-art-host-run-test-jit 209 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 210 211# Primary host architecture variants: 212.PHONY: test-art-host$(ART_PHONY_TEST_HOST_SUFFIX) 213test-art-host$(ART_PHONY_TEST_HOST_SUFFIX): test-art-host-gtest$(ART_PHONY_TEST_HOST_SUFFIX) \ 214 test-art-host-run-test$(ART_PHONY_TEST_HOST_SUFFIX) 215 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 216 217.PHONY: test-art-host-default$(ART_PHONY_TEST_HOST_SUFFIX) 218test-art-host-default$(ART_PHONY_TEST_HOST_SUFFIX): test-art-host-run-test-default$(ART_PHONY_TEST_HOST_SUFFIX) 219 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 220 221.PHONY: test-art-host-optimizing$(ART_PHONY_TEST_HOST_SUFFIX) 222test-art-host-optimizing$(ART_PHONY_TEST_HOST_SUFFIX): test-art-host-run-test-optimizing$(ART_PHONY_TEST_HOST_SUFFIX) 223 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 224 225.PHONY: test-art-host-interpreter$(ART_PHONY_TEST_HOST_SUFFIX) 226test-art-host-interpreter$(ART_PHONY_TEST_HOST_SUFFIX): test-art-host-run-test-interpreter$(ART_PHONY_TEST_HOST_SUFFIX) 227 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 228 229.PHONY: test-art-host-jit$(ART_PHONY_TEST_HOST_SUFFIX) 230test-art-host-jit$(ART_PHONY_TEST_HOST_SUFFIX): test-art-host-run-test-jit$(ART_PHONY_TEST_HOST_SUFFIX) 231 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 232 233# Secondary host architecture variants: 234ifneq ($(HOST_PREFER_32_BIT),true) 235.PHONY: test-art-host$(2ND_ART_PHONY_TEST_HOST_SUFFIX) 236test-art-host$(2ND_ART_PHONY_TEST_HOST_SUFFIX): test-art-host-gtest$(2ND_ART_PHONY_TEST_HOST_SUFFIX) \ 237 test-art-host-run-test$(2ND_ART_PHONY_TEST_HOST_SUFFIX) 238 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 239 240.PHONY: test-art-host-default$(2ND_ART_PHONY_TEST_HOST_SUFFIX) 241test-art-host-default$(2ND_ART_PHONY_TEST_HOST_SUFFIX): test-art-host-run-test-default$(2ND_ART_PHONY_TEST_HOST_SUFFIX) 242 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 243 244.PHONY: test-art-host-optimizing$(2ND_ART_PHONY_TEST_HOST_SUFFIX) 245test-art-host-optimizing$(2ND_ART_PHONY_TEST_HOST_SUFFIX): test-art-host-run-test-optimizing$(2ND_ART_PHONY_TEST_HOST_SUFFIX) 246 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 247 248.PHONY: test-art-host-interpreter$(2ND_ART_PHONY_TEST_HOST_SUFFIX) 249test-art-host-interpreter$(2ND_ART_PHONY_TEST_HOST_SUFFIX): test-art-host-run-test-interpreter$(2ND_ART_PHONY_TEST_HOST_SUFFIX) 250 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 251 252.PHONY: test-art-host-jit$(2ND_ART_PHONY_TEST_HOST_SUFFIX) 253test-art-host-jit$(2ND_ART_PHONY_TEST_HOST_SUFFIX): test-art-host-run-test-jit$(2ND_ART_PHONY_TEST_HOST_SUFFIX) 254 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 255endif 256 257# Dexdump/list regression test. 258.PHONY: test-art-host-dexdump 259test-art-host-dexdump: $(addprefix $(HOST_OUT_EXECUTABLES)/, dexdump dexlist) 260 ANDROID_HOST_OUT=$(realpath $(HOST_OUT)) art/test/dexdump/run-all-tests 261 262######################################################################## 263# target test rules 264 265test-art: test-art-target 266test-art-gtest: test-art-target-gtest 267test-art-run-test: test-art-target-run-test 268 269# "mm test-art-target" to build and run all target tests. 270.PHONY: test-art-target 271test-art-target: test-art-target-gtest test-art-target-run-test 272 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 273 274# All target tests that run solely with the default compiler. 275.PHONY: test-art-target-default 276test-art-target-default: test-art-target-run-test-default 277 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 278 279# All target tests that run solely with the optimizing compiler. 280.PHONY: test-art-target-optimizing 281test-art-target-optimizing: test-art-target-run-test-optimizing 282 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 283 284# All target tests that run solely on the interpreter. 285.PHONY: test-art-target-interpreter 286test-art-target-interpreter: test-art-target-run-test-interpreter 287 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 288 289# All target tests that run solely on the jit. 290.PHONY: test-art-target-jit 291test-art-target-jit: test-art-target-run-test-jit 292 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 293 294# Primary target architecture variants: 295.PHONY: test-art-target$(ART_PHONY_TEST_TARGET_SUFFIX) 296test-art-target$(ART_PHONY_TEST_TARGET_SUFFIX): test-art-target-gtest$(ART_PHONY_TEST_TARGET_SUFFIX) \ 297 test-art-target-run-test$(ART_PHONY_TEST_TARGET_SUFFIX) 298 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 299 300.PHONY: test-art-target-default$(ART_PHONY_TEST_TARGET_SUFFIX) 301test-art-target-default$(ART_PHONY_TEST_TARGET_SUFFIX): test-art-target-run-test-default$(ART_PHONY_TEST_TARGET_SUFFIX) 302 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 303 304.PHONY: test-art-target-optimizing$(ART_PHONY_TEST_TARGET_SUFFIX) 305test-art-target-optimizing$(ART_PHONY_TEST_TARGET_SUFFIX): test-art-target-run-test-optimizing$(ART_PHONY_TEST_TARGET_SUFFIX) 306 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 307 308.PHONY: test-art-target-interpreter$(ART_PHONY_TEST_TARGET_SUFFIX) 309test-art-target-interpreter$(ART_PHONY_TEST_TARGET_SUFFIX): test-art-target-run-test-interpreter$(ART_PHONY_TEST_TARGET_SUFFIX) 310 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 311 312.PHONY: test-art-target-jit$(ART_PHONY_TEST_TARGET_SUFFIX) 313test-art-target-jit$(ART_PHONY_TEST_TARGET_SUFFIX): test-art-target-run-test-jit$(ART_PHONY_TEST_TARGET_SUFFIX) 314 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 315 316# Secondary target architecture variants: 317ifdef 2ND_ART_PHONY_TEST_TARGET_SUFFIX 318.PHONY: test-art-target$(2ND_ART_PHONY_TEST_TARGET_SUFFIX) 319test-art-target$(2ND_ART_PHONY_TEST_TARGET_SUFFIX): test-art-target-gtest$(2ND_ART_PHONY_TEST_TARGET_SUFFIX) \ 320 test-art-target-run-test$(2ND_ART_PHONY_TEST_TARGET_SUFFIX) 321 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 322 323.PHONY: test-art-target-default$(2ND_ART_PHONY_TEST_TARGET_SUFFIX) 324test-art-target-default$(2ND_ART_PHONY_TEST_TARGET_SUFFIX): test-art-target-run-test-default$(2ND_ART_PHONY_TEST_TARGET_SUFFIX) 325 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 326 327.PHONY: test-art-target-optimizing$(2ND_ART_PHONY_TEST_TARGET_SUFFIX) 328test-art-target-optimizing$(2ND_ART_PHONY_TEST_TARGET_SUFFIX): test-art-target-run-test-optimizing$(2ND_ART_PHONY_TEST_TARGET_SUFFIX) 329 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 330 331.PHONY: test-art-target-interpreter$(2ND_ART_PHONY_TEST_TARGET_SUFFIX) 332test-art-target-interpreter$(2ND_ART_PHONY_TEST_TARGET_SUFFIX): test-art-target-run-test-interpreter$(2ND_ART_PHONY_TEST_TARGET_SUFFIX) 333 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 334 335.PHONY: test-art-target-jit$(2ND_ART_PHONY_TEST_TARGET_SUFFIX) 336test-art-target-jit$(2ND_ART_PHONY_TEST_TARGET_SUFFIX): test-art-target-run-test-jit$(2ND_ART_PHONY_TEST_TARGET_SUFFIX) 337 $(hide) $(call ART_TEST_PREREQ_FINISHED,$@) 338endif 339 340####################### 341# Reset LOCAL_PATH because previous includes may override its value. 342# Keep this after all "include $(art_path)/..." are done, and before any 343# "include $(BUILD_...)". 344LOCAL_PATH := $(art_path) 345 346# Create canonical name -> file name symlink in the symbol directory for the 347# debug APEX. The symbol files for it are installed to 348# $(TARGET_OUT_UNSTRIPPED)/apex/com.android.art.debug. However, since it's 349# available via /apex/com.android.art at runtime, create a symlink so that 350# $(TARGET_OUT_UNSTRIPPED)/apex/com.android.art is linked to 351# $(TARGET_OUT_UNSTRIPPED)/apex/$(TARGET_ART_APEX). We skip this for the release 352# APEX which has com.android.art as $(TARGET_ART_APEX). Note that installation 353# of the symlink is triggered by the apex_manifest.pb file which is the file 354# that is guaranteed to be created regardless of the value of 355# TARGET_FLATTEN_APEX. 356# TODO(b/171419613): the symlink is disabled because the 357# $OUT/symbols/apex/com.android.art name is taken by the com.android.art apex 358# even when com.android.art.debug is selected by TARGET_ART_APEX. 359# Disabling the symlink means that symbols for the com.android.art.debug apex 360# will not be found. 361ifeq ($(TARGET_FLATTEN_APEX),true) 362art_apex_manifest_file := $(PRODUCT_OUT)/system/apex/$(TARGET_ART_APEX)/apex_manifest.pb 363else 364art_apex_manifest_file := $(PRODUCT_OUT)/apex/$(TARGET_ART_APEX)/apex_manifest.pb 365endif 366 367art_apex_symlink_timestamp := $(call intermediates-dir-for,FAKE,com.android.art)/symlink.timestamp 368$(art_apex_manifest_file): $(art_apex_symlink_timestamp) 369$(art_apex_manifest_file): PRIVATE_LINK_NAME := $(TARGET_OUT_UNSTRIPPED)/apex/com.android.art 370$(art_apex_symlink_timestamp): 371#ifeq ($(TARGET_ART_APEX),com.android.art) 372# $(hide) if [ -L $(PRIVATE_LINK_NAME) ]; then rm -f $(PRIVATE_LINK_NAME); fi 373#else 374# $(hide) mkdir -p $(dir $(PRIVATE_LINK_NAME)) 375# $(hide) rm -rf $(PRIVATE_LINK_NAME) 376# $(hide) ln -sf $(TARGET_ART_APEX) $(PRIVATE_LINK_NAME) 377#endif 378 $(hide) touch $@ 379$(art_apex_symlink_timestamp): .KATI_SYMLINK_OUTPUTS := $(PRIVATE_LINK_NAME) 380 381art_apex_manifest_file := 382 383#################################################################################################### 384# Fake packages to ensure generation of libopenjdkd when one builds with mm/mmm/mmma. 385# 386# The library is required for starting a runtime in debug mode, but libartd does not depend on it 387# (dependency cycle otherwise). 388# 389# Note: * As the package is phony to create a dependency the package name is irrelevant. 390# * We make MULTILIB explicit to "both," just to state here that we want both libraries on 391# 64-bit systems, even if it is the default. 392 393# ART on the host. 394ifneq ($(HOST_OS),darwin) 395ifeq ($(ART_BUILD_HOST_DEBUG),true) 396include $(CLEAR_VARS) 397LOCAL_MODULE := art-libartd-libopenjdkd-host-dependency 398LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 399LOCAL_LICENSE_CONDITIONS := notice 400LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE 401LOCAL_MULTILIB := both 402LOCAL_REQUIRED_MODULES := libopenjdkd 403LOCAL_IS_HOST_MODULE := true 404include $(BUILD_PHONY_PACKAGE) 405endif 406endif # HOST_OS != darwin 407 408######################################################################## 409# "m build-art" for quick minimal build 410.PHONY: build-art 411 412build-art: build-art-host 413 414# For host, we extract the ICU data from the apex and install it to HOST_OUT/I18N_APEX. 415$(HOST_I18N_DATA): $(TARGET_OUT)/apex/$(I18N_APEX).apex $(HOST_OUT)/bin/deapexer 416 $(call extract-from-apex,$(I18N_APEX)) 417 rm -rf $(HOST_OUT)/$(I18N_APEX) 418 mkdir -p $(HOST_OUT)/$(I18N_APEX)/ 419 cp -R $(TARGET_OUT)/apex/$(I18N_APEX)/etc/ $(HOST_OUT)/$(I18N_APEX)/ 420 touch $@ 421 422$(HOST_TZDATA_DATA): $(TARGET_OUT)/apex/$(TZDATA_APEX).apex $(HOST_OUT)/bin/deapexer 423 $(call extract-from-apex,$(TZDATA_APEX)) 424 rm -rf $(HOST_OUT)/$(TZDATA_APEX) 425 mkdir -p $(HOST_OUT)/$(TZDATA_APEX)/ 426 cp -R $(TARGET_OUT)/apex/$(TZDATA_APEX)/etc/ $(HOST_OUT)/$(TZDATA_APEX)/ 427 touch $@ 428 429.PHONY: build-art-host 430build-art-host: $(HOST_OUT_EXECUTABLES)/art $(ART_HOST_DEPENDENCIES) $(HOST_CORE_IMG_OUTS) $(HOST_I18N_DATA) $(HOST_TZDATA_DATA) 431 432build-art: build-art-target 433 434.PHONY: build-art-target 435build-art-target: $(TARGET_OUT_EXECUTABLES)/art $(ART_TARGET_DEPENDENCIES) $(TARGET_CORE_IMG_OUTS) 436 437PRIVATE_ART_APEX_DEPENDENCY_FILES := \ 438 bin/dalvikvm32 \ 439 bin/dalvikvm64 \ 440 bin/dalvikvm \ 441 bin/dex2oat32 \ 442 bin/dex2oat64 \ 443 bin/dexdump \ 444 445PRIVATE_ART_APEX_DEPENDENCY_LIBS := \ 446 lib/libadbconnection.so \ 447 lib/libandroidio.so \ 448 lib/libartbase.so \ 449 lib/libart-compiler.so \ 450 lib/libart-dexlayout.so \ 451 lib/libart-disassembler.so \ 452 lib/libartpalette.so \ 453 lib/libart.so \ 454 lib/libdexfile.so \ 455 lib/libdt_fd_forward.so \ 456 lib/libdt_socket.so \ 457 lib/libexpat.so \ 458 lib/libjavacore.so \ 459 lib/libjdwp.so \ 460 lib/liblzma.so \ 461 lib/libmeminfo.so \ 462 lib/libnativebridge.so \ 463 lib/libnativehelper.so \ 464 lib/libnativeloader.so \ 465 lib/libnpt.so \ 466 lib/libopenjdkjvm.so \ 467 lib/libopenjdkjvmti.so \ 468 lib/libopenjdk.so \ 469 lib/libpac.so \ 470 lib/libprocinfo.so \ 471 lib/libprofile.so \ 472 lib/libsigchain.so \ 473 lib/libunwindstack.so \ 474 lib64/libadbconnection.so \ 475 lib64/libandroidio.so \ 476 lib64/libartbase.so \ 477 lib64/libart-compiler.so \ 478 lib64/libart-dexlayout.so \ 479 lib64/libart-disassembler.so \ 480 lib64/libartpalette.so \ 481 lib64/libart.so \ 482 lib64/libdexfile.so \ 483 lib64/libdt_fd_forward.so \ 484 lib64/libdt_socket.so \ 485 lib64/libexpat.so \ 486 lib64/libjavacore.so \ 487 lib64/libjdwp.so \ 488 lib64/liblzma.so \ 489 lib64/libmeminfo.so \ 490 lib64/libnativebridge.so \ 491 lib64/libnativehelper.so \ 492 lib64/libnativeloader.so \ 493 lib64/libnpt.so \ 494 lib64/libopenjdkjvm.so \ 495 lib64/libopenjdkjvmti.so \ 496 lib64/libopenjdk.so \ 497 lib64/libpac.so \ 498 lib64/libprocinfo.so \ 499 lib64/libprofile.so \ 500 lib64/libsigchain.so \ 501 lib64/libunwindstack.so \ 502 503PRIVATE_RUNTIME_APEX_DEPENDENCY_FILES := \ 504 bin/linker \ 505 bin/linker64 \ 506 lib/bionic/libc.so \ 507 lib/bionic/libdl.so \ 508 lib/bionic/libdl_android.so \ 509 lib/bionic/libm.so \ 510 lib64/bionic/libc.so \ 511 lib64/bionic/libdl.so \ 512 lib64/bionic/libdl_android.so \ 513 lib64/bionic/libm.so \ 514 515PRIVATE_CONSCRYPT_APEX_DEPENDENCY_LIBS := \ 516 lib/libcrypto.so \ 517 lib/libjavacrypto.so \ 518 lib/libssl.so \ 519 lib64/libcrypto.so \ 520 lib64/libjavacrypto.so \ 521 lib64/libssl.so \ 522 523PRIVATE_I18N_APEX_DEPENDENCY_LIBS := \ 524 lib/libicu.so \ 525 lib/libicui18n.so \ 526 lib/libicu_jni.so \ 527 lib/libicuuc.so \ 528 lib64/libicu.so \ 529 lib64/libicui18n.so \ 530 lib64/libicu_jni.so \ 531 lib64/libicuuc.so \ 532 533PRIVATE_STATSD_APEX_DEPENDENCY_LIBS := \ 534 lib/libstatssocket.so \ 535 lib64/libstatssocket.so \ 536 537# Extracts files from an APEX into a location. The APEX can be either a .apex 538# file in $(TARGET_OUT)/apex, or a directory in the same location. Files are 539# extracted to $(TARGET_OUT) with the same relative paths as under the APEX 540# root. 541# $(1): APEX base name 542# $(2): List of files to extract, with paths relative to the APEX root 543# 544# "cp -d" below doesn't work on Darwin, but this is only used for Golem builds 545# and won't run on mac anyway. 546define extract-from-apex 547 apex_root=$(TARGET_OUT)/apex && \ 548 apex_file=$$apex_root/$(1).apex && \ 549 apex_dir=$$apex_root/$(1) && \ 550 if [ -f $$apex_file ]; then \ 551 rm -rf $$apex_dir && \ 552 mkdir -p $$apex_dir && \ 553 debugfs=$(HOST_OUT)/bin/debugfs_static && \ 554 blkid=$(HOST_OUT)/bin/blkid_static && \ 555 fsckerofs=$(HOST_OUT)/bin/fsck.erofs && \ 556 $(HOST_OUT)/bin/deapexer --debugfs_path $$debugfs --blkid_path $$blkid \ 557 --fsckerofs_path $$fsckerofs extract $$apex_file $$apex_dir; \ 558 fi && \ 559 for f in $(2); do \ 560 sf=$$apex_dir/$$f && \ 561 df=$(TARGET_OUT)/$$f && \ 562 if [ -f $$sf -o -h $$sf ]; then \ 563 mkdir -p $$(dirname $$df) && \ 564 cp -fd $$sf $$df; \ 565 fi || exit 1; \ 566 done 567endef 568 569# Copy or extract some required files from APEXes to the `system` (TARGET_OUT) 570# directory. This is dangerous as these files could inadvertently stay in this 571# directory and be included in a system image. 572# 573# This target is only used by Golem now. 574# 575# NB Android build does not use cp from: 576# $ANDROID_BUILD_TOP/prebuilts/build-tools/path/{linux-x86,darwin-x86} 577# which has a non-standard set of command-line flags. 578# 579# TODO(b/129332183): Remove this when Golem has full support for the 580# ART APEX. 581# 582# TODO(b/129332183): This approach is flawed: We mix DSOs from prebuilt APEXes 583# and prebuilts/runtime/mainline/platform/impl with source built ones, and both 584# may depend on the same DSOs, and some of them don't have stable ABIs. 585# libbase.so in particular is such a problematic dependency. When those 586# dependencies eventually don't work anymore we don't have much choice but to 587# update all prebuilts. 588.PHONY: standalone-apex-files 589standalone-apex-files: deapexer \ 590 $(RELEASE_ART_APEX) \ 591 $(RUNTIME_APEX) \ 592 $(CONSCRYPT_APEX) \ 593 $(I18N_APEX) \ 594 $(STATSD_APEX) \ 595 $(TZDATA_APEX) 596 $(call extract-from-apex,$(RELEASE_ART_APEX),\ 597 $(PRIVATE_ART_APEX_DEPENDENCY_LIBS) $(PRIVATE_ART_APEX_DEPENDENCY_FILES)) 598 # The Runtime APEX has the Bionic libs in ${LIB}/bionic subdirectories, 599 # so we need to move them up a level after extraction. 600 # Also, platform libraries are installed in prebuilts, so copy them over. 601 $(call extract-from-apex,$(RUNTIME_APEX),\ 602 $(PRIVATE_RUNTIME_APEX_DEPENDENCY_FILES)) && \ 603 libdir=$(TARGET_OUT)/lib$$(expr $(TARGET_ARCH) : '.*\(64\)' || :) && \ 604 if [ -d $$libdir/bionic ]; then \ 605 mv -f $$libdir/bionic/*.so $$libdir; \ 606 fi && \ 607 cp prebuilts/runtime/mainline/platform/impl/$(TARGET_ARCH)/*.so $$libdir 608 $(call extract-from-apex,$(CONSCRYPT_APEX),\ 609 $(PRIVATE_CONSCRYPT_APEX_DEPENDENCY_LIBS)) 610 $(call extract-from-apex,$(I18N_APEX),\ 611 $(PRIVATE_I18N_APEX_DEPENDENCY_LIBS)) 612 $(call extract-from-apex,$(STATSD_APEX),\ 613 $(PRIVATE_STATSD_APEX_DEPENDENCY_LIBS)) 614 $(call extract-from-apex,$(TZDATA_APEX),) 615 616######################################################################## 617# Phony target for only building what go/lem requires for pushing ART on /data. 618 619.PHONY: build-art-target-golem 620 621ART_TARGET_PLATFORM_DEPENDENCIES := \ 622 $(TARGET_OUT)/etc/public.libraries.txt \ 623 $(TARGET_OUT_SHARED_LIBRARIES)/libcutils.so \ 624 $(TARGET_OUT_SHARED_LIBRARIES)/liblz4.so \ 625 $(TARGET_OUT_SHARED_LIBRARIES)/libprocessgroup.so \ 626 $(TARGET_OUT_SHARED_LIBRARIES)/libprocinfo.so \ 627 $(TARGET_OUT_SHARED_LIBRARIES)/libselinux.so \ 628 $(TARGET_OUT_SHARED_LIBRARIES)/libtombstoned_client.so \ 629 $(TARGET_OUT_SHARED_LIBRARIES)/libz.so \ 630 631# Also include libartbenchmark, we always include it when running golem. 632# libstdc++ is needed when building for ART_TARGET_LINUX. 633ART_TARGET_SHARED_LIBRARY_BENCHMARK := $(TARGET_OUT_SHARED_LIBRARIES)/libartbenchmark.so 634 635build-art-target-golem: $(RELEASE_ART_APEX) com.android.runtime $(CONSCRYPT_APEX) \ 636 $(TARGET_OUT_EXECUTABLES)/art \ 637 $(TARGET_OUT_EXECUTABLES)/dex2oat_wrapper \ 638 $(ART_TARGET_PLATFORM_DEPENDENCIES) \ 639 $(ART_TARGET_SHARED_LIBRARY_BENCHMARK) \ 640 $(TARGET_OUT_SHARED_LIBRARIES)/libgolemtiagent.so \ 641 $(PRODUCT_OUT)/apex/art_boot_images/javalib/$(TARGET_ARCH)/boot.art \ 642 standalone-apex-files 643 # remove debug libraries from public.libraries.txt because golem builds 644 # won't have it. 645 sed -i '/libartd.so/d' $(TARGET_OUT)/etc/public.libraries.txt 646 sed -i '/libdexfiled.so/d' $(TARGET_OUT)/etc/public.libraries.txt 647 sed -i '/libprofiled.so/d' $(TARGET_OUT)/etc/public.libraries.txt 648 sed -i '/libartbased.so/d' $(TARGET_OUT)/etc/public.libraries.txt 649 650######################################################################## 651# Phony target for building what go/lem requires on host. 652 653.PHONY: build-art-host-golem 654# Also include libartbenchmark, we always include it when running golem. 655ART_HOST_SHARED_LIBRARY_BENCHMARK := $(ART_HOST_OUT_SHARED_LIBRARIES)/libartbenchmark.so 656build-art-host-golem: build-art-host \ 657 $(ART_HOST_SHARED_LIBRARY_BENCHMARK) \ 658 $(ART_HOST_OUT_SHARED_LIBRARIES)/libgolemtiagent.so \ 659 $(HOST_OUT_EXECUTABLES)/dex2oat_wrapper 660 661######################################################################## 662# Rules for building all dependencies for tests. 663 664.PHONY: build-art-host-gtests build-art-host-run-tests build-art-host-tests 665 666build-art-host-gtests: build-art-host $(ART_TEST_HOST_GTEST_DEPENDENCIES) 667 668build-art-host-run-tests: build-art-host \ 669 $(TEST_ART_RUN_TEST_DEPENDENCIES) \ 670 $(ART_TEST_HOST_RUN_TEST_DEPENDENCIES) \ 671 art-run-test-host-data \ 672 art-run-test-jvm-data 673 674build-art-host-tests: build-art-host-gtests build-art-host-run-tests 675 676.PHONY: build-art-target-gtests build-art-target-run-tests build-art-target-tests 677 678build-art-target-gtests: build-art-target $(ART_TEST_TARGET_GTEST_DEPENDENCIES) 679 680build-art-target-run-tests: build-art-target \ 681 $(TEST_ART_RUN_TEST_DEPENDENCIES) \ 682 $(ART_TEST_TARGET_RUN_TEST_DEPENDENCIES) \ 683 art-run-test-target-data 684 685build-art-target-tests: build-art-target-gtests build-art-target-run-tests 686 687######################################################################## 688# targets to switch back and forth from libdvm to libart 689 690.PHONY: use-art 691use-art: 692 $(ADB) root 693 $(ADB) wait-for-device shell stop 694 $(ADB) shell setprop persist.sys.dalvik.vm.lib.2 libart.so 695 $(ADB) shell start 696 697.PHONY: use-artd 698use-artd: 699 $(ADB) root 700 $(ADB) wait-for-device shell stop 701 $(ADB) shell setprop persist.sys.dalvik.vm.lib.2 libartd.so 702 $(ADB) shell start 703 704.PHONY: use-dalvik 705use-dalvik: 706 $(ADB) root 707 $(ADB) wait-for-device shell stop 708 $(ADB) shell setprop persist.sys.dalvik.vm.lib.2 libdvm.so 709 $(ADB) shell start 710 711.PHONY: use-art-full 712use-art-full: 713 $(ADB) root 714 $(ADB) wait-for-device shell stop 715 $(ADB) shell rm -rf $(ART_TARGET_DALVIK_CACHE_DIR)/* 716 $(ADB) shell setprop dalvik.vm.dex2oat-filter \"\" 717 $(ADB) shell setprop dalvik.vm.image-dex2oat-filter \"\" 718 $(ADB) shell setprop persist.sys.dalvik.vm.lib.2 libart.so 719 $(ADB) shell setprop dalvik.vm.usejit false 720 $(ADB) shell start 721 722.PHONY: use-artd-full 723use-artd-full: 724 $(ADB) root 725 $(ADB) wait-for-device shell stop 726 $(ADB) shell rm -rf $(ART_TARGET_DALVIK_CACHE_DIR)/* 727 $(ADB) shell setprop dalvik.vm.dex2oat-filter \"\" 728 $(ADB) shell setprop dalvik.vm.image-dex2oat-filter \"\" 729 $(ADB) shell setprop persist.sys.dalvik.vm.lib.2 libartd.so 730 $(ADB) shell setprop dalvik.vm.usejit false 731 $(ADB) shell start 732 733.PHONY: use-art-jit 734use-art-jit: 735 $(ADB) root 736 $(ADB) wait-for-device shell stop 737 $(ADB) shell rm -rf $(ART_TARGET_DALVIK_CACHE_DIR)/* 738 $(ADB) shell setprop dalvik.vm.dex2oat-filter "verify-at-runtime" 739 $(ADB) shell setprop dalvik.vm.image-dex2oat-filter "verify-at-runtime" 740 $(ADB) shell setprop persist.sys.dalvik.vm.lib.2 libart.so 741 $(ADB) shell setprop dalvik.vm.usejit true 742 $(ADB) shell start 743 744.PHONY: use-art-interpret-only 745use-art-interpret-only: 746 $(ADB) root 747 $(ADB) wait-for-device shell stop 748 $(ADB) shell rm -rf $(ART_TARGET_DALVIK_CACHE_DIR)/* 749 $(ADB) shell setprop dalvik.vm.dex2oat-filter "interpret-only" 750 $(ADB) shell setprop dalvik.vm.image-dex2oat-filter "interpret-only" 751 $(ADB) shell setprop persist.sys.dalvik.vm.lib.2 libart.so 752 $(ADB) shell setprop dalvik.vm.usejit false 753 $(ADB) shell start 754 755.PHONY: use-artd-interpret-only 756use-artd-interpret-only: 757 $(ADB) root 758 $(ADB) wait-for-device shell stop 759 $(ADB) shell rm -rf $(ART_TARGET_DALVIK_CACHE_DIR)/* 760 $(ADB) shell setprop dalvik.vm.dex2oat-filter "interpret-only" 761 $(ADB) shell setprop dalvik.vm.image-dex2oat-filter "interpret-only" 762 $(ADB) shell setprop persist.sys.dalvik.vm.lib.2 libartd.so 763 $(ADB) shell setprop dalvik.vm.usejit false 764 $(ADB) shell start 765 766.PHONY: use-art-verify-none 767use-art-verify-none: 768 $(ADB) root 769 $(ADB) wait-for-device shell stop 770 $(ADB) shell rm -rf $(ART_TARGET_DALVIK_CACHE_DIR)/* 771 $(ADB) shell setprop dalvik.vm.dex2oat-filter "verify-none" 772 $(ADB) shell setprop dalvik.vm.image-dex2oat-filter "verify-none" 773 $(ADB) shell setprop persist.sys.dalvik.vm.lib.2 libart.so 774 $(ADB) shell setprop dalvik.vm.usejit false 775 $(ADB) shell start 776 777######################################################################## 778 779# Clear locally used variables. 780TEST_ART_TARGET_SYNC_DEPS := 781 782# Helper target that depends on boot image creation. 783# 784# Can be used, for example, to dump initialization failures: 785# m art-boot-image ART_BOOT_IMAGE_EXTRA_ARGS=--dump-init-failures=fails.txt 786.PHONY: art-boot-image 787art-boot-image: $(DEXPREOPT_IMAGE_boot_$(TARGET_ARCH)) 788 789.PHONY: art-job-images 790art-job-images: \ 791 art-boot-image \ 792 $(2ND_DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) \ 793 $(HOST_OUT_EXECUTABLES)/dex2oats \ 794 $(HOST_OUT_EXECUTABLES)/dex2oatds \ 795 $(HOST_OUT_EXECUTABLES)/profman 796 797######################################################################## 798 799# Build a target that contains dex public SDK stubs for SDK version in the list. 800# Zip files structure: 801# public-sdk-28-stub.zip 802# classes.dex 803# public-sdk-29-stub.zip 804# classes.dex 805# public-sdk-30-stub.zip 806# classes.dex 807MIN_SDK_VERSION := 28 808SDK_VERSIONS := $(call numbers_greater_or_equal_to,$(MIN_SDK_VERSION),$(TARGET_AVAIALBLE_SDK_VERSIONS)) 809 810# Create dex public SDK stubs. 811define get_public_sdk_stub_dex 812$(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/public_sdk_$(1)_stub_intermediates/classes.dex 813endef 814 815# The input is the SDK version. 816define create_public_sdk_dex 817public_sdk_$(1)_stub := $$(call get_public_sdk_stub_dex,$(1)) 818$$(public_sdk_$(1)_stub): PRIVATE_MIN_SDK_VERSION := $(1) 819$$(public_sdk_$(1)_stub): $$(call resolve-prebuilt-sdk-jar-path,$(1)) $$(D8) $$(ZIP2ZIP) 820 $$(transform-classes.jar-to-dex) 821 822$$(call declare-1p-target,$$(public_sdk_$(1)_stub),art) 823endef 824 825$(foreach version,$(SDK_VERSIONS),$(eval $(call create_public_sdk_dex,$(version)))) 826 827# Create dex public SDK stubs zip. 828define get_public_sdk_stub_zip 829$(call intermediates-dir-for,PACKAGING,public_sdk_stub,HOST)/public-sdk-$(1)-stub.zip 830endef 831 832define create_public_sdk_zip 833PUBLIC_SDK_$(1)_STUB_ZIP_PATH := $$(call get_public_sdk_stub_zip,$(1)) 834$$(PUBLIC_SDK_$(1)_STUB_ZIP_PATH): PRIVATE_SDK_STUBS_DEX_DIR := $$(dir $$(public_sdk_$(1)_stub)) 835$$(PUBLIC_SDK_$(1)_STUB_ZIP_PATH): $$(SOONG_ZIP) $$(public_sdk_$(1)_stub) 836 rm -f $$@ 837 $$(SOONG_ZIP) -o $$@ -C $$(PRIVATE_SDK_STUBS_DEX_DIR) -D $$(PRIVATE_SDK_STUBS_DEX_DIR) 838 839$$(call declare-1p-container,$$(PUBLIC_SDK_$(1)_STUB_ZIP_PATH),art) 840$$(call declare-container-license-deps,$$(PUBLIC_SDK_$(1)_STUB_ZIP_PATH),$$(public_sdk_$(1)_stub),$$(PUBLIC_SDK_$(1)_STUB_PATH):) 841endef 842 843$(foreach version,$(SDK_VERSIONS),$(eval $(call create_public_sdk_zip,$(version)))) 844 845# Make the zip files available for prebuilts. 846$(foreach version,$(SDK_VERSIONS),$(call dist-for-goals,sdk,$(call get_public_sdk_stub_zip,$(version)))) 847 848STUB_ZIP_FILES = $(foreach version,$(SDK_VERSIONS),$(call get_public_sdk_stub_zip,$(version))) 849 850.PHONY: public_sdk_stubs 851public_sdk_stubs: $(STUB_ZIP_FILES) 852 853MIN_SDK_VERSION := 854SDK_VERSIONS := 855 856endif # ifeq (true,$(my_art_module_source_build)) 857