]> git.zerfleddert.de Git - hmcfgusb/blame - Makefile
hmsniff: fix length-byte from HM-MOD-UART
[hmcfgusb] / Makefile
CommitLineData
74058b00
MG
1ifeq ($(OPENWRT_BUILD),)
2
3#Normal system
9db2e455 4CFLAGS=-MMD -O2 -Wall -I/opt/local/include -g
bbbfeb45 5LDFLAGS=-L/opt/local/lib
17fd6539 6LDLIBS=-lusb-1.0 -lrt
9db2e455
MG
7CC=gcc
8
bcbce09d 9HMLAN_OBJS=hmcfgusb.o hmland.o util.o
3e34d2ce 10HMSNIFF_OBJS=hmcfgusb.o hmuartlgw.o hmsniff.o
47ea478b 11FLASH_HMCFGUSB_OBJS=hmcfgusb.o firmware.o util.o flash-hmcfgusb.o
3e34d2ce 12FLASH_OTA_OBJS=hmcfgusb.o culfw.o hmuartlgw.o firmware.o util.o flash-ota.o hm.o aes.o
9db2e455 13
25870f58 14OBJS=$(HMLAN_OBJS) $(HMSNIFF_OBJS) $(FLASH_HMCFGUSB_OBJS) $(FLASH_OTA_OBJS)
d57fdaf6 15
25870f58 16all: hmland hmsniff flash-hmcfgusb flash-ota
9db2e455
MG
17
18DEPEND=$(OBJS:.o=.d)
19-include $(DEPEND)
20
d57fdaf6
MG
21hmland: $(HMLAN_OBJS)
22
23hmsniff: $(HMSNIFF_OBJS)
9db2e455 24
9fb0f4d2
MG
25flash-hmcfgusb: $(FLASH_HMCFGUSB_OBJS)
26
25870f58
MG
27flash-ota: $(FLASH_OTA_OBJS)
28
9db2e455 29clean:
25870f58 30 rm -f $(HMLAN_OBJS) $(HMSNIFF_OBJS) $(FLASH_HMCFGUSB_OBJS) $(FLASH_OTA_OBJS) $(DEPEND) hmland hmsniff flash-hmcfgusb flash-ota
9db2e455
MG
31
32.PHONY: all clean
74058b00
MG
33
34else
35
36#OpenWRT/LEDE
37include $(TOPDIR)/rules.mk
38
39PKG_NAME:=hmcfgusb
40PKG_VERSION:=$(shell grep 'VERSION' version.h | cut -d'"' -f 2)
41PKG_RELEASE:=1
42PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
43
44include $(INCLUDE_DIR)/package.mk
45
46define Package/hmcfgusb
47 SECTION:=utils
48 CATEGORY:=Utilities
49 DEPENDS:=+libusb-1.0
50 TITLE:=HM-CFG-USB utilities
51endef
52
53define Build/Prepare
54 mkdir -p $(PKG_BUILD_DIR)
55 $(CP) ./* $(PKG_BUILD_DIR)/
56 $(SED) 's/OPENWRT_BUILD/DISABLED_CHECK_FOR_OPENWRT_TO_USE_CORRECT_BLOCK_NOW/' $(PKG_BUILD_DIR)/Makefile
57endef
58
59define Package/hmcfgusb/install
60 $(INSTALL_DIR) $(1)/usr/sbin/
61 $(INSTALL_BIN) $(PKG_BUILD_DIR)/hmland $(1)/usr/sbin/
62 $(INSTALL_DIR) $(1)/usr/bin/
63 $(INSTALL_BIN) $(PKG_BUILD_DIR)/hmsniff $(1)/usr/bin/
64 $(INSTALL_BIN) $(PKG_BUILD_DIR)/flash-hmcfgusb $(1)/usr/bin/
65 $(INSTALL_BIN) $(PKG_BUILD_DIR)/flash-ota $(1)/usr/bin/
66 $(INSTALL_DIR) $(1)/etc/init.d/
67 $(INSTALL_BIN) $(PKG_BUILD_DIR)/init.hmland.OpenWRT $(1)/etc/init.d/hmland
68endef
69
70define Package/hmcfgusb/postinst
71#!/bin/sh
72# check if we are on real system
73if [ -z "$${IPKG_INSTROOT}" ]; then
74 echo "Enabling rc.d symlink for hmland"
75 /etc/init.d/hmland enable
76fi
77exit 0
78endef
79
80define Package/hmcfgusb/prerm
81#!/bin/sh
82# check if we are on real system
83if [ -z "$${IPKG_INSTROOT}" ]; then
84 echo "Removing rc.d symlink for hmland"
85 /etc/init.d/hmland disable
86fi
87exit 0
88endef
89
90$(eval $(call BuildPackage,hmcfgusb))
91endif
Impressum, Datenschutz