From 543ade588afc31cbf833450033679e77f537c878 Mon Sep 17 00:00:00 2001 From: Sebastiano Barezzi Date: Mon, 29 Apr 2024 01:36:40 +0200 Subject: [PATCH] compat: interfaces: backend: radio: config: Use a macro to declare the libs Change-Id: I03251612315270d15474b740078ada17e17e522d --- interfaces/_backend/radio/config/Android.mk | 69 ++++++--------------- 1 file changed, 18 insertions(+), 51 deletions(-) diff --git a/interfaces/_backend/radio/config/Android.mk b/interfaces/_backend/radio/config/Android.mk index 0d3b98b..758a4dc 100644 --- a/interfaces/_backend/radio/config/Android.mk +++ b/interfaces/_backend/radio/config/Android.mk @@ -18,58 +18,25 @@ else _lib_dir := lib endif -include $(CLEAR_VARS) -_version := 1.0 -_sed_pattern := "s|$(_frontend_hidl_package_name)@$(_version)::$(_frontend_hidl_interface_name)|$(_backend_hidl_package_name)@$(_version)::$(_backend_hidl_interface_name)|g;s|$(_frontend_hidl_package_name)(@1\.[0-9]\.so)|$(_shim_hidl_library_name)\1|g" +define _shim_hidl_library_template + _version := $(1) + _sed_pattern := "s|$$(_frontend_hidl_package_name)@$$(_version)::$$(_frontend_hidl_interface_name)|$$(_backend_hidl_package_name)@$$(_version)::$$(_backend_hidl_interface_name)|g;s|$$(_frontend_hidl_package_name)(@[0-9]+\.[0-9]+\.so)|$$(_shim_hidl_library_name)\1|g" -LOCAL_MODULE := $(_shim_hidl_library_name)@$(_version) -LOCAL_MODULE_STEM := $(LOCAL_MODULE).so -LOCAL_MODULE_CLASS := DATA -LOCAL_MODULE_TAGS := optional -LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/$(_lib_dir) -LOCAL_REQUIRED_MODULES := $(_frontend_hidl_package_name)@$(_version).vendor -LOCAL_PREBUILT_MODULE_FILE := $(TARGET_OUT_VENDOR)/$(_lib_dir)/$(_frontend_hidl_package_name)@$(_version).so -LOCAL_POST_INSTALL_CMD := /usr/bin/sed -E -i $(_sed_pattern) $(LOCAL_MODULE_PATH)/$(LOCAL_MODULE_STEM) -include $(BUILD_PREBUILT) + include $$(CLEAR_VARS) -include $(CLEAR_VARS) -_version := 1.1 -_sed_pattern := "s|$(_frontend_hidl_package_name)@$(_version)::$(_frontend_hidl_interface_name)|$(_backend_hidl_package_name)@$(_version)::$(_backend_hidl_interface_name)|g;s|$(_frontend_hidl_package_name)(@1\.[0-9]\.so)|$(_shim_hidl_library_name)\1|g" + LOCAL_MODULE := $$(_shim_hidl_library_name)@$$(_version) -LOCAL_MODULE := $(_shim_hidl_library_name)@$(_version) -LOCAL_MODULE_STEM := $(LOCAL_MODULE).so -LOCAL_MODULE_CLASS := DATA -LOCAL_MODULE_TAGS := optional -LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/$(_lib_dir) -LOCAL_REQUIRED_MODULES := $(_frontend_hidl_package_name)@$(_version).vendor -LOCAL_PREBUILT_MODULE_FILE := $(TARGET_OUT_VENDOR)/$(_lib_dir)/$(_frontend_hidl_package_name)@$(_version).so -LOCAL_POST_INSTALL_CMD := /usr/bin/sed -E -i $(_sed_pattern) $(LOCAL_MODULE_PATH)/$(LOCAL_MODULE_STEM) -include $(BUILD_PREBUILT) + LOCAL_MODULE_STEM := $$(LOCAL_MODULE).so + LOCAL_MODULE_CLASS := DATA + LOCAL_MODULE_TAGS := optional + LOCAL_MODULE_PATH := $$(TARGET_OUT_VENDOR)/$$(_lib_dir) + LOCAL_REQUIRED_MODULES := $$(_frontend_hidl_package_name)@$$(_version).vendor + LOCAL_PREBUILT_MODULE_FILE := $$(TARGET_OUT_VENDOR)/$$(_lib_dir)/$$(_frontend_hidl_package_name)@$$(_version).so + LOCAL_POST_INSTALL_CMD := /usr/bin/sed -E -i $$(_sed_pattern) $$(LOCAL_MODULE_PATH)/$$(LOCAL_MODULE_STEM) + include $$(BUILD_PREBUILT) +endef -include $(CLEAR_VARS) -_version := 1.2 -_sed_pattern := "s|$(_frontend_hidl_package_name)@$(_version)::$(_frontend_hidl_interface_name)|$(_backend_hidl_package_name)@$(_version)::$(_backend_hidl_interface_name)|g;s|$(_frontend_hidl_package_name)(@1\.[0-9]\.so)|$(_shim_hidl_library_name)\1|g" - -LOCAL_MODULE := $(_shim_hidl_library_name)@$(_version) -LOCAL_MODULE_STEM := $(LOCAL_MODULE).so -LOCAL_MODULE_CLASS := DATA -LOCAL_MODULE_TAGS := optional -LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/$(_lib_dir) -LOCAL_REQUIRED_MODULES := $(_frontend_hidl_package_name)@$(_version).vendor -LOCAL_PREBUILT_MODULE_FILE := $(TARGET_OUT_VENDOR)/$(_lib_dir)/$(_frontend_hidl_package_name)@$(_version).so -LOCAL_POST_INSTALL_CMD := /usr/bin/sed -E -i $(_sed_pattern) $(LOCAL_MODULE_PATH)/$(LOCAL_MODULE_STEM) -include $(BUILD_PREBUILT) - -include $(CLEAR_VARS) -_version := 1.3 -_sed_pattern := "s|$(_frontend_hidl_package_name)@$(_version)::$(_frontend_hidl_interface_name)|$(_backend_hidl_package_name)@$(_version)::$(_backend_hidl_interface_name)|g;s|$(_frontend_hidl_package_name)(@1\.[0-9]\.so)|$(_shim_hidl_library_name)\1|g" - -LOCAL_MODULE := $(_shim_hidl_library_name)@$(_version) -LOCAL_MODULE_STEM := $(LOCAL_MODULE).so -LOCAL_MODULE_CLASS := DATA -LOCAL_MODULE_TAGS := optional -LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/$(_lib_dir) -LOCAL_REQUIRED_MODULES := $(_frontend_hidl_package_name)@$(_version).vendor -LOCAL_PREBUILT_MODULE_FILE := $(TARGET_OUT_VENDOR)/$(_lib_dir)/$(_frontend_hidl_package_name)@$(_version).so -LOCAL_POST_INSTALL_CMD := /usr/bin/sed -E -i $(_sed_pattern) $(LOCAL_MODULE_PATH)/$(LOCAL_MODULE_STEM) -include $(BUILD_PREBUILT) +$(eval $(call _shim_hidl_library_template,1.0)) +$(eval $(call _shim_hidl_library_template,1.1)) +$(eval $(call _shim_hidl_library_template,1.2)) +$(eval $(call _shim_hidl_library_template,1.3))