# $Id: Makefile,v 1.25 2005/04/24 11:02:15 marc Exp $

SUBDIR= backend bin etc

.include <bsd.subdir.mk> 

NAME=smtp-vilter
VERSION!=grep VERSION include/smtp-vilter.h | awk '{print $$3}' | tr -d \"

DIST=${NAME}-${VERSION}.tgz
MD5=${NAME}-${VERSION}.md5

PUBDIR=/var/www/ftp/pub/sources/smtp-vilter

PRINT=	a2ps
PFLAGS=	-E -g -C -T 4 --header="${NAME}-${VERSION}" -o -
LPR= lpr -o sides=two-sided-long-edge

OS!=uname -s

.if ${OS} == "FreeBSD"
SUBDIR=compat backend bin etc
.endif

allclean: cleandir

dist: allclean
	(cd ..; tar czvf ${DIST} `find ${NAME}-${VERSION} -type f | grep -v CVS`; md5 ${DIST} > ${MD5})

distfile: dist
	(cd ..; cp ${DIST} /usr/ports/distfiles)

publish: cleandir
	mkdir -p ${PUBDIR}
	(cd ..; tar -czvf ${PUBDIR}/${DIST} -s \
		/${NAME}/${NAME}-${VERSION}/ \
		`find ${NAME} -type f | grep -v CVS | grep -v vilter-regexp | \
		grep -v vilter-test | grep -v vilter-kavd`; \
		md5 ${PUBDIR}/${DIST} > ${PUBDIR}/${MD5})
	groff -Thtml -P "-t" -mandoc bin/${NAME}/${NAME}.8 > \
		${PUBDIR}/${NAME}.8.html
	groff -Thtml -P "-t" -mandoc bin/${NAME}/${NAME}.conf.5 > \
		${PUBDIR}/${NAME}.conf.5.html

print: allclean
	find . -type f -exec ${PRINT} ${PFLAGS} {} \| ${LPR}\;
