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