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/copy_headers.mk b/core/copy_headers.mk
index 417a76c..a4fd2ed 100644
--- a/core/copy_headers.mk
+++ b/core/copy_headers.mk
@@ -1,3 +1,4 @@
+ifneq (,$(strip $(LOCAL_COPY_HEADERS)))
 ###########################################################
 ## Copy headers to the install tree
 ###########################################################
@@ -8,6 +9,25 @@
   my_prefix := TARGET_
 endif
 
+# Modules linking against the SDK do not have the include path to use
+# COPY_HEADERS, so prevent them from exporting any either.
+ifdef LOCAL_SDK_VERSION
+$(shell echo $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): Modules using LOCAL_SDK_VERSION may not use LOCAL_COPY_HEADERS >&2)
+$(error done)
+endif
+
+include $(BUILD_SYSTEM)/local_vndk.mk
+
+# If we're using the VNDK, only vendor modules using the VNDK may use
+# LOCAL_COPY_HEADERS. Platform libraries will not have the include path
+# present.
+ifdef BOARD_VNDK_VERSION
+ifndef LOCAL_USE_VNDK
+$(shell echo $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): Only vendor modules using LOCAL_USE_VNDK may use LOCAL_COPY_HEADERS >&2)
+$(error done)
+endif
+endif
+
 # Create a rule to copy each header, and make the
 # all_copied_headers phony target depend on each
 # destination header.  copy-one-header defines the
@@ -26,3 +46,5 @@
  )
 _chFrom :=
 _chTo :=
+
+endif # LOCAL_COPY_HEADERS