• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
17ifndef ART_ANDROID_COMMON_PATH_MK
18ART_ANDROID_COMMON_PATH_MK := true
19
20# 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.
25ifeq (true,$(ART_MODULE_BUILD_FROM_SOURCE))
26  my_art_module_source_build := true
27else ifeq (false,$(ART_MODULE_BUILD_FROM_SOURCE))
28  my_art_module_source_build := false
29else
30  $(error ART_MODULE_BUILD_FROM_SOURCE is neither true nor false - mk file ordering problem?)
31endif
32
33ifeq (true,$(my_art_module_source_build))
34
35include art/build/Android.common.mk
36include art/build/Android.common_build.mk
37
38# Directory used for dalvik-cache on device.
39ART_TARGET_DALVIK_CACHE_DIR := /data/dalvik-cache
40
41# Directory used for gtests on device.
42# $(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
47ART_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
53# Modules to compile for core.art.
54CORE_IMG_JARS := core-oj core-libart okhttp bouncycastle apache-xml
55HOST_CORE_IMG_JARS   := $(addsuffix -hostdex,$(CORE_IMG_JARS))
56TARGET_CORE_IMG_JARS := $(CORE_IMG_JARS)
57HOST_CORE_IMG_DEX_LOCATIONS   := $(foreach jar,$(HOST_CORE_IMG_JARS),  $(HOST_OUT_JAVA_LIBRARIES)/$(jar).jar)
58ifeq ($(ART_TEST_ANDROID_ROOT),)
59TARGET_CORE_IMG_DEX_LOCATIONS := $(foreach jar,$(TARGET_CORE_IMG_JARS),/$(ART_DEXPREOPT_BOOT_JAR_DIR)/$(jar).jar)
60else
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)
64TARGET_CORE_IMG_DEX_FILES := $(foreach jar,$(TARGET_CORE_IMG_JARS),$(call intermediates-dir-for,JAVA_LIBRARIES,$(jar).com.android.art.testing, ,COMMON)/javalib.jar)
65
66# Also copy the jar files next to host boot.art image.
67# `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.
69HOST_BOOT_IMAGE_JARS := $(foreach jar,$(CORE_IMG_JARS),$(HOST_OUT)/apex/com.android.art/javalib/$(jar).jar)
70CORE_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
72	$(copy-file-to-target)
73
74# 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.
76HOST_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)
79HOST_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)
82
83HOST_CORE_IMG_OUTS += $(HOST_BOOT_IMAGE_JARS) $(HOST_BOOT_IMAGE) $(2ND_HOST_BOOT_IMAGE)
84
85HOST_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)
87ART_TARGET_DEX_DEPENDENCIES := com.android.art.testing com.android.conscrypt com.android.i18n
88
89ART_CORE_SHARED_LIBRARIES := libjavacore libopenjdk libopenjdkjvm libopenjdkjvmti libjdwp
90ART_CORE_SHARED_DEBUG_LIBRARIES := libopenjdkd libopenjdkjvmd libopenjdkjvmtid
91ART_HOST_CORE_SHARED_LIBRARIES := $(ART_CORE_SHARED_LIBRARIES) libicuuc-host libicui18n-host libicu_jni
92ART_HOST_SHARED_LIBRARY_DEPENDENCIES := $(foreach lib,$(ART_HOST_CORE_SHARED_LIBRARIES), $(ART_HOST_OUT_SHARED_LIBRARIES)/$(lib)$(ART_HOST_SHLIB_EXTENSION))
93ART_HOST_SHARED_LIBRARY_DEBUG_DEPENDENCIES := $(foreach lib,$(ART_CORE_SHARED_DEBUG_LIBRARIES), $(ART_HOST_OUT_SHARED_LIBRARIES)/$(lib)$(ART_HOST_SHLIB_EXTENSION))
94ifdef HOST_2ND_ARCH
95ART_HOST_SHARED_LIBRARY_DEPENDENCIES += $(foreach lib,$(ART_HOST_CORE_SHARED_LIBRARIES), $(2ND_HOST_OUT_SHARED_LIBRARIES)/$(lib).so)
96ART_HOST_SHARED_LIBRARY_DEBUG_DEPENDENCIES += $(foreach lib,$(ART_CORE_SHARED_DEBUG_LIBRARIES), $(2ND_HOST_OUT_SHARED_LIBRARIES)/$(lib).so)
97endif
98
99# 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)
102ART_TARGET_SHARED_LIBRARY_DEBUG_DEPENDENCIES := $(foreach lib,$(ART_CORE_SHARED_DEBUG_LIBRARIES), $(TARGET_OUT_SHARED_LIBRARIES)/$(lib).so)
103ifdef TARGET_2ND_ARCH
104ART_TARGET_SHARED_LIBRARY_DEBUG_DEPENDENCIES += $(foreach lib,$(ART_CORE_SHARED_DEBUG_LIBRARIES), $(2ND_TARGET_OUT_SHARED_LIBRARIES)/$(lib).so)
105endif
106
107ART_CORE_DEBUGGABLE_EXECUTABLES_COMMON := \
108    dex2oat \
109    dexoptanalyzer \
110    imgdiag \
111    oatdump \
112    profman \
113
114ART_CORE_DEBUGGABLE_EXECUTABLES_TARGET := $(ART_CORE_DEBUGGABLE_EXECUTABLES_COMMON) odrefresh
115ART_CORE_DEBUGGABLE_EXECUTABLES_HOST := $(ART_CORE_DEBUGGABLE_EXECUTABLES_COMMON)
116
117ART_CORE_EXECUTABLES := \
118    dalvikvm \
119    dexlist \
120
121# Depend on the -target or -host phony targets generated by the build system
122# for each module
123ART_TARGET_EXECUTABLES :=
124ifneq ($(ART_BUILD_TARGET_NDEBUG),false)
125ART_TARGET_EXECUTABLES += $(foreach name,$(ART_CORE_EXECUTABLES) $(ART_CORE_DEBUGGABLE_EXECUTABLES_TARGET),$(name)-target)
126endif
127ifneq ($(ART_BUILD_TARGET_DEBUG),false)
128ART_TARGET_EXECUTABLES += $(foreach name,$(ART_CORE_DEBUGGABLE_EXECUTABLES_TARGET),$(name)d-target)
129endif
130
131ART_HOST_EXECUTABLES :=
132ifneq ($(ART_BUILD_HOST_NDEBUG),false)
133ART_HOST_EXECUTABLES += $(foreach name,$(ART_CORE_EXECUTABLES) $(ART_CORE_DEBUGGABLE_EXECUTABLES_HOST),$(name)-host)
134endif
135ifneq ($(ART_BUILD_HOST_DEBUG),false)
136ART_HOST_EXECUTABLES += $(foreach name,$(ART_CORE_DEBUGGABLE_EXECUTABLES_HOST),$(name)d-host)
137endif
138
139# Release ART APEX, included by default in "user" builds.
140RELEASE_ART_APEX := com.android.art
141# Debug ART APEX, included by default in "userdebug" and "eng"
142# builds and used in ART device benchmarking.
143DEBUG_ART_APEX := com.android.art.debug
144# Testing ART APEX, used in ART device testing.
145TESTING_ART_APEX := com.android.art.testing
146
147RUNTIME_APEX := com.android.runtime
148CONSCRYPT_APEX := com.android.conscrypt
149I18N_APEX := com.android.i18n
150STATSD_APEX := com.android.os.statsd
151TZDATA_APEX := com.android.tzdata
152
153# A phony file to create the ICU data file for host.
154HOST_I18N_DATA := $(HOST_OUT)/$(I18N_APEX)/timestamp
155# A phony file to create the tz data file for host.
156HOST_TZDATA_DATA := $(HOST_OUT)/$(TZDATA_APEX)/timestamp
157
158endif # ifeq (true,$(my_art_module_source_build))
159
160endif # ART_ANDROID_COMMON_PATH_MK
161