ina260-zmq-publisher/Makefile

36 lines
906 B
Makefile
Raw 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-07-14 19:29:18 +02:00
CFLAGS=
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-07-16 17:41:09 +02:00
-DLOGGERS_DELAY=$(LOGGERS_DELAY)
2023-07-15 21:38:12 +02:00
2023-07-15 19:31:17 +02:00
all: publisher subscriber logger
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
$(CC) -lzmq $(filter-out config.mk,$^) -o $@ $(MACROS)
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
$(CC) -lzmq $(filter-out config.mk,$^) -o $@ $(MACROS)
2023-07-14 20:42:12 +02:00
2023-07-15 21:49:12 +02:00
logger: src/logger.c src/utils.c config.mk
2023-07-17 20:29:37 +02:00
$(CC) -lzmq -lpthread $(filter-out config.mk,$^) -o $@ $(MACROS)
2023-07-14 18:28:02 +02:00
2023-07-15 19:31:17 +02:00
publish: publisher logger
2023-07-17 10:53:26 +02:00
for client in $$(basename -a /sys/kernel/ina260/*); \
2023-07-15 21:20:55 +02:00
do \
2023-07-17 16:41:07 +02:00
./logger $(LOGGERS_DIR) $$client $(LOG_INTERVAL) $(SUBSCRIBER_ADDR) $(ZMQ_PORT) $(KEY) ; \
2023-07-15 21:20:55 +02:00
done
2023-07-17 16:41:07 +02:00
# [ -f pid ] && { kill -INT $(shell cat pid); rm pid; }
2023-07-15 19:31:17 +02:00
subscribe: subscriber
2023-07-15 19:45:32 +02:00
./subscriber $(ZMQ_PORT) $(SUBSCRIBER_DIR)
2023-07-15 13:54:03 +02:00
2023-07-14 18:26:31 +02:00
clean:
2023-07-15 19:31:17 +02:00
rm -f logger subscriber publisher
2023-07-14 18:26:31 +02:00
2023-07-15 19:31:17 +02:00
.PHONY: clean publish subscribe