• 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,$(SOONG_CONFIG_art_module_source_build))
26  my_art_module_source_build := true
27else ifeq (false,$(SOONG_CONFIG_art_module_source_build))
28  my_art_module_source_build := false
29else
30  $(error SOONG_CONFIG_art_module_source_build 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.
67HOST_BOOT_IMAGE_JARS := $(foreach jar,$(CORE_IMG_JARS),$(HOST_OUT)/apex/com.android.art/javalib/$(jar).jar)
68$(HOST_BOOT_IMAGE_JARS): $(HOST_OUT)/apex/com.android.art/javalib/%.jar : $(HOST_OUT_JAVA_LIBRARIES)/%-hostdex.jar
69	$(copy-file-to-target)
70
71HOST_BOOT_IMAGE_JARS += $(HOST_OUT)/apex/com.android.conscrypt/javalib/conscrypt.jar
72$(HOST_OUT)/apex/com.android.conscrypt/javalib/conscrypt.jar : $(HOST_OUT_JAVA_LIBRARIES)/conscrypt-hostdex.jar
73	$(copy-file-to-target)
74HOST_BOOT_IMAGE_JARS += $(HOST_OUT)/apex/com.android.i18n/javalib/core-icu4j.jar
75$(HOST_OUT)/apex/com.android.i18n/javalib/core-icu4j.jar : $(HOST_OUT_JAVA_LIBRARIES)/core-icu4j-hostdex.jar
76	$(copy-file-to-target)
77
78HOST_CORE_IMG_OUTS += $(HOST_BOOT_IMAGE_JARS) $(HOST_BOOT_IMAGE) $(2ND_HOST_BOOT_IMAGE)
79
80HOST_TEST_CORE_JARS   := $(addsuffix -hostdex,$(CORE_IMG_JARS) core-icu4j conscrypt)
81ART_HOST_DEX_DEPENDENCIES := $(foreach jar,$(HOST_TEST_CORE_JARS),$(HOST_OUT_JAVA_LIBRARIES)/$(jar).jar)
82ART_TARGET_DEX_DEPENDENCIES := com.android.art.testing com.android.conscrypt com.android.i18n
83
84ART_CORE_SHARED_LIBRARIES := libjavacore libopenjdk libopenjdkjvm libopenjdkjvmti
85ART_CORE_SHARED_DEBUG_LIBRARIES := libopenjdkd libopenjdkjvmd libopenjdkjvmtid
86ART_HOST_CORE_SHARED_LIBRARIES := $(ART_CORE_SHARED_LIBRARIES) libicuuc-host libicui18n-host libicu_jni
87ART_HOST_SHARED_LIBRARY_DEPENDENCIES := $(foreach lib,$(ART_HOST_CORE_SHARED_LIBRARIES), $(ART_HOST_OUT_SHARED_LIBRARIES)/$(lib)$(ART_HOST_SHLIB_EXTENSION))
88ART_HOST_SHARED_LIBRARY_DEBUG_DEPENDENCIES := $(foreach lib,$(ART_CORE_SHARED_DEBUG_LIBRARIES), $(ART_HOST_OUT_SHARED_LIBRARIES)/$(lib)$(ART_HOST_SHLIB_EXTENSION))
89ifdef HOST_2ND_ARCH
90ART_HOST_SHARED_LIBRARY_DEPENDENCIES += $(foreach lib,$(ART_HOST_CORE_SHARED_LIBRARIES), $(2ND_HOST_OUT_SHARED_LIBRARIES)/$(lib).so)
91ART_HOST_SHARED_LIBRARY_DEBUG_DEPENDENCIES += $(foreach lib,$(ART_CORE_SHARED_DEBUG_LIBRARIES), $(2ND_HOST_OUT_SHARED_LIBRARIES)/$(lib).so)
92endif
93
94# Both the primary and the secondary arches of the libs are built by depending
95# on the module name.
96ART_DEBUG_TARGET_SHARED_LIBRARY_DEPENDENCIES := $(foreach lib,$(ART_CORE_SHARED_LIBRARIES), $(lib).com.android.art.debug)
97ART_TARGET_SHARED_LIBRARY_DEBUG_DEPENDENCIES := $(foreach lib,$(ART_CORE_SHARED_DEBUG_LIBRARIES), $(TARGET_OUT_SHARED_LIBRARIES)/$(lib).so)
98ifdef TARGET_2ND_ARCH
99ART_TARGET_SHARED_LIBRARY_DEBUG_DEPENDENCIES += $(foreach lib,$(ART_CORE_SHARED_DEBUG_LIBRARIES), $(2ND_TARGET_OUT_SHARED_LIBRARIES)/$(lib).so)
100endif
101
102ART_CORE_DEBUGGABLE_EXECUTABLES := \
103    dex2oat \
104    dexoptanalyzer \
105    imgdiag \
106    oatdump \
107    odrefresh \
108    profman \
109
110ART_CORE_EXECUTABLES := \
111    dalvikvm \
112    dexlist \
113
114# Depend on the -target or -host phony targets generated by the build system
115# for each module
116ART_TARGET_EXECUTABLES :=
117ifneq ($(ART_BUILD_TARGET_NDEBUG),false)
118ART_TARGET_EXECUTABLES += $(foreach name,$(ART_CORE_EXECUTABLES) $(ART_CORE_DEBUGGABLE_EXECUTABLES),$(name)-target)
119endif
120ifneq ($(ART_BUILD_TARGET_DEBUG),false)
121ART_TARGET_EXECUTABLES += $(foreach name,$(ART_CORE_DEBUGGABLE_EXECUTABLES),$(name)d-target)
122endif
123
124ART_HOST_EXECUTABLES :=
125ifneq ($(ART_BUILD_HOST_NDEBUG),false)
126ART_HOST_EXECUTABLES += $(foreach name,$(ART_CORE_EXECUTABLES) $(ART_CORE_DEBUGGABLE_EXECUTABLES),$(name)-host)
127endif
128ifneq ($(ART_BUILD_HOST_DEBUG),false)
129ART_HOST_EXECUTABLES += $(foreach name,$(ART_CORE_DEBUGGABLE_EXECUTABLES),$(name)d-host)
130endif
131
132# Release ART APEX, included by default in "user" builds.
133RELEASE_ART_APEX := com.android.art
134# Debug ART APEX, included by default in "userdebug" and "eng"
135# builds and used in ART device benchmarking.
136DEBUG_ART_APEX := com.android.art.debug
137# Testing ART APEX, used in ART device testing.
138TESTING_ART_APEX := com.android.art.testing
139
140RUNTIME_APEX := com.android.runtime
141CONSCRYPT_APEX := com.android.conscrypt
142I18N_APEX := com.android.i18n
143STATSD_APEX := com.android.os.statsd
144TZDATA_APEX := com.android.tzdata
145
146# A phony file to create the ICU data file for host.
147HOST_I18N_DATA := $(HOST_OUT)/$(I18N_APEX)/timestamp
148# A phony file to create the tz data file for host.
149HOST_TZDATA_DATA := $(HOST_OUT)/$(TZDATA_APEX)/timestamp
150
151endif # ifeq (true,$(my_art_module_source_build))
152
153endif # ART_ANDROID_COMMON_PATH_MK
154