blob: 631db0a0f11743f2ac5f4ed6dc61b9a705a11db2 [file] [log] [blame]
Brian Carlstromced4bff2013-11-14 23:44:56 -08001####################################
2# dexpreopt support for ART
3#
4####################################
5
Brian Carlstromced4bff2013-11-14 23:44:56 -08006########################################################################
7# The full system boot classpath
8
Neil Fuller9fb70172018-08-28 13:18:25 +01009LIBART_TARGET_BOOT_JARS := $(DEXPREOPT_BOOT_JARS_MODULES)
Brian Carlstromced4bff2013-11-14 23:44:56 -080010LIBART_TARGET_BOOT_DEX_LOCATIONS := $(foreach jar,$(LIBART_TARGET_BOOT_JARS),/$(DEXPREOPT_BOOT_JAR_DIR)/$(jar).jar)
11LIBART_TARGET_BOOT_DEX_FILES := $(foreach jar,$(LIBART_TARGET_BOOT_JARS),$(call intermediates-dir-for,JAVA_LIBRARIES,$(jar),,COMMON)/javalib.jar)
12
Colin Cross52dcb2f2016-03-08 13:21:49 -080013# dex preopt on the bootclasspath produces multiple files. The first dex file
14# is converted into to boot.art (to match the legacy assumption that boot.art
15# exists), and the rest are converted to boot-<name>.art.
16# In addition, each .art file has an associated .oat file.
Vladimir Markoe47795b2018-09-26 12:57:21 +010017LIBART_TARGET_BOOT_ART_EXTRA_FILES := $(foreach jar,$(wordlist 2,999,$(LIBART_TARGET_BOOT_JARS)),boot-$(jar).art boot-$(jar).oat)
18LIBART_TARGET_BOOT_ART_EXTRA_FILES += boot.oat
bowen_lai4570fdb2017-08-16 16:28:05 +080019LIBART_TARGET_BOOT_ART_VDEX_FILES := $(foreach jar,$(wordlist 2,999,$(LIBART_TARGET_BOOT_JARS)),boot-$(jar).vdex)
20LIBART_TARGET_BOOT_ART_VDEX_FILES += boot.vdex
Colin Cross52dcb2f2016-03-08 13:21:49 -080021
Mathieu Chartiera61acf62017-06-28 18:23:37 -070022# If we use a boot image profile.
23my_use_profile_for_boot_image := $(PRODUCT_USE_PROFILE_FOR_BOOT_IMAGE)
24ifeq (,$(my_use_profile_for_boot_image))
Mathieu Chartier8fd29b32017-10-24 15:22:57 -070025# If not set, set the default to true if we are not a PDK build. PDK builds
26# can't build the profile since they don't have frameworks/base.
27ifneq (true,$(TARGET_BUILD_PDK))
Mathieu Chartierce944942017-08-28 18:42:02 -070028my_use_profile_for_boot_image := true
Mathieu Chartiera61acf62017-06-28 18:23:37 -070029endif
Mathieu Chartier8fd29b32017-10-24 15:22:57 -070030endif
Dan Willemsen406418d2018-06-19 23:03:34 -070031ifeq (,$(strip $(LIBART_TARGET_BOOT_DEX_FILES)))
32my_use_profile_for_boot_image := false
33endif
Mathieu Chartiera61acf62017-06-28 18:23:37 -070034
35ifeq (true,$(my_use_profile_for_boot_image))
36
Shibin George9dd9e682018-07-02 16:21:49 +053037boot_image_profiles := $(PRODUCT_DEX_PREOPT_BOOT_IMAGE_PROFILE_LOCATION)
38
39ifeq (,$(boot_image_profiles))
Mathieu Chartiera61acf62017-06-28 18:23:37 -070040# If not set, use the default.
Shibin George9dd9e682018-07-02 16:21:49 +053041boot_image_profiles := frameworks/base/config/boot-image-profile.txt
Mathieu Chartiera61acf62017-06-28 18:23:37 -070042endif
43
Shibin George9dd9e682018-07-02 16:21:49 +053044# Location of text based profile for the boot image.
45my_boot_image_profile_location := $(PRODUCT_OUT)/dex_bootjars/boot-image-profile.txt
46
47$(my_boot_image_profile_location): $(boot_image_profiles)
48 @echo 'Generating $@ for profman'
49 @rm -rf $@
50 $(hide) cat $^ > $@
51
Mathieu Chartiera61acf62017-06-28 18:23:37 -070052# Code to create the boot image profile, not in dex_preopt_libart_boot.mk since the profile is the same for all archs.
53my_out_boot_image_profile_location := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/boot.prof
54$(my_out_boot_image_profile_location): PRIVATE_PROFILE_INPUT_LOCATION := $(my_boot_image_profile_location)
55$(my_out_boot_image_profile_location): $(PROFMAN) $(LIBART_TARGET_BOOT_DEX_FILES) $(my_boot_image_profile_location)
56 @echo "target profman: $@"
57 @mkdir -p $(dir $@)
58 ANDROID_LOG_TAGS="*:e" $(PROFMAN) \
59 --create-profile-from=$(PRIVATE_PROFILE_INPUT_LOCATION) \
60 $(addprefix --apk=,$(LIBART_TARGET_BOOT_DEX_FILES)) \
61 $(addprefix --dex-location=,$(LIBART_TARGET_BOOT_DEX_LOCATIONS)) \
62 --reference-profile-file=$@
63
64# We want to install the profile even if we are not using preopt since it is required to generate
65# the image on the device.
66my_installed_profile := $(TARGET_OUT)/etc/boot-image.prof
67$(eval $(call copy-one-file,$(my_out_boot_image_profile_location),$(my_installed_profile)))
68ALL_DEFAULT_INSTALLED_MODULES += $(my_installed_profile)
69
70endif
71
bowen_lai4570fdb2017-08-16 16:28:05 +080072LIBART_TARGET_BOOT_ART_VDEX_INSTALLED_SHARED_FILES := $(addprefix $(PRODUCT_OUT)/$(DEXPREOPT_BOOT_JAR_DIR)/,$(LIBART_TARGET_BOOT_ART_VDEX_FILES))
73
Ying Wangb9aa5d42014-05-13 13:57:28 -070074my_2nd_arch_prefix :=
75include $(BUILD_SYSTEM)/dex_preopt_libart_boot.mk
Brian Carlstromced4bff2013-11-14 23:44:56 -080076
Ying Wang87538e42016-03-16 19:53:19 -070077ifneq ($(TARGET_TRANSLATE_2ND_ARCH),true)
Ying Wangb9aa5d42014-05-13 13:57:28 -070078ifdef TARGET_2ND_ARCH
79my_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
80include $(BUILD_SYSTEM)/dex_preopt_libart_boot.mk
Ying Wangb9aa5d42014-05-13 13:57:28 -070081endif
Ying Wang87538e42016-03-16 19:53:19 -070082endif
Brian Carlstromced4bff2013-11-14 23:44:56 -080083
bowen_lai4570fdb2017-08-16 16:28:05 +080084# Copy shared vdex to the directory and create corresponding symlinks in primary and secondary arch.
85$(LIBART_TARGET_BOOT_ART_VDEX_INSTALLED_SHARED_FILES) : PRIMARY_ARCH_DIR := $(dir $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE))
86$(LIBART_TARGET_BOOT_ART_VDEX_INSTALLED_SHARED_FILES) : SECOND_ARCH_DIR := $(dir $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE))
87$(LIBART_TARGET_BOOT_ART_VDEX_INSTALLED_SHARED_FILES) : $(DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME)
88 @echo "Install: $@"
89 @mkdir -p $(dir $@)
90 @rm -f $@
91 $(hide) cp "$(dir $<)$(notdir $@)" "$@"
92 # Make symlink for both the archs. In the case its single arch the symlink will just get overridden.
93 @mkdir -p $(PRIMARY_ARCH_DIR)
94 $(hide) ln -sf /$(DEXPREOPT_BOOT_JAR_DIR)/$(notdir $@) $(PRIMARY_ARCH_DIR)$(notdir $@)
95 @mkdir -p $(SECOND_ARCH_DIR)
96 $(hide) ln -sf /$(DEXPREOPT_BOOT_JAR_DIR)/$(notdir $@) $(SECOND_ARCH_DIR)$(notdir $@)
97
98my_2nd_arch_prefix :=