# Copyright 2019 University of Warsaw

include $(TOPDIR)/rules.mk

PKG_NAME:=get-current
PKG_VERSION:=1.0.0
PKG_RELEASE:=1
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=License

include $(INCLUDE_DIR)/package.mk

define Package/get-current
	SECTION:=heni
	CATEGORY:=HENI
	TITLE:=Current reader
	DEPENDS:=+libpthread
endef

define Package/get-current/description
  Program for reading the current value consumed by Node in Ampers.
  It uses icount and the calibrates its output.
endef

define Build/Prepare
	mkdir -p $(PKG_BUILD_DIR)
endef

define Build/Compile
	$(TARGET_CC) $(TARGET_CFLAGS) -std=c99 -o $(PKG_BUILD_DIR)/get-current src/get-current.c -lm
endef

define Package/get-current/install
	$(INSTALL_DIR) $(1)/usr/bin
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/get-current $(1)/usr/bin/get-current
endef

$(eval $(call BuildPackage,get-current))
