blob: 6231b863f55af1e283b731341e3cbb0e1ebcb25f [file] [log] [blame]
Ian Rogersafd9acc2014-06-17 08:21:54 -07001#
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
Igor Murashkin37743352014-11-13 14:38:00 -080017ifndef ART_ANDROID_COMMON_PATH_MK
18ART_ANDROID_COMMON_PATH_MK := true
Ian Rogersafd9acc2014-06-17 08:21:54 -070019
Martin Stjernholm21dafaf2021-02-17 20:39:45 +000020# We cannot build things that require host core images from prebuilts, because
21# they aren't present there. Set up a variable to skip all build rules that
22# relate to them, because `m checkbuild` complains on rules with nonexisting
23# dependencies, even if they won't get called.
24# TODO(b/172480617): Remove this when ART sources are no longer in platform manifests.
Cole Faust76aa34b2022-02-22 17:03:02 -080025ifeq (true,$(ART_MODULE_BUILD_FROM_SOURCE))
Martin Stjernholm21dafaf2021-02-17 20:39:45 +000026 my_art_module_source_build := true
Cole Faust76aa34b2022-02-22 17:03:02 -080027else ifeq (false,$(ART_MODULE_BUILD_FROM_SOURCE))
Martin Stjernholm21dafaf2021-02-17 20:39:45 +000028 my_art_module_source_build := false
29else
Cole Faust76aa34b2022-02-22 17:03:02 -080030 $(error ART_MODULE_BUILD_FROM_SOURCE is neither true nor false - mk file ordering problem?)
Martin Stjernholm21dafaf2021-02-17 20:39:45 +000031endif
32
Martin Stjernholm1dc77ab2021-05-10 17:44:05 +010033ifeq (true,$(my_art_module_source_build))
34
Ian Rogersafd9acc2014-06-17 08:21:54 -070035include art/build/Android.common.mk
Colin Cross31963602016-08-30 16:18:42 -070036include art/build/Android.common_build.mk
Ian Rogersafd9acc2014-06-17 08:21:54 -070037
38# Directory used for dalvik-cache on device.
39ART_TARGET_DALVIK_CACHE_DIR := /data/dalvik-cache
40
41# Directory used for gtests on device.
Andreas Gampe1fe5e5c2014-07-11 21:14:35 -070042# $(TARGET_OUT_DATA_NATIVE_TESTS) will evaluate to the nativetest directory in the target part on
43# the host, so we can strip everything but the directory to find out whether it is "nativetest" or
44# "nativetest64."
45ART_TARGET_NATIVETEST_DIR := /data/$(notdir $(TARGET_OUT_DATA_NATIVE_TESTS))/art
46
Ian Rogersafd9acc2014-06-17 08:21:54 -070047ART_TARGET_NATIVETEST_OUT := $(TARGET_OUT_DATA_NATIVE_TESTS)/art
48
49# Directory used for oat tests on device.
50ART_TARGET_TEST_DIR := /data/art-test
51ART_TARGET_TEST_OUT := $(TARGET_OUT_DATA)/art-test
52
Vladimir Marko0ace5632018-12-14 11:11:47 +000053# Modules to compile for core.art.
Victor Changd20e51d2020-05-05 16:01:19 +010054CORE_IMG_JARS := core-oj core-libart okhttp bouncycastle apache-xml
Vladimir Marko0ace5632018-12-14 11:11:47 +000055HOST_CORE_IMG_JARS := $(addsuffix -hostdex,$(CORE_IMG_JARS))
Nicolas Geoffray31e0dc22020-03-20 15:48:09 +000056TARGET_CORE_IMG_JARS := $(CORE_IMG_JARS)
Vladimir Marko0ace5632018-12-14 11:11:47 +000057HOST_CORE_IMG_DEX_LOCATIONS := $(foreach jar,$(HOST_CORE_IMG_JARS), $(HOST_OUT_JAVA_LIBRARIES)/$(jar).jar)
58ifeq ($(ART_TEST_ANDROID_ROOT),)
Nicolas Geoffraya144c272019-02-20 12:03:53 +000059TARGET_CORE_IMG_DEX_LOCATIONS := $(foreach jar,$(TARGET_CORE_IMG_JARS),/$(ART_DEXPREOPT_BOOT_JAR_DIR)/$(jar).jar)
Vladimir Marko0ace5632018-12-14 11:11:47 +000060else
61TARGET_CORE_IMG_DEX_LOCATIONS := $(foreach jar,$(TARGET_CORE_IMG_JARS),$(ART_TEST_ANDROID_ROOT)/$(jar).jar)
62endif
63HOST_CORE_IMG_DEX_FILES := $(foreach jar,$(HOST_CORE_IMG_JARS), $(call intermediates-dir-for,JAVA_LIBRARIES,$(jar),t,COMMON)/javalib.jar)
Nicolas Geoffray31e0dc22020-03-20 15:48:09 +000064TARGET_CORE_IMG_DEX_FILES := $(foreach jar,$(TARGET_CORE_IMG_JARS),$(call intermediates-dir-for,JAVA_LIBRARIES,$(jar).com.android.art.testing, ,COMMON)/javalib.jar)
Vladimir Marko0ace5632018-12-14 11:11:47 +000065
David Srbecky0c0f3022020-02-13 15:53:01 +000066# Also copy the jar files next to host boot.art image.
Jiakai Zhangb9784192021-12-13 14:11:43 +000067# `dexpreopt_bootjars.go` uses a single source of input regardless of variants, so we should use the
68# same source for `CORE_IMG_JARS` to avoid checksum mismatches on the oat files.
David Srbecky0c0f3022020-02-13 15:53:01 +000069HOST_BOOT_IMAGE_JARS := $(foreach jar,$(CORE_IMG_JARS),$(HOST_OUT)/apex/com.android.art/javalib/$(jar).jar)
Jiakai Zhangb9784192021-12-13 14:11:43 +000070CORE_IMG_JAR_DIR := $(OUT_DIR)/soong/$(PRODUCT_DEVICE)/dex_artjars_input
71$(HOST_BOOT_IMAGE_JARS): $(HOST_OUT)/apex/com.android.art/javalib/%.jar : $(CORE_IMG_JAR_DIR)/%.jar
David Srbecky0c0f3022020-02-13 15:53:01 +000072 $(copy-file-to-target)
Martin Stjernholm21dafaf2021-02-17 20:39:45 +000073
Jiakai Zhangb9784192021-12-13 14:11:43 +000074# We can still use the host variant of `conscrypt` and `core-icu4j` because they don't go into the
75# primary boot image that is used in host gtests, and hence can't lead to checksum mismatches.
David Srbecky0c0f3022020-02-13 15:53:01 +000076HOST_BOOT_IMAGE_JARS += $(HOST_OUT)/apex/com.android.conscrypt/javalib/conscrypt.jar
77$(HOST_OUT)/apex/com.android.conscrypt/javalib/conscrypt.jar : $(HOST_OUT_JAVA_LIBRARIES)/conscrypt-hostdex.jar
78 $(copy-file-to-target)
Victor Changd20e51d2020-05-05 16:01:19 +010079HOST_BOOT_IMAGE_JARS += $(HOST_OUT)/apex/com.android.i18n/javalib/core-icu4j.jar
80$(HOST_OUT)/apex/com.android.i18n/javalib/core-icu4j.jar : $(HOST_OUT_JAVA_LIBRARIES)/core-icu4j-hostdex.jar
81 $(copy-file-to-target)
David Srbecky0c0f3022020-02-13 15:53:01 +000082
David Srbecky42df1c72020-04-07 15:53:47 +010083HOST_CORE_IMG_OUTS += $(HOST_BOOT_IMAGE_JARS) $(HOST_BOOT_IMAGE) $(2ND_HOST_BOOT_IMAGE)
84
Jiakai Zhangc56152c2021-12-15 13:52:13 +000085HOST_TEST_CORE_JARS := $(addsuffix -hostdex,$(CORE_IMG_JARS) core-icu4j conscrypt)
86ART_HOST_DEX_DEPENDENCIES := $(foreach jar,$(HOST_TEST_CORE_JARS),$(HOST_OUT_JAVA_LIBRARIES)/$(jar).jar)
Victor Changd20e51d2020-05-05 16:01:19 +010087ART_TARGET_DEX_DEPENDENCIES := com.android.art.testing com.android.conscrypt com.android.i18n
Richard Uhlerc5a00042016-07-01 13:10:56 -070088
Nikita Iashchenko0a110f32022-04-07 16:57:30 +010089ART_CORE_SHARED_LIBRARIES := libjavacore libopenjdk libopenjdkjvm libopenjdkjvmti libjdwp
Alex Light7b497ee2017-05-25 09:54:15 -070090ART_CORE_SHARED_DEBUG_LIBRARIES := libopenjdkd libopenjdkjvmd libopenjdkjvmtid
Nicolas Geoffrayc69b3f82020-06-22 12:33:38 +000091ART_HOST_CORE_SHARED_LIBRARIES := $(ART_CORE_SHARED_LIBRARIES) libicuuc-host libicui18n-host libicu_jni
Victor Changd20e51d2020-05-05 16:01:19 +010092ART_HOST_SHARED_LIBRARY_DEPENDENCIES := $(foreach lib,$(ART_HOST_CORE_SHARED_LIBRARIES), $(ART_HOST_OUT_SHARED_LIBRARIES)/$(lib)$(ART_HOST_SHLIB_EXTENSION))
Alex Light7b497ee2017-05-25 09:54:15 -070093ART_HOST_SHARED_LIBRARY_DEBUG_DEPENDENCIES := $(foreach lib,$(ART_CORE_SHARED_DEBUG_LIBRARIES), $(ART_HOST_OUT_SHARED_LIBRARIES)/$(lib)$(ART_HOST_SHLIB_EXTENSION))
Richard Uhlerc5a00042016-07-01 13:10:56 -070094ifdef HOST_2ND_ARCH
Victor Changd20e51d2020-05-05 16:01:19 +010095ART_HOST_SHARED_LIBRARY_DEPENDENCIES += $(foreach lib,$(ART_HOST_CORE_SHARED_LIBRARIES), $(2ND_HOST_OUT_SHARED_LIBRARIES)/$(lib).so)
Alex Light7b497ee2017-05-25 09:54:15 -070096ART_HOST_SHARED_LIBRARY_DEBUG_DEPENDENCIES += $(foreach lib,$(ART_CORE_SHARED_DEBUG_LIBRARIES), $(2ND_HOST_OUT_SHARED_LIBRARIES)/$(lib).so)
Richard Uhlerc5a00042016-07-01 13:10:56 -070097endif
98
Jiyong Park066dd9022019-12-19 02:11:59 +000099# Both the primary and the secondary arches of the libs are built by depending
100# on the module name.
101ART_DEBUG_TARGET_SHARED_LIBRARY_DEPENDENCIES := $(foreach lib,$(ART_CORE_SHARED_LIBRARIES), $(lib).com.android.art.debug)
Alex Light7b497ee2017-05-25 09:54:15 -0700102ART_TARGET_SHARED_LIBRARY_DEBUG_DEPENDENCIES := $(foreach lib,$(ART_CORE_SHARED_DEBUG_LIBRARIES), $(TARGET_OUT_SHARED_LIBRARIES)/$(lib).so)
Richard Uhlerc5a00042016-07-01 13:10:56 -0700103ifdef TARGET_2ND_ARCH
Alex Light7b497ee2017-05-25 09:54:15 -0700104ART_TARGET_SHARED_LIBRARY_DEBUG_DEPENDENCIES += $(foreach lib,$(ART_CORE_SHARED_DEBUG_LIBRARIES), $(2ND_TARGET_OUT_SHARED_LIBRARIES)/$(lib).so)
Richard Uhlerc5a00042016-07-01 13:10:56 -0700105endif
106
Victor Hsieh7a3ccd02021-09-08 11:59:29 -0700107ART_CORE_DEBUGGABLE_EXECUTABLES_COMMON := \
Colin Cross31963602016-08-30 16:18:42 -0700108 dex2oat \
Calin Juravle36eb3132017-01-13 16:32:38 -0800109 dexoptanalyzer \
Colin Cross31963602016-08-30 16:18:42 -0700110 imgdiag \
111 oatdump \
Colin Cross31963602016-08-30 16:18:42 -0700112 profman \
113
Victor Hsieh7a3ccd02021-09-08 11:59:29 -0700114ART_CORE_DEBUGGABLE_EXECUTABLES_TARGET := $(ART_CORE_DEBUGGABLE_EXECUTABLES_COMMON) odrefresh
115ART_CORE_DEBUGGABLE_EXECUTABLES_HOST := $(ART_CORE_DEBUGGABLE_EXECUTABLES_COMMON)
116
Colin Cross02a73352016-09-13 16:47:02 -0700117ART_CORE_EXECUTABLES := \
118 dalvikvm \
119 dexlist \
120
Colin Cross31963602016-08-30 16:18:42 -0700121# Depend on the -target or -host phony targets generated by the build system
122# for each module
Colin Cross02a73352016-09-13 16:47:02 -0700123ART_TARGET_EXECUTABLES :=
Colin Cross31963602016-08-30 16:18:42 -0700124ifneq ($(ART_BUILD_TARGET_NDEBUG),false)
Victor Hsieh7a3ccd02021-09-08 11:59:29 -0700125ART_TARGET_EXECUTABLES += $(foreach name,$(ART_CORE_EXECUTABLES) $(ART_CORE_DEBUGGABLE_EXECUTABLES_TARGET),$(name)-target)
Colin Cross31963602016-08-30 16:18:42 -0700126endif
127ifneq ($(ART_BUILD_TARGET_DEBUG),false)
Victor Hsieh7a3ccd02021-09-08 11:59:29 -0700128ART_TARGET_EXECUTABLES += $(foreach name,$(ART_CORE_DEBUGGABLE_EXECUTABLES_TARGET),$(name)d-target)
Colin Cross31963602016-08-30 16:18:42 -0700129endif
130
Colin Cross02a73352016-09-13 16:47:02 -0700131ART_HOST_EXECUTABLES :=
Colin Cross31963602016-08-30 16:18:42 -0700132ifneq ($(ART_BUILD_HOST_NDEBUG),false)
Victor Hsieh7a3ccd02021-09-08 11:59:29 -0700133ART_HOST_EXECUTABLES += $(foreach name,$(ART_CORE_EXECUTABLES) $(ART_CORE_DEBUGGABLE_EXECUTABLES_HOST),$(name)-host)
Colin Cross31963602016-08-30 16:18:42 -0700134endif
135ifneq ($(ART_BUILD_HOST_DEBUG),false)
Victor Hsieh7a3ccd02021-09-08 11:59:29 -0700136ART_HOST_EXECUTABLES += $(foreach name,$(ART_CORE_DEBUGGABLE_EXECUTABLES_HOST),$(name)d-host)
Colin Cross31963602016-08-30 16:18:42 -0700137endif
138
Martin Stjernholm84e5bb92019-09-05 19:56:46 +0100139# Release ART APEX, included by default in "user" builds.
Martin Stjernholm3e9abfc2020-10-09 22:17:51 +0100140RELEASE_ART_APEX := com.android.art
Martin Stjernholm84e5bb92019-09-05 19:56:46 +0100141# Debug ART APEX, included by default in "userdebug" and "eng"
Roland Levillain8d5a2152019-07-02 19:40:28 +0100142# builds and used in ART device benchmarking.
Martin Stjernholm84e5bb92019-09-05 19:56:46 +0100143DEBUG_ART_APEX := com.android.art.debug
144# Testing ART APEX, used in ART device testing.
145TESTING_ART_APEX := com.android.art.testing
Roland Levillainf0b1de82019-07-02 19:25:58 +0100146
Martin Stjernholm4bb9f672020-05-19 01:33:47 +0100147RUNTIME_APEX := com.android.runtime
Orion Hodsonc4d13ae2020-01-07 12:46:25 +0000148CONSCRYPT_APEX := com.android.conscrypt
Victor Changd20e51d2020-05-05 16:01:19 +0100149I18N_APEX := com.android.i18n
Martin Stjernholm4e014112021-03-08 14:24:44 +0000150STATSD_APEX := com.android.os.statsd
Nicolas Geoffraycaac87a2021-01-11 09:51:03 +0000151TZDATA_APEX := com.android.tzdata
Orion Hodsonc4d13ae2020-01-07 12:46:25 +0000152
Nicolas Geoffray5ece8ff2020-07-29 18:20:59 +0100153# A phony file to create the ICU data file for host.
Nicolas Geoffray15259602020-07-30 09:31:15 +0100154HOST_I18N_DATA := $(HOST_OUT)/$(I18N_APEX)/timestamp
Nicolas Geoffraycaac87a2021-01-11 09:51:03 +0000155# A phony file to create the tz data file for host.
156HOST_TZDATA_DATA := $(HOST_OUT)/$(TZDATA_APEX)/timestamp
Nicolas Geoffray5ece8ff2020-07-29 18:20:59 +0100157
Martin Stjernholm1dc77ab2021-05-10 17:44:05 +0100158endif # ifeq (true,$(my_art_module_source_build))
159
Igor Murashkin37743352014-11-13 14:38:00 -0800160endif # ART_ANDROID_COMMON_PATH_MK