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