##########################################################################
 #  Copyright 2004 by Floyd L. Davidson
 #
 #  This program is free software; you can redistribute it
 #  and/or modify it under the terms of the GNU General Public
 #  License as published by the Free Software Foundation;
 #  either version 2, or (at your option) any later version.
 #
 #  This program is distributed in the hope that it will be
 #  useful, but WITHOUT ANY WARRANTY; without even the implied
 #  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 #  PURPOSE.  See the GNU General Public License for details.
 #
 #
##########################################################################
##########################################################################
#
#  Makefile           --  Makefile for an hanced variation
#                         of tellerstats
#
#  $Id: Makefile,v 1.1.0.12 2004/09/14 03:59:16 floyd Exp floyd $
#
##########################################################################
#
#  Copyright 2004 by Floyd Davidson, floyd@barrow.com
#  File created:  Mon Sep  6 03:57:49 2004
#  Last updated:  Tue Sep  7 06:23:37 2004
#
##########################################################################

#
#  Change this to the directory of your homepage.
#
HOMEPAGE = "/home/homepage"


SHELL = /bin/sh
.SUFFIXES:

help:
	@echo "Please examine this Makefile before using it!"
	@echo "\"make install\" does the following:"
	@echo ""
	@echo "  gather.sh and tellerstats.sh are put into the"
	@echo "  /usr/local/bin directory."
	@echo ""
	@echo "  tellerstats.conf is put into /etc."
	@echo ""
	@echo "  A directory /usr/local/stats is created, and"
	@echo "  file gnuplotscript.tmpl is copied to it."
	@echo ""
	@echo "  A directory /var/log/sensordata is created,"
	@echo "  and the gather.sh script is configured by"
	@echo "  /etc/tellerstats.conf to keep collected sensor"
	@echo "  data files there."
	@echo ""
	@echo "  The variable HOMEPAGE must be configured for"
	@echo "  your system.  It is currently set to ${HOMEPAGE}."
	@echo "  A directory ${HOMEPAGE}/stats will be created for"
	@echo "  finished image files and HTML code to display them."
	@echo "  The file index.tmpl is copied to that directory and"
	@echo "  is used by tellerstats.sh to create files"
	@echo "  index.html (used for 1024x768 resolution) and"
	@echo "  index1.html (used for viewing at 800x600)."
	@echo ""

#
install:
	@if ! test -d /usr/local/stats ; then \
	mkdir /usr/local/stats; fi
	@if ! test -d /var/log/sensordata ; then \
	mkdir /var/log/sensordata; fi
	@if ! test -d /home/homepage/sensors ; then \
	mkdir ${HOMEPAGE}/sensors; fi
	cp tellerstats.sh   /usr/local/sbin/
	cp gather.sh        /usr/local/sbin/
	cp tellerstats.conf /etc/
	cp index.tmpl       /home/homepage/sensors/
	cp gnuplotscript.tmpl /usr/local/stats
	@chmod 755 /usr/local/stats/
	@chmod 755 /var/log/sensordata/
	@chmod 755 /home/homepage/sensors/
	@chmod 755 /usr/local/sbin/tellerstats.sh
	@chmod 755 /usr/local/sbin/gather.sh
	@chmod 644 /etc/tellerstats.conf
	@chmod 644 /usr/local/stats/gnuplotscript.tmpl