ina260-zmq-publisher/Makefile
2023-07-16 17:41:09 +02:00

36 lines
977 B
Makefile

CONF=$(PWD)/config.mk
include $(CONF)
CC="gcc"
CFLAGS=
MACROS=\
-DZMQ_TOKEN=\"$(ZMQ_TOKEN)\" \
-DZMQ_MSG_SIZE=$(ZMQ_MSG_SIZE) \
-DLOGGERS_DELAY=$(LOGGERS_DELAY)
all: publisher subscriber logger
publisher: src/publisher.c src/utils.c config.mk
$(CC) -lzmq $(filter-out config.mk,$^) -o $@ $(MACROS)
subscriber: src/subscriber.c src/utils.c config.mk
$(CC) -lzmq $(filter-out config.mk,$^) -o $@ $(MACROS)
logger: src/logger.c src/utils.c config.mk
$(CC) $(filter-out config.mk,$^) -o $@ $(MACROS)
publish: publisher logger
for client in $$(basename -a /home/loic/registers/*); \
do \
./logger $(LOGGERS_DIR) $$client $(LOG_INTERVAL) &> logger_$${client}.log & echo $$! >> pid; \
done
./publisher $(LOGGERS_DIR) $(LOG_INTERVAL) $(SUBSCRIBER_ADDR) $(ZMQ_PORT) $(KEY)
[ -f pid ] && { kill -INT $(shell cat pid); rm pid; }
subscribe: subscriber
./subscriber $(ZMQ_PORT) $(SUBSCRIBER_DIR)
clean:
rm -f logger subscriber publisher
.PHONY: clean publish subscribe