1ifneq ($(filter $(YOUR_DEVICE_NAME),$(TARGET_DEVICE)),)
2
3
4VNDK_SP_LIBRARIES := ##_VNDK_SP_##
5
6VNDK_SP_EXT_LIBRARIES := ##_VNDK_SP_EXT_##
7
8EXTRA_VENDOR_LIBRARIES := ##_EXTRA_VENDOR_LIBS_##
9
10# FIXME: Generate INSTALL_IN_HW_SUBDIR automatically
11INSTALL_IN_HW_SUBDIR := android.hidl.memory@1.0-impl
12
13
14#-------------------------------------------------------------------------------
15# VNDK Modules
16#-------------------------------------------------------------------------------
17
18# Start from Android P, VNDK directory will always be versioned.
19ifdef PLATFORM_VNDK_VERSION
20VNDK_SP_DIR := vndk-sp-$(PLATFORM_VNDK_VERSION)
21else
22VNDK_SP_DIR := vndk-sp
23endif
24
25LOCAL_PATH := $(call my-dir)
26
27define define-vndk-lib
28include $$(CLEAR_VARS)
29LOCAL_MODULE := $1.$2
30LOCAL_MODULE_CLASS := SHARED_LIBRARIES
31LOCAL_PREBUILT_MODULE_FILE := $$(TARGET_OUT_INTERMEDIATE_LIBRARIES)/$1.so
32LOCAL_STRIP_MODULE := false
33LOCAL_MULTILIB := first
34LOCAL_MODULE_TAGS := optional
35LOCAL_INSTALLED_MODULE_STEM := $1.so
36LOCAL_MODULE_SUFFIX := .so
37LOCAL_MODULE_RELATIVE_PATH := $3$(if $(filter $1,$(INSTALL_IN_HW_SUBDIR)),/hw)
38LOCAL_VENDOR_MODULE := $4
39include $$(BUILD_PREBUILT)
40
41ifneq ($$(TARGET_2ND_ARCH),)
42ifneq ($$(TARGET_TRANSLATE_2ND_ARCH),true)
43include $$(CLEAR_VARS)
44LOCAL_MODULE := $1.$2
45LOCAL_MODULE_CLASS := SHARED_LIBRARIES
46LOCAL_PREBUILT_MODULE_FILE := $$($$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES)/$1.so
47LOCAL_STRIP_MODULE := false
48LOCAL_MULTILIB := 32
49LOCAL_MODULE_TAGS := optional
50LOCAL_INSTALLED_MODULE_STEM := $1.so
51LOCAL_MODULE_SUFFIX := .so
52LOCAL_MODULE_RELATIVE_PATH := $3$(if $(filter $1,$(INSTALL_IN_HW_SUBDIR)),/hw)
53LOCAL_VENDOR_MODULE := $4
54include $$(BUILD_PREBUILT)
55endif  # TARGET_TRANSLATE_2ND_ARCH is not true
56endif  # TARGET_2ND_ARCH is not empty
57endef
58
59$(foreach lib,$(VNDK_SP_LIBRARIES),\
60    $(eval $(call define-vndk-lib,$(lib),vndk-sp-gen,$(VNDK_SP_DIR),)))
61$(foreach lib,$(VNDK_SP_EXT_LIBRARIES),\
62    $(eval $(call define-vndk-lib,$(lib),vndk-sp-ext-gen,$(VNDK_SP_DIR),true)))
63$(foreach lib,$(EXTRA_VENDOR_LIBRARIES),\
64    $(eval $(call define-vndk-lib,$(lib),vndk-ext-gen,,true)))
65
66VNDK_SP_DIR :=
67
68
69#-------------------------------------------------------------------------------
70# Phony Package
71#-------------------------------------------------------------------------------
72
73include $(CLEAR_VARS)
74LOCAL_MODULE := $(YOUR_DEVICE_NAME)-vndk
75LOCAL_MODULE_TAGS := optional
76LOCAL_REQUIRED_MODULES := \
77    $(addsuffix .vndk-sp-gen,$(VNDK_SP_LIBRARIES)) \
78    $(addsuffix .vndk-sp-ext-gen,$(VNDK_SP_EXT_LIBRARIES)) \
79    $(addsuffix .vndk-ext-gen,$(EXTRA_VENDOR_LIBRARIES))
80include $(BUILD_PHONY_PACKAGE)
81
82# Unset variables
83VNDK_SP_LIBRARIES :=
84VNDK_SP_EXT_LIBRARIES :=
85EXTRA_VENDOR_LIBRARIES :=
86INSTALL_IN_HW_SUBDIR :=
87
88endif  # ifneq ($(filter $(YOUR_DEVICE_NAME),$(TARGET_DEVICE)),)
89