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