ina260-zmq-publisher/Makefile

37 lines
882 B
Makefile
Raw Permalink Normal View History

2023-07-14 20:08:36 +02:00
CONF=$(PWD)/config.mk
include $(CONF)
2023-07-14 18:26:31 +02:00
CC="gcc"
2023-08-25 15:54:38 +02:00
CFLAGS=-lzmq
2023-07-14 18:26:31 +02:00
2023-07-15 21:38:12 +02:00
MACROS=\
-DZMQ_TOKEN=\"$(ZMQ_TOKEN)\" \
2023-07-16 10:39:05 +02:00
-DZMQ_MSG_SIZE=$(ZMQ_MSG_SIZE) \
2023-08-10 14:21:39 +02:00
-DLOG_DELAY=$(LOG_DELAY) \
2024-02-01 15:25:11 +01:00
-DMAX_QUEUE=$(MAX_QUEUE) \
-DRCV_CMD=":"
2023-07-15 21:38:12 +02:00
2023-07-18 13:00:38 +02:00
all: publisher subscriber
2023-07-14 18:26:31 +02:00
2023-07-15 21:49:12 +02:00
publisher: src/publisher.c src/utils.c config.mk
2023-08-25 15:54:38 +02:00
$(CC) $(filter-out config.mk,$^) -o $@ $(MACROS) $(CFLAGS) -lpthread
2023-07-14 18:28:02 +02:00
2023-07-15 21:49:12 +02:00
subscriber: src/subscriber.c src/utils.c config.mk
2023-08-25 15:54:38 +02:00
$(CC) $(filter-out config.mk,$^) -o $@ $(MACROS) $(CFLAGS)
2023-07-14 20:42:12 +02:00
2023-07-18 13:00:38 +02:00
publish: publisher
[ -f pid ] && { cat pid|xargs kill -INT; rm pid; } || exit 0
for client in $$(ls /sys/kernel/ina260/|xargs basename -a); \
2023-07-15 21:20:55 +02:00
do \
2023-07-18 13:00:38 +02:00
./$^ $$client $(LOG_INTERVAL) $(SUBSCRIBER_ADDR) $(ZMQ_PORT) $(KEY) > publisher_$${client}.log 2>&1 & \
echo $$! >> pid; \
done ;\
wait
2023-07-15 19:31:17 +02:00
subscribe: subscriber
2023-07-18 13:00:38 +02:00
./$^ $(ZMQ_PORT) $(SUBSCRIBER_DIR)
2023-07-15 13:54:03 +02:00
2023-07-14 18:26:31 +02:00
clean:
2023-07-18 13:00:38 +02:00
rm -f subscriber publisher
2023-07-14 18:26:31 +02:00
2023-07-15 19:31:17 +02:00
.PHONY: clean publish subscribe