$(filter $(firstword $1),$2),,$(firstword $1))) \
,$2)
-outs := png html5
-all: $(outs)
+views := png html5
+all: $(views)
#
## Sensors
SENSOR_LABEL_temperature=Température (°C)
SENSOR_LABEL_humidity=Humidité (%)
-SENSOR_LABEL_particles=Particules
-SENSOR_LABEL_quality=Qualité de l’air
+SENSOR_LABEL_dust=Particules
+SENSOR_LABEL_air=Qualité de l’air
+SENSOR_LABEL_co_ch4_lpg=CO/CH4/LPG
sensors := \
temperature \
humidity \
- quality \
- particles
+ air \
+ dust \
+ co_ch4_lpg
#
## Round Robin Database (RRD)
LCD_Display9696 \
Wire
-USER_LIB_PATH := $(abspath ./libraries)
+USER_LIB_PATH := $(realpath ./libraries)
+ifeq ($(NO_INO),)
include $(ARDMK_DIR)/Arduino.mk
+endif
ino: $(TARGET_EEP) $(TARGET_HEX)
## PNG
###
-define out/sensor/png
+define view/sensor/png
endef
-define out/sensor/year/png
-out/$(sensor)/$(year)/png:
+define view/sensor/year/png
+view/$(sensor)/$(year)/png:
endef
-define out/sensor/year/month/png
-out/$(sensor)/$(year)/$(month)/png: \
-out/$(sensor)/$(year)/$(month).png
+define view/sensor/year/month/png
+view/$(sensor)/$(year)/$(month)/png: \
+view/$(sensor)/$(year)/$(month).png
-out/$(sensor)/$(year)/$(month).png: \
+view/$(sensor)/$(year)/$(month).png: \
rrd/$(year)/$(month).rrd
mkdir -p $$(@D)
rrdtool graph $$@ \
LINE1:$(sensor)'#ff0000':"$(sensor)"
endef
-define out/sensor/year/month/day/png
-out/$(sensor)/$(year)/$(month)/$(day)/png: \
-out/$(sensor)/$(year)/$(month)/$(day).png
+define view/sensor/year/month/day/png
+view/$(sensor)/$(year)/$(month)/$(day)/png: \
+view/$(sensor)/$(year)/$(month)/$(day).png
-out/$(sensor)/$(year)/$(month)/$(day).png: \
+view/$(sensor)/$(year)/$(month)/$(day).png: \
rrd/$(year)/$(month).rrd
mkdir -p $$(@D)
rrdtool graph $$@ \
LINE1:$(sensor)'#ff0000':"$(sensor)";
endef
+define view/year/month/png
+view/$(year)/$(month)/png: \
+$(foreach sensor,$(sensors), view/$(sensor)/$(year)/$(month)/png)
+endef
+define view/year/month/day/png
+view/$(year)/$(month)/$(day)/png: \
+$(foreach sensor,$(sensors), view/$(sensor)/$(year)/$(month)/$(day)/png)
+endef
+
#
## HTML5
###
-define out/sensor/html5
+define view/sensor/html5
endef
-define out/sensor/year/html5
-out/$(sensor)/$(year)/html5:
+define view/sensor/year/html5
+view/$(sensor)/$(year)/html5:
endef
-define out/sensor/year/month/html5
-out/$(sensor)/$(year)/$(month)/html5: \
-out/$(sensor)/$(year)/$(month).html5
+define view/sensor/year/month/html5
+view/$(sensor)/$(year)/$(month)/html5: \
+view/$(sensor)/$(year)/$(month).html5
-out/$(sensor)/$(year)/$(month).html5: \
-out/$(sensor)/$(year)/$(month)/png
+view/$(sensor)/$(year)/$(month).html5: \
+view/$(sensor)/$(year)/$(month)/png
printf ' \
<report sensor="$(sensor)" year="$(year)" month="$(month)"> \
$(foreach day,$(days), \
xsltproc --output $$@ \
xsl/sensor/year/month.html5.xsl -
endef
-define out/year/month/html5
-out/$(year)/$(month)/html5: \
-out/$(year)/$(month).html5
+define view/year/month/html5
+view/$(year)/$(month)/html5: \
+view/$(year)/$(month).html5
-out/$(year)/$(month).html5: \
-$(foreach sensor,$(sensors), out/$(sensor)/$(year)/$(month)/png)
+view/$(year)/$(month).html5: \
+view/$(year)/$(month)/png
mkdir -p $$(@D)
printf ' \
<report year="$(year)" month="$(month)"> \
xsl/year/month.html5.xsl -
endef
-define out/sensor/year/month/day/html5
-#out/$(sensor)/$(year)/$(month)/$(day)/html5: \
-#out/$(sensor)/$(year)/$(month)/$(day).html5
-
-endef
-
#
## Dates
###
day_end=$(shell date +'%s' -d '$(year)/$(month)/$(day) + 1 day - 1 second')
define foreach/sensor
-.PHONY: out/$(sensor)/$(out)
-out/$(out): out/$(sensor)/$(out)
-$(call out/sensor/$(out))
+.PHONY: view/$(sensor)/$(view)
+view/$(view): view/$(sensor)/$(view)
+$(call view/sensor/$(view))
endef
-define foreach/year/sensor/out
-.PHONY: out/$(sensor)/$(year)/$(out)
-out/$(sensor)/$(out): out/$(sensor)/$(year)/$(out)
-$(call out/sensor/year/$(out))
+define foreach/year/sensor/view
+.PHONY: view/$(sensor)/$(year)/$(view)
+view/$(sensor)/$(view): view/$(sensor)/$(year)/$(view)
+$(call view/sensor/year/$(view))
endef
-define foreach/year/month/sensor/out
-.PHONY: out/$(sensor)/$(year)/$(month)/$(out)
-out/$(sensor)/$(year)/$(out): out/$(sensor)/$(year)/$(month)/$(out)
-$(call out/sensor/year/month/$(out))
+define foreach/year/month/sensor/view
+.PHONY: view/$(sensor)/$(year)/$(month)/$(view)
+view/$(sensor)/$(year)/$(view): view/$(sensor)/$(year)/$(month)/$(view)
+$(call view/sensor/year/month/$(view))
endef
-define foreach/year/month/out
-.PHONY: out/$(year)/$(month)/$(out)
-out/$(year)/$(out): out/$(year)/$(month)/$(out)
-$(call out/year/month/$(out))
+define foreach/year/month/view
+.PHONY: view/$(year)/$(month)/$(view)
+view/$(year)/$(view): view/$(year)/$(month)/$(view)
+$(call view/year/month/$(view))
endef
-define foreach/year/month/day/sensor/out
-.PHONY: out/$(sensor)/$(year)/$(month)/$(day)/$(out)
-out/$(sensor)/$(year)/$(month)/$(out): out/$(sensor)/$(year)/$(month)/$(day)/$(out)
-$(call out/sensor/year/month/day/$(out))
+define foreach/year/month/day/sensor/view
+.PHONY: view/$(sensor)/$(year)/$(month)/$(day)/$(view)
+view/$(sensor)/$(year)/$(month)/$(view): view/$(sensor)/$(year)/$(month)/$(day)/$(view)
+$(call view/sensor/year/month/day/$(view))
+endef
+define foreach/year/month/day/view
+.PHONY: view/$(year)/$(month)/$(day)/$(view)
+view/$(year)/$(month)/$(view): view/$(year)/$(month)/$(day)/$(view)
+$(call view/year/month/day/$(view))
endef
$(foreach sensor,$(sensors), \
- $(foreach out,$(outs), \
+ $(foreach view,$(views), \
$(eval $(call foreach/sensor)) \
) \
)
$(foreach year,$(years), \
- $(foreach out,$(outs), \
- $(eval $(call foreach/year/out)) \
+ $(foreach view,$(views), \
+ $(eval $(call foreach/year/view)) \
) \
$(foreach sensor,$(sensors), \
- $(foreach out,$(outs), \
- $(eval $(call foreach/year/sensor/out)) \
+ $(foreach view,$(views), \
+ $(eval $(call foreach/year/sensor/view)) \
) \
) \
$(foreach month,$(months), \
- $(foreach out,$(outs), \
- $(eval $(call foreach/year/month/out)) \
+ $(foreach view,$(views), \
+ $(eval $(call foreach/year/month/view)) \
) \
$(foreach sensor,$(sensors), \
- $(foreach out,$(outs), \
- $(eval $(call foreach/year/month/sensor/out)) \
+ $(foreach view,$(views), \
+ $(eval $(call foreach/year/month/sensor/view)) \
) \
) \
$(foreach day,$(days), \
- $(foreach out,$(outs), \
- $(eval $(call foreach/year/month/day/out)) \
+ $(foreach view,$(views), \
+ $(eval $(call foreach/year/month/day/view)) \
) \
$(foreach sensor,$(sensors), \
- $(foreach out,$(outs), \
- $(eval $(call foreach/year/month/day/sensor/out)) \
+ $(foreach view,$(views), \
+ $(eval $(call foreach/year/month/day/sensor/view)) \
) \
) \
) \