1 ifeq ($(OPENWRT_BUILD
),)
4 CFLAGS
=-Wall
-Wextra
-Wno-unused-parameter
-pedantic
5 CFLAGS
+= -Wno-unknown-warning-option
7 CFLAGS
+= -Wformat-truncation
=2
8 CFLAGS
+= -Wwrite-strings
9 CFLAGS
+= -Wnull-dereference
10 CFLAGS
+= -Wuninitialized
11 CFLAGS
+= -Wstrict-overflow
15 CFLAGS
+= -Wduplicated-branches
16 CFLAGS
+= -Wduplicated-cond
17 CFLAGS
+= -Wstrict-prototypes
18 CFLAGS
+= -Wbad-function-cast
19 CFLAGS
+= -Wold-style-definition
20 CFLAGS
+= -MMD
-O2
-I
/opt
/local
/include -g
22 LDFLAGS
:=-L
/opt
/local
/lib
23 LDLIBS
:=-lusb-1.0
-lrt
25 ifeq ($(firstword $(origin CC
)),default
)
29 HMLAN_OBJS
:=hmcfgusb.o hmland.o util.o
30 HMSNIFF_OBJS
:=hmcfgusb.o hmuartlgw.o hmsniff.o
31 FLASH_HMCFGUSB_OBJS
:=hmcfgusb.o firmware.o util.o flash-hmcfgusb.o
32 FLASH_HMMODUART_OBJS
:=hmuartlgw.o firmware.o util.o flash-hmmoduart.o
33 FLASH_OTA_OBJS
:=hmcfgusb.o culfw.o hmuartlgw.o firmware.o util.o flash-ota.o hm.o aes.o
35 OBJS
:=$(HMLAN_OBJS
) $(HMSNIFF_OBJS
) $(FLASH_HMCFGUSB_OBJS
) $(FLASH_HMMODUART_OBJS
) $(FLASH_OTA_OBJS
)
37 all: hmland hmsniff flash-hmcfgusb flash-hmmoduart flash-ota
44 hmsniff
: $(HMSNIFF_OBJS
)
46 flash-hmcfgusb
: $(FLASH_HMCFGUSB_OBJS
)
48 flash-hmmoduart
: $(FLASH_HMMODUART_OBJS
)
50 flash-ota
: $(FLASH_OTA_OBJS
)
53 rm -f
$(HMLAN_OBJS
) $(HMSNIFF_OBJS
) $(FLASH_HMCFGUSB_OBJS
) $(FLASH_HMMODUART_OBJS
) $(FLASH_OTA_OBJS
) $(DEPEND
) hmland hmsniff flash-hmcfgusb flash-hmmoduart flash-ota
60 include $(TOPDIR
)/rules.mk
63 PKG_VERSION
:=$(shell grep
'VERSION' version.h | cut
-d
'"' -f
2)
65 PKG_BUILD_DIR
:=$(BUILD_DIR
)/$(PKG_NAME
)
67 include $(INCLUDE_DIR
)/package.mk
69 define Package
/hmcfgusb
73 TITLE
:=HM-CFG-USB utilities
77 mkdir
-p
$(PKG_BUILD_DIR
)
78 $(CP
) .
/* $(PKG_BUILD_DIR
)/
79 $(SED
) 's/OPENWRT_BUILD/DISABLED_CHECK_FOR_OPENWRT_TO_USE_CORRECT_BLOCK_NOW/' $(PKG_BUILD_DIR
)/Makefile
82 define Package
/hmcfgusb
/install
83 $(INSTALL_DIR
) $(1)/usr
/sbin
/
84 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/hmland
$(1)/usr
/sbin
/
85 $(INSTALL_DIR
) $(1)/usr
/bin
/
86 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/hmsniff
$(1)/usr
/bin
/
87 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/flash-hmcfgusb
$(1)/usr
/bin
/
88 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/flash-ota
$(1)/usr
/bin
/
89 $(INSTALL_DIR
) $(1)/etc
/init.d
/
90 $(INSTALL_BIN
) $(PKG_BUILD_DIR
)/init.hmland.OpenWRT
$(1)/etc
/init.d
/hmland
93 define Package
/hmcfgusb
/postinst
95 # check if we are on real system
96 if
[ -z
"$${IPKG_INSTROOT}" ]; then
97 echo
"Enabling rc.d symlink for hmland"
98 /etc
/init.d
/hmland enable
103 define Package
/hmcfgusb
/prerm
105 # check if we are on real system
106 if
[ -z
"$${IPKG_INSTROOT}" ]; then
107 echo
"Removing rc.d symlink for hmland"
108 /etc
/init.d
/hmland disable
113 $(eval
$(call BuildPackage
,hmcfgusb
))