_sdk_dir := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))

##########################
# Strip input parameters #
##########################

LOCAL_NAME := $(strip $(LOCAL_NAME))
LOCAL_UUID := $(strip $(LOCAL_UUID))
LOCAL_OUT := $(strip $(LOCAL_OUT))

####################################
# Check necessary input parameters #
####################################

ifeq ($(LOCAL_NAME),)
  $(error LOCAL_NAME is not specified)
endif

ifeq ($(LOCAL_UUID),)
  $(error LOCAL_UUID is not specified)
endif

ifeq ($(LOCAL_OUT),)
  LOCAL_OUT := $(abspath ./out)
endif

####################################
# Check of user input parameters   #
####################################

include $(_sdk_dir)/rules-utils.mk
$(call host-sign-rules)

####################################

include $(_sdk_dir)/path-utilities.mk

_local_output_dir := $(call get-absolute-path,$(LOCAL_OUT)/$(LOCAL_TARGET_NAME:=/)host)
_local_output := $(_local_output_dir)/$(LOCAL_NAME)/emul_$(LOCAL_UUID)
_local_input := $(strip $(_local_output_dir)/$(LOCAL_NAME)/$(LOCAL_NAME))

$(_local_input)_sign := cp $(_local_input) $(_local_output)

$(_local_output): $(_local_input)
	$($(<)_sign)
