# 
# Copyright (C) 2006 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=usbfunk
PKG_VERSION:=1.2
PKG_RELEASE:=1

PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/MalteP/usbfunk.git
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=e8d349975b56e8513f72d61551309da65e4361f5
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz

PKG_BUILD_PARALLEL:=1

include $(INCLUDE_DIR)/package.mk

define Package/usbfunk
  SECTION:=utils
  CATEGORY:=Utilities
  DEPENDS:=+libusb-compat
  TITLE:=Utility to control 433MHz wireless remote sockets
  MAINTAINER:=Malte Poeggel <malte@maltepoeggel.de>
endef

define Package/usbfunk/description
 USBFunk is a tiny 433MHz interface to control wireless
 remote sockets with PT2262/72 compatible chipset. This
 package contains its console utility.
 For more information visit maltepoeggel.de/?site=usbfunk
endef

define Build/Compile
	$(TARGET_CC) $(TARGET_CFLAGS) -Wall \
	        -lusb \
		-o $(PKG_BUILD_DIR)/cli/usbfunk $(PKG_BUILD_DIR)/cli/usbfunk.c $(PKG_BUILD_DIR)/cli/main.c
endef

define Package/usbfunk/install
	$(INSTALL_DIR) $(1)/usr/bin
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/cli/usbfunk $(1)/usr/bin/
endef

$(eval $(call BuildPackage,usbfunk))
