blob: 12b29f4ad7b84ff156efd0f8ff345b7c97368bbc [file] [log] [blame]
Brian Carlstromced4bff2013-11-14 23:44:56 -08001####################################
Nicolas Geoffray269bc742019-02-22 15:33:23 +00002# ART boot image installation
David Srbecky6dd11ec2020-02-11 13:46:45 +00003# Input variables:
Nicolas Geoffray269bc742019-02-22 15:33:23 +00004# my_boot_image_name: the boot image to install
David Srbecky6dd11ec2020-02-11 13:46:45 +00005# my_boot_image_arch: the architecture to install (e.g. TARGET_ARCH, not expanded)
6# my_boot_image_out: the install directory (e.g. $(PRODUCT_OUT))
7# my_boot_image_syms: the symbols director (e.g. $(TARGET_OUT_UNSTRIPPED))
8# my_boot_image_root: make variable used to store installed image path
Brian Carlstromced4bff2013-11-14 23:44:56 -08009#
10####################################
11
David Srbecky6dd11ec2020-02-11 13:46:45 +000012# Install $(1) to $(2) so that it is shared between architectures.
13define copy-vdex-file
14my_vdex_shared := $$(dir $$(patsubst %/,%,$$(dir $(2))))$$(notdir $(2)) # Remove the arch dir.
15ifneq ($(my_boot_image_arch),$(filter $(my_boot_image_arch), TARGET_2ND_ARCH HOST_2ND_ARCH))
16$$(my_vdex_shared): $(1) # Copy $(1) to directory one level up (i.e. with the arch dir removed).
17 @echo "Install: $$@"
18 $$(copy-file-to-target)
19endif
20$(2): $$(my_vdex_shared) # Create symlink at $(2) which points to the actual physical copy.
21 @echo "Symlink: $$@"
22 mkdir -p $$(dir $$@)
23 ln -sfn ../$$(notdir $$@) $$@
24my_vdex_shared :=
25endef
26
27# Same as 'copy-many-files' but it uses the vdex-specific helper above.
28define copy-vdex-files
29$(foreach v,$(1),$(eval $(call copy-vdex-file, $(call word-colon,1,$(v)), $(2)$(call word-colon,2,$(v)))))
30$(foreach v,$(1),$(2)$(call word-colon,2,$(v)))
31endef
32
33# Install the boot images compiled by Soong.
34# The first file is saved in $(my_boot_image_root) and the rest are added as it's dependencies.
35my_suffix := BUILT_INSTALLED_$(my_boot_image_name)_$($(my_boot_image_arch))
36my_installed := $(call copy-many-files,$(DEXPREOPT_IMAGE_$(my_suffix)),$(my_boot_image_out))
37my_installed += $(call copy-many-files,$(DEXPREOPT_IMAGE_UNSTRIPPED_$(my_suffix)),$(my_boot_image_syms))
38my_installed += $(call copy-vdex-files,$(DEXPREOPT_IMAGE_VDEX_$(my_suffix)),$(my_boot_image_out))
39$(my_boot_image_root) += $(firstword $(my_installed))
Colin Cross47e384c2019-02-11 14:25:13 -080040$(firstword $(my_installed)): $(wordlist 2,9999,$(my_installed))
Colin Cross47e384c2019-02-11 14:25:13 -080041my_installed :=
David Srbecky6dd11ec2020-02-11 13:46:45 +000042my_suffix :=