guowenxue
2019-03-25 ed778b78c3ee7cb25aecb0d70efd66239662c44c
update mqttd program, add mosquitto compile
1 files modified
1 files added
44 ■■■■■ changed files
mqttd/makefile 7 ●●●● patch | view | raw | blame | history
mqttd/mosquitto/build.sh 37 ●●●●● patch | view | raw | blame | history
mqttd/makefile
@@ -18,6 +18,8 @@
CFLAGS+=-I${PWD}
#CFLAGS+=-Wall -Werror
MQTT_LIBPATH=mosquitto
LDFLAGS+=-lwiringPi
LDFLAGS+=-lpthread
@@ -38,7 +40,7 @@
SRCFILES = $(wildcard *.c)
IMAGE_NAME=$(shell basename ${PWD})
all: entry binary
all: entry MQTT binary
entry: 
    @echo " ";
    @echo " =========================================================";
@@ -49,6 +51,9 @@
    $(CC) $(CFLAGS) -o ${IMAGE_NAME} $^  ${LDFLAGS}
    @echo " Compile over"
MQTT:
    cd ${MQTT_LIBPATH} && bash build.sh
tag: 
    @ctags --c-kinds=+defglmnstuvx --langmap=c:.c.h.ho.hem.het.hec.hev.him.hit.hic.hiv -R .  
    @cscope -Rbq
mqttd/mosquitto/build.sh
New file
@@ -0,0 +1,37 @@
#!/bin/bash
MQTT_LIB=mosquitto-1.5.8
LIBPATH=/usr/local/lib/libmosquitto.so
if [ -f ${LIBPATH} ] ; then
    echo "${MQTT_LIB} already installed"
    exit 0;
fi
if [ ! -d $MQTT_LIB ]  ; then
    if [ ! -f ${MQTT_LIB}.tar.gz ] ; then
        wget https://mosquitto.org/files/source/${MQTT_LIB}.tar.gz
    fi
    if [ ! -f ${MQTT_LIB}.tar.gz ] ; then
        echo "## ERROR: MQTT Library ${MQTT_LIB}.tar.gz not exist or download failure!"
        exit 1;
    fi
    tar -xzf ${MQTT_LIB}.tar.gz
fi
if [ ! -d $MQTT_LIB ]  ; then
    echo "## ERROR: MQTT Library ${MQTT_LIB} not exist or decompress failure!"
    exit 2;
fi
cd $MQTT_LIB
make install
if [ $? != 0 ] ; then
    echo "ERROR: MQTT Library ${MQTT_LIB} failure!"
    exit 3;
fi