include $(TOPDIR)/rules.mk

VERSION_YEAR=$(shell date +%Y)
VERSION_MAJOR=$(shell expr $(VERSION_YEAR) - 2018)
VERSION_MINOR=$(shell date +%V%u)
#VERSION_REVISION=$(shell date +%H%M)
VERSION_REVISION=0000
PKG_VERSION:=$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_REVISION)

PKG_NAME:=pcs_dev_virtual

include $(INCLUDE_DIR)/package.mk

define Package/pcs_dev_virtual
	SECTION:=DYIOT
	CATEGORY:=DYIOT Software
	TITLE:=ems ctrl support
	DEPENDS:=+libuci +libdyutils +libubox +libmodbus_dy +libipc_session +ubuslog
endef

define Package/pcs_dev_virtual/description
	ems ctrl service support
endef

define Build/Prepare
	mkdir -p $(PKG_BUILD_DIR)
	$(CP) ./src/* $(PKG_BUILD_DIR)/
endef

define Package/pcs_dev_virtual/install
	$(INSTALL_DIR) $(1)/app/
	$(INSTALL_DIR) $(1)/etc/
	$(INSTALL_DIR) $(1)/etc/init.d/
	$(INSTALL_DIR) $(1)/app/config/ems/
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/pcs_dev_virtual $(1)/app/
	$(INSTALL_BIN) ./files/pcs_dev_virtual $(1)/etc/init.d/
	$(INSTALL_CONF) ./files/*.json $(1)/app/config/ems/
endef

define Package/pcs_dev_virtual/conffiles
/app/config/ems/pcs_dev.json
endef

$(eval $(call BuildPackage,pcs_dev_virtual))

