LOCAL_PATH := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))

LOCAL_NAME := $(LOCAL_UUID)_$(LOCAL_CHIP)_tbase_drv_gp_tee

include $(_sdk_dir)/../source/gp-api/tee-tbase-common.mk

include $(_sdk_dir)/../source/gp-api/crypto.mk

LOCAL_SRC_C := tee/tbase-driver/tee_sys.c \
               tee/tbase-driver/tees_mem.c \
               tee/tbase-driver/tee_time.c \
               tee/tbase-driver/tees_log.c \
               tee/tbase-driver/tees_secure_object.c \
               protocol/tee_param_utils.c \
               tee/tbase-driver/persistent_object.c \
               tee/tbase-driver/tl_main.c \
               uuid_utils/uuid_utils.c \
               persistent_object/persistent_object_api.c \
               persistent_object/serialise_attr.c \
               persistent_time/tee_persistent_time.c \
               tee/tbase-driver/driver_task_ipch.c \
               tee/tbase-driver/driver_task_dcih.c \
               tee/tbase-driver/driver_task_exch.c \
               log_utils/log_utils.c \
               tee/tbase-driver/tee_cancel.c \
               cancellation_func/tee_cancel.c \
               tee/stubs/tees_rpmb.c \
               crypto/kdf/tees_kdf_tbase.c \
               $(CRYPTO_SRC)

# GP API properties ported from Blowfish
_gpapi_include_dirs := prop/src \
                       prop/tee \
                       prop/inc \
                       prop/tee/non-blowfish-include \
                       ../../include/gp-ext \
                       $(CRYPTO_INCLUDE_DIRS)

LOCAL_SRC_C += prop/src/property.c \
               prop/src/tee_string.c \
               prop/src/uuid.c

include $(_sdk_dir)/uuid-utils.mk

TA_UUID_STRUCT = $(strip $(call get-local-uuid-as-struct,$(LOCAL_UUID)))
TA_GROUP_ID = $(LOCAL_GROUP_ID)
LOCAL_CFLAGS += -DYOUR_TA_UUID='$(TA_UUID_STRUCT)' -DYOUR_GROUP_ID=\"$(TA_GROUP_ID)\" \
                -DTBASE_APP_NAME=\"$(LOCAL_TBASE_APP_NAME)\" $(CRYPTO_CFLAGS)
ifeq ($(LOCAL_FIPS_CRYPTO),y)
    LOCAL_CFLAGS += -DBORING_SSL
else
    _gpapi_include_dirs += ../../prebuilt/arm/cryptocore/include
endif

_import_include_dirs := $(LOCAL_INCLUDE_DIRS)
LOCAL_INCLUDE_DIRS := $(_gpapi_include_dirs) $(_import_include_dirs)

include $(BUILD_TBASE_LIBRARY)
