From 9ae5259c592406577656b8432c4aa2e86ea2a7f6 Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Thu, 20 Nov 2025 15:18:15 +0800
Subject: [PATCH] Add generate deb package support
---
project/thingsboard/makefile | 18 +++++++++++++-----
1 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/project/thingsboard/makefile b/project/thingsboard/makefile
index 796bb6c..78bbe8f 100644
--- a/project/thingsboard/makefile
+++ b/project/thingsboard/makefile
@@ -12,7 +12,9 @@
#*******************************************************************************
PRJ_PATH=$(shell pwd)
-APP_NAME = thingsboard
+APP_NAME=$(shell basename ${PRJ_PATH})
+DEB_NAME=${APP_NAME}.deb
+DEB_PATH=${PRJ_PATH}/deb
BUILD_ARCH=$(shell uname -m)
ifneq ($(findstring $(BUILD_ARCH), "x86_64" "i386"),)
@@ -39,30 +41,36 @@
# libraries
libs=openlibs ${SRCS}
-LDFLAGS+=-lmosquitto -lcjson -lssl -lcrypto -lgpiod
+LDFLAGS+=-lmosquitto -lcjson -lssl -lcrypto -lgpiod -lm
LDFLAGS+=-lpthread
all: entry subdir
${CROSS_COMPILE}gcc ${CFLAGS} ${SRCFILES} -o ${APP_NAME} ${LDFLAGS}
+ @make gendeb
entry:
@echo "Building ${APP_NAME} on ${BUILD_ARCH}"
subdir:
@for dir in ${libs} ; do if [ ! -e $${dir} ] ; then ln -s ../$${dir}; fi; done
- @for dir in ${libs} ; do make -C $${dir} ; done
+ @for dir in ${libs} ; do CFLAGS="${CFLAGS}" make -C $${dir} ; done
+
+gendeb:
+ @ if [ ! -L ${DEB_PATH} ]; then ln -s ../deb ${DEB_PATH}; fi
+ @make -C ${DEB_PATH} APP_NAME=${APP_NAME}
install:
- cp ${APP_NAME} /tftp
+ cp ${APP_NAME} ${DEB_PATH}/${DEB_NAME} /tftp
clean:
@for dir in ${SRCS} ; do if [ -e $${dir} ] ; then make clean -C $${dir}; fi; done
+ @make clean -C ${DEB_PATH} APP_NAME=${APP_NAME}
@rm -f ${APP_NAME}
distclean:
@for dir in ${libs} ; do if [ -e $${dir} ] ; then make clean -C $${dir}; fi; done
- @for dir in ${libs} ; do if [ -e $${dir} ] ; then unlink $${dir}; fi; done
+ @for dir in ${libs} ; do if [ -L $${dir} ] ; then unlink $${dir}; fi; done
@rm -f ${APP_NAME}
@rm -f cscope.* tags
--
Gitblit v1.9.1