]> git.zerfleddert.de Git - hmcfgusb/blame_incremental - Makefile
Suppress warnings about non-literal format strings
[hmcfgusb] / Makefile
... / ...
CommitLineData
1ifeq ($(OPENWRT_BUILD),)
2
3#Normal system
4CFLAGS=-Wall -Wextra -Wno-unused-parameter -pedantic
5CFLAGS+= -Wno-unknown-warning-option
6CFLAGS+= -Wformat=2
7CFLAGS+= -Wformat-truncation=2
8CFLAGS+= -Wwrite-strings
9CFLAGS+= -Wnull-dereference
10CFLAGS+= -Wuninitialized
11CFLAGS+= -Wstrict-overflow
12CFLAGS+= -Wdate-time
13CFLAGS+= -Wundef
14CFLAGS+= -Wpacked
15CFLAGS+= -Wduplicated-branches
16CFLAGS+= -Wduplicated-cond
17CFLAGS+= -Wstrict-prototypes
18CFLAGS+= -Wbad-function-cast
19CFLAGS+= -Wold-style-definition
20CFLAGS+= -MMD -O2 -I/opt/local/include -g
21
22LDFLAGS:=-L/opt/local/lib
23LDLIBS:=-lusb-1.0 -lrt
24
25ifeq ($(firstword $(origin CC)),default)
26CC:=gcc
27endif
28
29HMLAN_OBJS:=hmcfgusb.o hmland.o util.o
30HMSNIFF_OBJS:=hmcfgusb.o hmuartlgw.o hmsniff.o
31FLASH_HMCFGUSB_OBJS:=hmcfgusb.o firmware.o util.o flash-hmcfgusb.o
32FLASH_HMMODUART_OBJS:=hmuartlgw.o firmware.o util.o flash-hmmoduart.o
33FLASH_OTA_OBJS:=hmcfgusb.o culfw.o hmuartlgw.o firmware.o util.o flash-ota.o hm.o aes.o
34
35OBJS:=$(HMLAN_OBJS) $(HMSNIFF_OBJS) $(FLASH_HMCFGUSB_OBJS) $(FLASH_HMMODUART_OBJS) $(FLASH_OTA_OBJS)
36
37all: hmland hmsniff flash-hmcfgusb flash-hmmoduart flash-ota
38
39DEPEND:=$(OBJS:.o=.d)
40-include $(DEPEND)
41
42hmland: $(HMLAN_OBJS)
43
44hmsniff: $(HMSNIFF_OBJS)
45
46flash-hmcfgusb: $(FLASH_HMCFGUSB_OBJS)
47
48flash-hmmoduart: $(FLASH_HMMODUART_OBJS)
49
50flash-ota: $(FLASH_OTA_OBJS)
51
52clean:
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
54
55.PHONY: all clean
56
57else
58
59#OpenWRT/LEDE
60include $(TOPDIR)/rules.mk
61
62PKG_NAME:=hmcfgusb
63PKG_VERSION:=$(shell grep 'VERSION' version.h | cut -d'"' -f 2)
64PKG_RELEASE:=1
65PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
66
67include $(INCLUDE_DIR)/package.mk
68
69define Package/hmcfgusb
70 SECTION:=utils
71 CATEGORY:=Utilities
72 DEPENDS:=+libusb-1.0
73 TITLE:=HM-CFG-USB utilities
74endef
75
76define Build/Prepare
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
80endef
81
82define 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
91endef
92
93define Package/hmcfgusb/postinst
94#!/bin/sh
95# check if we are on real system
96if [ -z "$${IPKG_INSTROOT}" ]; then
97 echo "Enabling rc.d symlink for hmland"
98 /etc/init.d/hmland enable
99fi
100exit 0
101endef
102
103define Package/hmcfgusb/prerm
104#!/bin/sh
105# check if we are on real system
106if [ -z "$${IPKG_INSTROOT}" ]; then
107 echo "Removing rc.d symlink for hmland"
108 /etc/init.d/hmland disable
109fi
110exit 0
111endef
112
113$(eval $(call BuildPackage,hmcfgusb))
114endif
Impressum, Datenschutz