### @(#)$Id: Makefile,v 1.6 2003/06/29 22:19:16 christopher Exp $
#
# The primary purpose of this Makefile is to build the RPM file
# necessary to effect installation of the package.  Web-based
# help on building RPM packages can be found at:
#	http://www.rpm.org/RPM-HOWTO/
#	http://www.redhat.com/docs/books/max-rpm/max-rpm.pdf
#	http://www.clarkconnect.org/devel/rpm.html
#
# Author: Christopher Rath <christopher@rath.ca>
###

VERSION = 1.3

TOPDIR = ${HOME}/Developer/rpmbuild

SOURCES = 20_refreshSG.txt icon_refreshSG.png refreshSG refreshSG.conf	\
	refreshSG.1 refreshSG_help.php refreshSG.php logrot_refreshSG	\
	ReleaseNotes.txt

RPMDIRS = BUILD SOURCES SPECS RPMS RPMS/i386 RPMS/noarch SRPMS

###
# Rules for compilation from the command line.
###
help:
	@echo "!!"
	@echo "!! You can't simply type make.  Choose a target:"
	@echo "!!   build -> build the RPM files."
	@echo "!!   mktest -> install files locally to run a test."
	@echo "!!"

build:
	-@rm -rf ${TOPDIR} ;						\
	mkdir ${TOPDIR} ;						\
	( cd ${TOPDIR} ; mkdir ${RPMDIRS} ) ;				\
	if [ -d /tmp/refreshSG-${VERSION} ] ;				\
	then								\
	  rm -rf /tmp/refreshSG-${VERSION} ;				\
	fi ;								\
	mkdir /tmp/refreshSG-${VERSION} ;				\
	cp ${SOURCES} /tmp/refreshSG-${VERSION} ;			\
	( cd /tmp ; 							\
	    tar -czf ${TOPDIR}/SOURCES/refreshSG-${VERSION}.tar.gz	\
		 refreshSG-${VERSION} ); 				\
	rm -rf /tmp/refreshSG-${VERSION} ;				\
	cp refreshSG.spec ${TOPDIR}/SPECS/refreshSG-${VERSION}.spec ;	\
	( cd ${TOPDIR} ; rpm -bb SPECS/refreshSG-${VERSION}.spec )

mktest:
	-@sudo cp 20_refreshSG.txt /var/webconfig/htdocs/menus ;	\
	sudo cp refreshSG /usr/local/refreshSG/ ;			\
	sudo cp refreshSG.conf /usr/local/refreshSG/ ;			\
	sudo cp ReleaseNotes.txt /usr/local/refreshSG/ ;		\
	sudo chmod 666 /usr/share/man/man1/refreshSG.1.gz ;		\
	sudo gzip <refreshSG.1 >/usr/share/man/man1/refreshSG.1.gz ; 	\
	sudo chmod 644 /usr/share/man/man1/refreshSG.1.gz ;		\
	sudo cp icon_refreshSG.png /var/webconfig/htdocs/images ;	\
	sudo cp logrot_refreshSG /etc/logrotate.d/refreshSG ;		\
	sudo cp refreshSG.php refreshSG_help.php /var/webconfig/htdocs/admin

