]> git.zerfleddert.de Git - hmcfgusb/blobdiff - Makefile
Increase compiler-warning level
[hmcfgusb] / Makefile
index 56283bace88267cf4beb77dbb6f36840ef0a3365..cb9fe48ae5b461db91a53c88658624387ea15e2c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,15 +1,37 @@
-CFLAGS=-MMD -O2 -Wall -I/opt/local/include -g
+ifeq ($(OPENWRT_BUILD),)
+
+#Normal system
+CFLAGS=-Wall -Wextra -Wno-unused-parameter -pedantic
+CFLAGS+= -Wno-unknown-warning-option
+CFLAGS+= -Wformat=2
+CFLAGS+= -Wformat-truncation=2
+CFLAGS+= -Wwrite-strings
+CFLAGS+= -Wnull-dereference
+CFLAGS+= -Wuninitialized
+CFLAGS+= -Wstrict-overflow
+CFLAGS+= -Wdate-time
+CFLAGS+= -Wundef
+CFLAGS+= -Wpacked
+CFLAGS+= -Wduplicated-branches
+CFLAGS+= -Wduplicated-cond
+CFLAGS+= -Wstrict-prototypes
+CFLAGS+= -Wbad-function-cast
+CFLAGS+= -Wold-style-definition
+CFLAGS+= -MMD -O2 -I/opt/local/include -g
+
 LDFLAGS=-L/opt/local/lib
 LDLIBS=-lusb-1.0 -lrt
 CC=gcc
 
 LDFLAGS=-L/opt/local/lib
 LDLIBS=-lusb-1.0 -lrt
 CC=gcc
 
-HMLAN_OBJS=hmcfgusb.o hmland.o
-HMSNIFF_OBJS=hmcfgusb.o hmsniff.o
-FLASH_HMCFGUSB_OBJS=hmcfgusb.o flash-hmcfgusb.o
+HMLAN_OBJS=hmcfgusb.o hmland.o util.o
+HMSNIFF_OBJS=hmcfgusb.o hmuartlgw.o hmsniff.o
+FLASH_HMCFGUSB_OBJS=hmcfgusb.o firmware.o util.o flash-hmcfgusb.o
+FLASH_HMMODUART_OBJS=hmuartlgw.o firmware.o util.o flash-hmmoduart.o
+FLASH_OTA_OBJS=hmcfgusb.o culfw.o hmuartlgw.o firmware.o util.o flash-ota.o hm.o aes.o
 
 
-OBJS=$(HMLAN_OBJS) $(HMSNIFF_OBJS) $(FLASH_HMCFGUSB_OBJS)
+OBJS=$(HMLAN_OBJS) $(HMSNIFF_OBJS) $(FLASH_HMCFGUSB_OBJS) $(FLASH_HMMODUART_OBJS) $(FLASH_OTA_OBJS)
 
 
-all: hmland hmsniff
+all: hmland hmsniff flash-hmcfgusb flash-hmmoduart flash-ota
 
 DEPEND=$(OBJS:.o=.d)
 -include $(DEPEND)
 
 DEPEND=$(OBJS:.o=.d)
 -include $(DEPEND)
@@ -20,7 +42,70 @@ hmsniff: $(HMSNIFF_OBJS)
 
 flash-hmcfgusb: $(FLASH_HMCFGUSB_OBJS)
 
 
 flash-hmcfgusb: $(FLASH_HMCFGUSB_OBJS)
 
+flash-hmmoduart: $(FLASH_HMMODUART_OBJS)
+
+flash-ota: $(FLASH_OTA_OBJS)
+
 clean:
 clean:
-       rm -f $(HMLAN_OBJS) $(HMSNIFF_OBJS) $(FLASH_HMCFGUSB_OBJS) $(DEPEND) hmland hmsniff flash-hmcfgusb
+       rm -f $(HMLAN_OBJS) $(HMSNIFF_OBJS) $(FLASH_HMCFGUSB_OBJS) $(FLASH_HMMODUART_OBJS) $(FLASH_OTA_OBJS) $(DEPEND) hmland hmsniff flash-hmcfgusb flash-hmmoduart flash-ota
 
 .PHONY: all clean
 
 .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