ifneq ($(CONFIG_DEPLOY_TARGET),)
  DEPLOY_TARGET := $(CONFIG_DEPLOY_TARGET)
  DEPLOY_PLATFORM := $(notdir $(DEPLOY_TARGET))
else
  ifneq ($(_global_target_names),)
    _target := $(strip $(_global_target_names))
    _platform := $(strip $(_global_target_$(_target)_platforms))
    ifneq ($(words $(_target)) $(words $(_platform)), 1 1)
      $(warning Can't auto detect deploy target due to multiple build targets or platforms)
    else
      DEPLOY_PLATFORM := $(_platform)
      DEPLOY_TARGET := $(_target)/$(_platform)
    endif
  endif
endif

ifneq ($(DEPLOY_TARGET),)
  export DEPLOY_TARGET := $(DEPLOY_TARGET)
  export DEPLOY_PLATFORM := $(DEPLOY_PLATFORM)
endif