• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1####################################
2# ART boot image installation
3# Input variables:
4#   my_boot_image_name: the boot image to install
5#   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#
9# Output variables:
10#   my_boot_image_module: the created module name. Empty if no module is created.
11#
12# Install the boot images compiled by Soong.
13# Create a module named dexpreopt_bootjar.$(my_boot_image_name)_$($(my_boot_image_arch))
14# that installs all of boot image files.
15# If there is no file to install for $(my_boot_image_name), for example when
16# building an unbundled build, then no module is created.
17#
18####################################
19
20# Install $(1) to $(2) so that it is shared between architectures.
21# Returns the target path of the shared vdex file and installed symlink.
22define copy-vdex-file
23$(strip \
24  $(eval # Remove the arch dir) \
25  $(eval my_vdex_shared := $(dir $(patsubst %/,%,$(dir $(2))))$(notdir $(2))) \
26  $(if $(filter-out %_2ND_ARCH,$(my_boot_image_arch)), \
27    $(eval # Copy $(1) to directory one level up (i.e. with the arch dir removed).) \
28    $(eval $(call copy-one-file,$(1),$(my_vdex_shared))) \
29  ) \
30  $(eval # Create symlink at $(2) which points to the actual physical copy.) \
31  $(call symlink-file,$(my_vdex_shared),../$(notdir $(2)),$(2)) \
32  $(my_vdex_shared) $(2) \
33)
34endef
35
36# Same as 'copy-many-files' but it uses the vdex-specific helper above.
37define copy-vdex-files
38$(foreach v,$(1),$(call copy-vdex-file,$(call word-colon,1,$(v)),$(2)$(call word-colon,2,$(v))))
39endef
40
41my_boot_image_module :=
42
43my_suffix := $(my_boot_image_name)_$($(my_boot_image_arch))
44my_copy_pairs := $(strip $(DEXPREOPT_IMAGE_BUILT_INSTALLED_$(my_suffix)))
45
46# Generate the boot image module only if there is any file to install.
47ifneq (,$(my_copy_pairs))
48  my_first_pair := $(firstword $(my_copy_pairs))
49  my_rest_pairs := $(wordlist 2,$(words $(my_copy_pairs)),$(my_copy_pairs))
50
51  my_first_src := $(call word-colon,1,$(my_first_pair))
52  my_first_dest := $(my_boot_image_out)$(call word-colon,2,$(my_first_pair))
53
54  my_installed := $(call copy-many-files,$(my_rest_pairs),$(my_boot_image_out))
55  my_installed += $(call copy-vdex-files,$(DEXPREOPT_IMAGE_VDEX_BUILT_INSTALLED_$(my_suffix)),$(my_boot_image_out))
56  my_unstripped_installed := $(call copy-many-files,$(DEXPREOPT_IMAGE_UNSTRIPPED_BUILT_INSTALLED_$(my_suffix)),$(my_boot_image_syms))
57
58  # We don't have a LOCAL_PATH for the auto-generated modules, so let it be the $(BUILD_SYSTEM).
59  LOCAL_PATH := $(BUILD_SYSTEM)
60
61  include $(CLEAR_VARS)
62  LOCAL_MODULE := dexpreopt_bootjar.$(my_suffix)
63  LOCAL_PREBUILT_MODULE_FILE := $(my_first_src)
64  LOCAL_MODULE_PATH := $(dir $(my_first_dest))
65  LOCAL_MODULE_STEM := $(notdir $(my_first_dest))
66  ifneq (,$(strip $(filter HOST_%,$(my_boot_image_arch))))
67    LOCAL_IS_HOST_MODULE := true
68  endif
69  LOCAL_MODULE_CLASS := ETC
70  include $(BUILD_PREBUILT)
71  $(LOCAL_BUILT_MODULE): | $(my_unstripped_installed)
72  # Installing boot.art causes all boot image bits to be installed.
73  # Keep this old behavior in case anyone still needs it.
74  $(LOCAL_INSTALLED_MODULE): $(my_installed)
75  ALL_MODULES.$(my_register_name).INSTALLED += $(my_installed)
76  $(my_all_targets): $(my_installed)
77
78  my_boot_image_module := $(LOCAL_MODULE)
79endif  # my_copy_pairs != empty
80