mqttClient/Makefile
2023-12-29 20:30:50 +01:00

30 lines
689 B
Makefile

SRC := src/main.c src/mqtt.c src/module.c src/modules/*.c
INC := -I src
LIBS := -lpthread -lpthread
# paho mqtt
LIBPAHO_DIR := libs/paho.mqtt.c
INC += -I $(LIBPAHO_DIR)/src
LIBS += -L$(LIBPAHO_DIR)/build/output -lpaho-mqtt3a -lpaho-mqtt3c
all: build
build-paho: $(LIBPAHO_DIR)
cd $(LIBPAHO_DIR) && make build
build: $(SRC) | ${build-paho}
gcc $(SRC) $(LIBS) -o mqttClient $(INC)
debug: $(SRC)
gcc $(SRC) $(LIBS) -g -o mqttClient $(INC)
install:
mkdir -p $$HOME/.local/bin
cp mqttClient $$HOME/.local/bin/mqttClient
chmod +x $$HOME/.local/bin/mqttClient
# sed -e "s/<username>/$$(id -un)/g" mqttClient.service >/etc/systemd/system/mqttClient.service
clean:
rm mqttClient