]> ToastFreeware Gitweb - toast/airingbutler.git/blobdiff - Makefile
Makefile: add 'plot' target, passing startdate from last rotated log to plot_mhz19.py
[toast/airingbutler.git] / Makefile
index dd82311de0d39e09da94c87fdde440124f13cdfb..a067d2bbe917a8bad7edea3efbb8b718fac519b1 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,28 @@
 BOARD_TAG=uno
+
+HOSTNAME=$(shell hostname)
+ifeq ($(HOSTNAME),jadzia)
+MONITOR_PORT=/dev/ttyACM1
+else
 MONITOR_PORT=/dev/ttyACM0
+endif
+
 # ARDUINO_SKETCHBOOK=~/sketchbook
 include /usr/share/arduino/Arduino.mk
+
+all: $(CURDIR)
+
+# log is the result of
+# annotate-output ./log_mhz19.py -d /dev/ttyACM3 | tee -a log
+# and we want log.csv for plot_mhz19.py
+log.csv: log
+       cp $< $@
+       fromdos $@
+       sed -i -e '/Started/ d' -e '/Finished/ d ' -e 's/ O: /,/g' $@
+       perl -ni -e 'BEGIN{$$i=0}; print if ($$_ !~ /CO2/ || $$i == 0); $$i++;' $@
+
+STARTDATE=$(shell date "+%F" --date @$$(stat --format "%Y" $$(find -name "log-*.gz" | sort | tail -n 1)))
+plot: log.csv
+       ./plot_mhz19.py --startdate $(STARTDATE) $<
+
+.PHONY: log.csv plot