platform_build/core/local_vndk.mk
Justin Yun 69f7191d5d Define __ANDROID_VENDOR__ and __ANDROID_PRODUCT__
__ANDROID_VNDK__ is defined for the modules that are able to use the
VNDK libraries. As both product and vendor variants define
__ANDROID_VNDK__, we don't know if a module is built for vendor or
product on build time.

__ANDROID_VENDOR__ and __ANDROID_PRODUCT__ macros can be used to
specify the image-variant-dependent codes.

Bug: 180646847
Test: m nothing
Change-Id: I9a37607b1e1e4e16eab02fb6c96d1a92158c96b8
2021-03-15 18:17:35 +09:00

48 lines
1.6 KiB
Makefile

#Set LOCAL_USE_VNDK for modules going into product, vendor or odm partition, except for host modules
#If LOCAL_SDK_VERSION is set, thats a more restrictive set, so they dont need LOCAL_USE_VNDK
ifndef LOCAL_IS_HOST_MODULE
ifndef LOCAL_SDK_VERSION
ifneq (,$(filter true,$(LOCAL_VENDOR_MODULE) $(LOCAL_ODM_MODULE) $(LOCAL_OEM_MODULE) $(LOCAL_PROPRIETARY_MODULE)))
LOCAL_USE_VNDK:=true
LOCAL_USE_VNDK_VENDOR:=true
# Note: no need to check LOCAL_MODULE_PATH* since LOCAL_[VENDOR|ODM|OEM]_MODULE is already
# set correctly before this is included.
endif
ifdef PRODUCT_PRODUCT_VNDK_VERSION
# Product modules also use VNDK when PRODUCT_PRODUCT_VNDK_VERSION is defined.
ifeq (true,$(LOCAL_PRODUCT_MODULE))
LOCAL_USE_VNDK:=true
LOCAL_USE_VNDK_PRODUCT:=true
endif
endif
endif
endif
# Verify LOCAL_USE_VNDK usage, and set LOCAL_SDK_VERSION if necessary
ifdef LOCAL_IS_HOST_MODULE
ifdef LOCAL_USE_VNDK
$(shell echo $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): Do not use LOCAL_USE_VNDK with host modules >&2)
$(error done)
endif
endif
ifdef LOCAL_USE_VNDK
ifneq ($(LOCAL_USE_VNDK),true)
$(shell echo '$(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): LOCAL_USE_VNDK must be "true" or empty, not "$(LOCAL_USE_VNDK)"' >&2)
$(error done)
endif
ifdef LOCAL_SDK_VERSION
$(shell echo $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): LOCAL_USE_VNDK must not be used with LOCAL_SDK_VERSION >&2)
$(error done)
endif
# If we're not using the VNDK, drop all restrictions
ifndef BOARD_VNDK_VERSION
LOCAL_USE_VNDK:=
LOCAL_USE_VNDK_VENDOR:=
LOCAL_USE_VNDK_PRODUCT:=
endif
endif