]> git.zerfleddert.de Git - hmcfgusb/blame - Makefile
Allow the user to specify the compiler via environment variable
[hmcfgusb] / Makefile
CommitLineData
74058b00
MG
1ifeq ($(OPENWRT_BUILD),)
2
3#Normal system
fcb2ff43
FF
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
6e621012
FF
22LDFLAGS:=-L/opt/local/lib
23LDLIBS:=-lusb-1.0 -lrt
256adf55
FF
24
25ifeq ($(firstword $(origin CC)),default)
6e621012 26CC:=gcc
256adf55 27endif
9db2e455 28
6e621012
FF
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
9db2e455 34
6e621012 35OBJS:=$(HMLAN_OBJS) $(HMSNIFF_OBJS) $(FLASH_HMCFGUSB_OBJS) $(FLASH_HMMODUART_OBJS) $(FLASH_OTA_OBJS)
d57fdaf6 36
853cbce9 37all: hmland hmsniff flash-hmcfgusb flash-hmmoduart flash-ota
9db2e455 38
6e621012 39DEPEND:=$(OBJS:.o=.d)
9db2e455
MG
40-include $(DEPEND)
41
d57fdaf6
MG
42hmland: $(HMLAN_OBJS)
43
44hmsniff: $(HMSNIFF_OBJS)
9db2e455 45
9fb0f4d2
MG
46flash-hmcfgusb: $(FLASH_HMCFGUSB_OBJS)
47
853cbce9
MG
48flash-hmmoduart: $(FLASH_HMMODUART_OBJS)
49
25870f58
MG
50flash-ota: $(FLASH_OTA_OBJS)
51
9db2e455 52clean:
4de6092b 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
9db2e455
MG
54
55.PHONY: all clean
74058b00
MG
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