#
# Makefile for the shun firewall tool.
#
#Copyleft:
#    shun blocks all IP communication with shunned hosts.
#    Copyright (C) 2001 William Stearns <wstearns@pobox.com>
#
#    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 of the License, 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 more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#    The author can also be reached at:
#        William Stearns
#email:  wstearns@pobox.com              (preferred)
#web:    http://www.pobox.com/~wstearns
#snail:  544 Winchester Place
#        Colchester VT, 05446, USA
#

# Modified for Debian GNU/Linux.
DESTDIR =

##Make sure shun has SHUNVER updated when this changes
SHUNVER = 0.2

#No quotes around multi file specs.
BINDIR=$(DESTDIR)/sbin/
BINFILES=shun
DOCDIR=$(DESTDIR)/usr/share/doc/shun-${SHUNVER}/
DOCFILES=AUTHORS COPYING CREDITS ChangeLog INSTALL Makefile NEWS README TODO index.html shun.txt



install:
	@echo -n "Installing files... "
	@echo -n "bin directory... "
	@install -o root -g root -m 0755 -d ${BINDIR}
	@echo -n "${BINFILES}... "
	@install -o root -g root -m 0644 ${BINFILES} ${BINDIR}
	@echo -n "doc directory... "
	@install -o root -g root -m 0755 -d ${DOCDIR}
	@echo -n "${DOCFILES}... "
	@install -o root -g root -m 0644 ${DOCFILES} ${DOCDIR}
	@echo done!

#regress:
#	@if ./samlib regression-test ; then \
#	echo Regression test succeeded. ; \
#	else \
#	echo Regression test failed, exiting. ; \
#	exit 1 ; \
#	fi

distribs: #regress
	@echo This should only need to be used by the author in 
	@echo packing up the shun package.
	cd .. \
	&& tar cf - shun-${SHUNVER}/ | \
	gzip -9 > shun-${SHUNVER}.tar.gz \
	&& rm -f shun-current \
	&& ln -sf shun-${SHUNVER} shun-current \
	&& tar cf - shun-current/* | \
	gzip -9 > shun-current.tar.gz \
	&& cp shun-${SHUNVER}.tar.gz /usr/src/redhat/SOURCES/ \
	&& cd shun-${SHUNVER} \
	&& cp -f redhat/shun.spec /usr/src/redhat/SPECS/ \
	&& rpm --sign -ba /usr/src/redhat/SPECS/shun.spec \
	&& mv -f /usr/src/shun-*.tar.gz /usr/src/mysource/ \
	&& mv -f /usr/src/redhat/RPMS/noarch/shun-*.noarch.rpm /usr/src/mysource/ \
	&& mv -f /usr/src/redhat/SRPMS/shun-*.src.rpm /usr/src/mysource/

mini-install:
	@if [ ! -f ${BINDIR} ]; then \
	mkdir -p ${BINDIR} ; \
	fi
	cp -pf shun ${BINDIR}