update to use common mk file for ta compiling and variant importing

import necessary variants and definition of BUILD_OPTEE_OS for xtest,
and update to use common mk file to generate TA files

Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
diff --git a/Android.mk b/Android.mk
index 4c68e2b..7b2ee64 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1,5 +1,11 @@
 LOCAL_PATH := $(call my-dir)
 
+## include variants like TA_DEV_KIT_DIR
+## and target of BUILD_OPTEE_OS
+INCLUDE_FOR_BUILD_TA := false
+include $(BUILD_OPTEE_MK)
+INCLUDE_FOR_BUILD_TA :=
+
 VERSION = $(shell git describe --always --dirty=-dev 2>/dev/null || echo Unknown)
 OPTEE_CLIENT_PATH ?= $(LOCAL_PATH)/../optee_client
 
@@ -59,6 +65,11 @@
 LOCAL_CFLAGS += -DTA_DIR=\"/system/lib/optee_armtz\"
 LOCAL_CFLAGS += -pthread
 
+## target BUILD_OPTEE_OS is defined in the common ta build
+## mk file included before, and this BUILD_OPTEE_OS will
+## help to generate the header files under $(TA_DEV_KIT_DIR)/host_include
+LOCAL_ADDITIONAL_DEPENDENCIES := BUILD_OPTEE_OS
+
 include $(BUILD_EXECUTABLE)
 
 include $(LOCAL_PATH)/ta/Android.mk