]> cvs.zerfleddert.de Git - hmcfgusb/blame_incremental - Makefile
Increase compiler-warning level
[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
24CC=gcc
25
26HMLAN_OBJS=hmcfgusb.o hmland.o util.o
27HMSNIFF_OBJS=hmcfgusb.o hmuartlgw.o hmsniff.o
28FLASH_HMCFGUSB_OBJS=hmcfgusb.o firmware.o util.o flash-hmcfgusb.o
29FLASH_HMMODUART_OBJS=hmuartlgw.o firmware.o util.o flash-hmmoduart.o
30FLASH_OTA_OBJS=hmcfgusb.o culfw.o hmuartlgw.o firmware.o util.o flash-ota.o hm.o aes.o
31
32OBJS=$(HMLAN_OBJS) $(HMSNIFF_OBJS) $(FLASH_HMCFGUSB_OBJS) $(FLASH_HMMODUART_OBJS) $(FLASH_OTA_OBJS)
33
34all: hmland hmsniff flash-hmcfgusb flash-hmmoduart flash-ota
35
36DEPEND=$(OBJS:.o=.d)
37-include $(DEPEND)
38
39hmland: $(HMLAN_OBJS)
40
41hmsniff: $(HMSNIFF_OBJS)
42
43flash-hmcfgusb: $(FLASH_HMCFGUSB_OBJS)
44
45flash-hmmoduart: $(FLASH_HMMODUART_OBJS)
46
47flash-ota: $(FLASH_OTA_OBJS)
48
49clean:
50 rm -f $(HMLAN_OBJS) $(HMSNIFF_OBJS) $(FLASH_HMCFGUSB_OBJS) $(FLASH_HMMODUART_OBJS) $(FLASH_OTA_OBJS) $(DEPEND) hmland hmsniff flash-hmcfgusb flash-hmmoduart flash-ota
51
52.PHONY: all clean
53
54else
55
56#OpenWRT/LEDE
57include $(TOPDIR)/rules.mk
58
59PKG_NAME:=hmcfgusb
60PKG_VERSION:=$(shell grep 'VERSION' version.h | cut -d'"' -f 2)
61PKG_RELEASE:=1
62PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
63
64include $(INCLUDE_DIR)/package.mk
65
66define Package/hmcfgusb
67 SECTION:=utils
68 CATEGORY:=Utilities
69 DEPENDS:=+libusb-1.0
70 TITLE:=HM-CFG-USB utilities
71endef
72
73define Build/Prepare
74 mkdir -p $(PKG_BUILD_DIR)
75 $(CP) ./* $(PKG_BUILD_DIR)/
76 $(SED) 's/OPENWRT_BUILD/DISABLED_CHECK_FOR_OPENWRT_TO_USE_CORRECT_BLOCK_NOW/' $(PKG_BUILD_DIR)/Makefile
77endef
78
79define Package/hmcfgusb/install
80 $(INSTALL_DIR) $(1)/usr/sbin/
81 $(INSTALL_BIN) $(PKG_BUILD_DIR)/hmland $(1)/usr/sbin/
82 $(INSTALL_DIR) $(1)/usr/bin/
83 $(INSTALL_BIN) $(PKG_BUILD_DIR)/hmsniff $(1)/usr/bin/
84 $(INSTALL_BIN) $(PKG_BUILD_DIR)/flash-hmcfgusb $(1)/usr/bin/
85 $(INSTALL_BIN) $(PKG_BUILD_DIR)/flash-ota $(1)/usr/bin/
86 $(INSTALL_DIR) $(1)/etc/init.d/
87 $(INSTALL_BIN) $(PKG_BUILD_DIR)/init.hmland.OpenWRT $(1)/etc/init.d/hmland
88endef
89
90define Package/hmcfgusb/postinst
91#!/bin/sh
92# check if we are on real system
93if [ -z "$${IPKG_INSTROOT}" ]; then
94 echo "Enabling rc.d symlink for hmland"
95 /etc/init.d/hmland enable
96fi
97exit 0
98endef
99
100define Package/hmcfgusb/prerm
101#!/bin/sh
102# check if we are on real system
103if [ -z "$${IPKG_INSTROOT}" ]; then
104 echo "Removing rc.d symlink for hmland"
105 /etc/init.d/hmland disable
106fi
107exit 0
108endef
109
110$(eval $(call BuildPackage,hmcfgusb))
111endif
Impressum, Datenschutz