]> git.zerfleddert.de Git - hmcfgusb/blobdiff - Makefile
hmsniff: add two more message types
[hmcfgusb] / Makefile
index bd8fbf73feb010efa1d0d135672a6beec904eead..0cf13bd31b91a9bec1d7eec15bc8e366f46464df 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,6 @@
+ifeq ($(OPENWRT_BUILD),)
+
+#Normal system
 CFLAGS=-MMD -O2 -Wall -I/opt/local/include -g
 LDFLAGS=-L/opt/local/lib
 LDLIBS=-lusb-1.0 -lrt
@@ -27,3 +30,62 @@ clean:
        rm -f $(HMLAN_OBJS) $(HMSNIFF_OBJS) $(FLASH_HMCFGUSB_OBJS) $(FLASH_OTA_OBJS) $(DEPEND) hmland hmsniff flash-hmcfgusb flash-ota
 
 .PHONY: all clean
+
+else
+
+#OpenWRT/LEDE
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=hmcfgusb
+PKG_VERSION:=$(shell grep 'VERSION' version.h | cut -d'"' -f 2)
+PKG_RELEASE:=1
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/hmcfgusb
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libusb-1.0
+  TITLE:=HM-CFG-USB utilities
+endef
+
+define Build/Prepare
+       mkdir -p $(PKG_BUILD_DIR)
+       $(CP) ./* $(PKG_BUILD_DIR)/
+       $(SED) 's/OPENWRT_BUILD/DISABLED_CHECK_FOR_OPENWRT_TO_USE_CORRECT_BLOCK_NOW/' $(PKG_BUILD_DIR)/Makefile
+endef
+
+define Package/hmcfgusb/install
+       $(INSTALL_DIR) $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/hmland $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/hmsniff $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/flash-hmcfgusb $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/flash-ota $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc/init.d/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/init.hmland.OpenWRT $(1)/etc/init.d/hmland
+endef
+
+define Package/hmcfgusb/postinst
+#!/bin/sh
+# check if we are on real system
+if [ -z "$${IPKG_INSTROOT}" ]; then
+       echo "Enabling rc.d symlink for hmland"
+       /etc/init.d/hmland enable
+fi
+exit 0
+endef
+
+define Package/hmcfgusb/prerm
+#!/bin/sh
+# check if we are on real system
+if [ -z "$${IPKG_INSTROOT}" ]; then
+       echo "Removing rc.d symlink for hmland"
+       /etc/init.d/hmland disable
+fi
+exit 0
+endef
+
+$(eval $(call BuildPackage,hmcfgusb))
+endif
Impressum, Datenschutz