# @(#)$Id: Makefile.data.in,v 1.9 2002/03/31 21:32:10 twitham Exp $ # Copyright (C) 1998 - 2002 Tim Witham # (see the files README and COPYING for more details) # This Makefile summarizes .tab data files to .day, .mon, .html # WARNING: this file contains a .tab dependency on .bin files. If you # have files generated by a wx200d version less than 0.7, then many of # your .tab files may get regenerated! TO PREVENT THIS, run fixtime # from the wx200d source distribution before using this Makefile! # Some of this, especially the functions, is probably GNU make # specific. With VPATH set to the data directory, the html can be # placed in a separate directory by linking this Makefile to there. # Then an example cron job might look like: # 5 0 * * * cd ${prefix}/share/wx200d && make > /dev/null # 25 0 * * * cd ${prefix}/share/wx200d/html && make html > /dev/null prefix = /usr/local exec_prefix = ${prefix} # path to the .bin, .tab, .day, .mon data logs: VPATH := ${prefix}/share/wx200d # path to the perl scripts that do the conversions: wxsum = ${exec_prefix}/sbin/wxsum wxhtml = ${exec_prefix}/sbin/wxplot2html wxindex = ${exec_prefix}/sbin/wxindex rrdu = ${exec_prefix}/sbin/wxrrdupdate rrdg = ${exec_prefix}/sbin/wxrrdgraph # the (optional?) RRDtool database filename rrd = wx200d.rrd # hacks to get list of needed .day, .mon, and .html files month := $(sort $(shell cd $(VPATH) ; ls -1 *.bin.gz *.tab.gz | cut -b 1-6)) mons := $(addsuffix .mon,$(month)) html := $(addsuffix .html,$(month)) days := $(foreach file,$(wildcard *.tab.gz),$(subst .tab.gz,.day,$(file))) tabs := $(foreach file,$(wildcard *.bin.gz),$(subst .bin.gz,.tab.gz,$(file))) tab := $(wildcard *.tab) all: $(days) $(MAKE) mons tabs: $(tabs) days: $(days) mons: $(mons) html: $(html) .PHONY: clean # the foreach returns the month that the day affects %.day: %.tab.gz zcat $< | $(wxsum) > $@ \ && touch $(foreach mon,$(month),$(findstring $(mon),$*)) %.mon: % $(wxsum) $(filter $*%,$(days)) > $@ %.html: %.mon $(wxhtml) --month $* \ && $(wxindex) > wx200.html # WARNING: run fixtime from the source distribution first! %.tab.gz: %.bin.gz zcat $< | wxfilter | gzip > $@ %.rrd: $(tab) $(rrdu) $@ *.tab* %.png: $(rrd) $(rrdg) $<