mirror of
https://gitlab.com/manzerbredes/ina260-zmq-publisher.git
synced 2025-04-06 03:46:25 +02:00
35 lines
835 B
Makefile
35 lines
835 B
Makefile
CONF=$(PWD)/config.mk
|
|
include $(CONF)
|
|
CC="gcc"
|
|
CFLAGS=
|
|
|
|
MACROS=\
|
|
-DZMQ_TOKEN=\"$(ZMQ_TOKEN)\" \
|
|
-DZMQ_MSG_SIZE=$(ZMQ_MSG_SIZE)
|
|
|
|
all: publisher subscriber logger
|
|
|
|
publisher: src/publisher.c src/utils.c
|
|
$(CC) -lzmq $^ -o $@ $(MACROS)
|
|
|
|
subscriber: src/subscriber.c src/utils.c
|
|
$(CC) -lzmq $^ -o $@ $(MACROS)
|
|
|
|
logger: src/logger.c src/utils.c
|
|
$(CC) $^ -o $@ $(MACROS)
|
|
|
|
publish: publisher logger
|
|
[ -f pid ] && { kill $(shell cat pid); rm pid; }
|
|
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)
|
|
|
|
subscribe: subscriber
|
|
./subscriber $(ZMQ_PORT) $(SUBSCRIBER_DIR)
|
|
|
|
clean:
|
|
rm -f logger subscriber publisher
|
|
|
|
.PHONY: clean publish subscribe
|