1 Star 0 Fork 45

chxj/mqttclient

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
make-libmqttclient.sh 1.85 KB
一键复制 编辑 原始数据 按行查看 历史
杰杰 提交于 2020-06-14 23:22 . update shell and png ...
#!/bin/bash
mkdir -p libmqttclient libmqttclient/include libmqttclient/lib
cd libmqttclient
if [ ! -f "Makefile" ]; then
cat <<-EOF > Makefile
CC=\$(CROSS_COMPILE)gcc
SRC = \$(wildcard ../*.c \\
../common/*.c \\
../common/log/*.c \\
../common/log/arch/linux/*.c \\
../network/mbedtls/library/*.c \\
../network/mbedtls/wrapper/*.c \\
../mqtt/*.c \\
../mqttclient/*.c \\
../network/*.c \\
../platform/linux/*.c \\
)
INC = -lpthread \\
-I../common \\
-I../common/log \\
-I../network/mbedtls/include \\
-I../network/mbedtls/include/mbedtls \\
-I../network/mbedtls/wrapper \\
-I../mqtt \\
-I../mqttclient \\
-I../network \\
-I../platform/linux \\
-I../test
OBJS = \$(patsubst %.c, %.o, \$(SRC))
FLAG = -g -fpic -I. -Iinclude \$(INC)
TARGET = libmqttclient.so
EOF
echo -e "\n\$(TARGET):\$(OBJS)" >> Makefile
echo -e "\t\$(CC) -shared \$^ -o \$@" >> Makefile
echo -e "\n%.o:%.c" >> Makefile
echo -e "\t\$(CC) -c \$(FLAG) \$^ -o \$@" >> Makefile
echo -e "\nclean:" >> Makefile
echo -e "\trm -rf \$(TARGET) \$(OBJS)" >> Makefile
echo -e "\ninstall:" >> Makefile
echo -e "\tsudo cp -rdf \$(TARGET) /usr/lib/." >> Makefile
echo -e "\nremove:" >> Makefile
echo -e "\tsudo rm -rdf /usr/lib/\$(TARGET)" >> Makefile
echo -e "\n.PHONY:clean" >> Makefile
fi
cp -r ../test/*.h include/.
cp -r ../mqtt/*.h include/.
cp -r ../common/*.h include/.
cp -r ../network/*.h include/.
cp -r ../mqttclient/*.h include/.
cp -r ../common/log/*.h include/.
cp -r ../platform/linux/*.h include/.
cp -r ../network/mbedtls/include/mbedtls include/.
cp -r ../network/mbedtls/wrapper/*.h include/.
if [ " $1" == " " ]; then
make
make install
mv libmqttclient.so lib/.
make clean
elif [ "$1" == "remove" ]; then
make remove
fi
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C/C++
1
https://gitee.com/chxj8080/mqttclient.git
[email protected]:chxj8080/mqttclient.git
chxj8080
mqttclient
mqttclient
master

搜索帮助