mqttauditing/Makefile

33 lines
636 B
Makefile

CC=gcc
CFLAGS=-Wall
LDFLAGS=-lconfig -lpthread -lpaho-mqtt3c -lmariadb
INST_DIR=/opt/sbin
REFCNT:=$(shell git rev-list --all --count)
VERSION:=$(shell cat VERSION)
.PHONY: all
all: mqttauditing
mqttauditing: mqttauditing.o mqttreceiver.o mqtttopicmatcher.o sink.o mariadbsink.o logging.o ringbuffer.o version.o
$(CC) -o $@ $(LDFLAGS) $^
tests: tests.o ringbuffer.o mqtttopicmatcher.o
$(CC) -o $@ $(LDFLAGS) -lcunit $^
version.o: version.c VERSION
$(CC) -DD_REFCNT=$(REFCNT) -DD_VERSION=\"$(VERSION)\" -c $<
.c.o:
$(CC) $(CFLAGS) -c $<
.PHONY: clean
clean:
-rm -f *.o mqttauditing tests
.PHONY: test
test: tests
./tests