vendor/etc/linker.config.pb from multiple input files
When we have dedicated .mk files for each modules (e.g. usb, drm, etc)
and those modules have their own linker configuration requirements, it
would make more sense to have "fragments" for linker configuration.
This change introduces a new list variable to store the list of linker
configuration fragments. When it's set, vendor/etc/linker.config.pb is
generated from the list of input fragments.
Bug: 264330513
Test: set PRODUCT_VENDOR_LINKER_CONFIG_FRAGMENTS
Test: m vendorimage (generates vendor/etc/linker.config.pb)
Change-Id: I9eed0f90add0191885b7195efdab94b5b1a4a62d
diff --git a/core/Makefile b/core/Makefile
index 7a9dfe8..b5f5b35 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -3492,6 +3492,18 @@
INTERNAL_VENDORIMAGE_FILES += $(call create-partition-compat-symlink,$(TARGET_OUT_VENDOR)/lib/modules,/vendor_dlkm/lib/modules,vendor_dlkm.img)
endif
+# Install vendor/etc/linker.config.pb when PRODUCT_VENDOR_LINKER_CONFIG_FRAGMENTS is set
+ifneq ($(strip $(PRODUCT_VENDOR_LINKER_CONFIG_FRAGMENTS)),)
+vendor_linker_config_file := $(TARGET_OUT_VENDOR)/etc/linker.config.pb
+$(vendor_linker_config_file): private_linker_config_fragments := $(PRODUCT_VENDOR_LINKER_CONFIG_FRAGMENTS)
+$(vendor_linker_config_file): $(PRODUCT_VENDOR_LINKER_CONFIG_FRAGMENTS) | $(HOST_OUT_EXECUTABLES)/conv_linker_config
+ $(HOST_OUT_EXECUTABLES)/conv_linker_config proto \
+ --source $(call normalize-path-list,$(private_linker_config_fragments)) \
+ --output $@
+$(call define declare-0p-target,$(vendor_linker_config_file),)
+INTERNAL_VENDORIMAGE_FILES += $(vendor_linker_config_file)
+endif
+
INSTALLED_FILES_FILE_VENDOR := $(PRODUCT_OUT)/installed-files-vendor.txt
INSTALLED_FILES_JSON_VENDOR := $(INSTALLED_FILES_FILE_VENDOR:.txt=.json)
$(INSTALLED_FILES_FILE_VENDOR): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_VENDOR)