Add basic VNDK support in Make
Add BOARD_VNDK_VERSION and LOCAL_USE_VNDK to specify the version of the
VNDK that will be used globally, and whether to use the VNDK on a module
basis.
If the board is using the VNDK:
* LOCAL_COPY_HEADERS may only be used by modules defining LOCAL_USE_VNDK
* LOCAL_USE_VNDK modules will compile against the NDK headers and stub
libraries, but continue to use the platform libc++.
* LOCAL_USE_VNDK modules will not have the global includes like
system/core/include, but it will use device-specific kernel headers.
This change does not attempt to enforce any linking constraints, that
will come in a later patch.
Test: out/build-aosp_arm.ninja is identical before/after
Change-Id: Icce65d4974f085093d500b5b2516983788fe2905
diff --git a/core/local_vndk.mk b/core/local_vndk.mk
new file mode 100644
index 0000000..f81249b
--- /dev/null
+++ b/core/local_vndk.mk
@@ -0,0 +1,25 @@
+# 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:=
+ endif
+endif
+