Add openwrt makefile

This commit is contained in:
2020-10-29 19:27:01 +01:00
parent 27905dc590
commit 7139cd1e5f

54
Makefile.openwrt Normal file
View File

@@ -0,0 +1,54 @@
include $(TOPDIR)/rules.mk
# Name, version and release number
# The name and version of your package are used to define the variable to point to the build directory of your package: $(PKG_BUILD_DIR)
PKG_NAME:=bell-rspro
PKG_VERSION:=0.0.10
PKG_RELEASE:=1
# Source settings (i.e. where to find the source codes)
# This is a custom variable, used below
SOURCE_DIR:=/home/jaro/bell-rspro
include $(INCLUDE_DIR)/package.mk
# Package definition; instructs on how and where our package will appear in the overall configuration menu ('make menuconfig')
define Package/bell-rspro
SECTION:=net
CATEGORY:=Network
PKG_BUILD_DEPENDS:=mosquitto
TITLE:=bell-rspro
DEPENDS:=+libmosquitto-nossl
endef
# Package description; a more verbose description on what our package does
define Package/bell-rspro/description
App for home automation with MQTT for RS PRO and sending signal to GPIO port
endef
# Package preparation instructions; create the build directory and copy the source code.
# The last command is necessary to ensure our preparation instructions remain compatible with the patching system.
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
cp $(SOURCE_DIR)/* $(PKG_BUILD_DIR)
$(Build/Patch)
endef
# Package build instructions; invoke the target-specific compiler to first compile the source file, and then to link the file into the final executable
define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR) \
CC="$(TARGET_CC)" \
LD="$(TARGET_LD)" \
CFLAGS="$(TARGET_CFLAGS)" \
LDFLAGS="$(TARGET_LDFLAGS) -lmosquitto" \
CROSS_COMPILE="$(REAL_GNU_TARGET_NAME)-"
endef
# Package install instructions; create a directory inside the package to hold our executable, and then copy the executable we built previously into the folder
define Package/bell-rspro/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bell-mqtt-recv $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bell-rspro.init $(1)/etc/init.d/bell-rspro
endef
$(eval $(call BuildPackage,bell-rspro))