#
# Assumption here is GNU-make!
#

srcdir = @srcdir@
# VPATH = @srcdir@ ## NO VPATH HERE!
@SET_MAKE@

#prefix=		@prefix@
MANDIR=		$(prefix)@MANDIR@
TOPDIR=		..
S=		$(TOPDIR)/$(srcdir)/man
INSTALL=	@INSTALL@

MAN1=	mailq.1 mailrm.1 newaliases.1 rmail.1 ssl.1 vacation.1 zmailer.1 zmsh.1 mboxpath.1
MAN3=	zmailer.3 authuser.3
MAN5=	aliases.5
MAN8=	errormail.8 hold.8 router.8 scheduler.8 sendmail.8 sm.8 smtp.8 smtpserver.8 manual-expirer.8 expirer.8 mprobe.8 mailbox.8

FRC:
	@echo "make install MANDIR=/usr/man"
	@echo "make groff"
	@echo "make html"
	@echo "make clean"

clean:
	rm -rf *~
	if [ "$(srcdir)" != "" ]; then rm -f *.ps *.html; fi

distclean:
	rm -rf *~ vacation.1

depend:

groff: $(patsubst %, %.ps, $(MAN1) $(MAN3) $(MAN5) $(MAN8))
html:  $(patsubst %, %.html, $(MAN1) $(MAN3) $(MAN5) $(MAN8))
	-rm -f index.html
	(echo "<HTML><HEAD><TITLE>ZMailer man-pages</TITLE></HEAD>";	 \
	 echo "<BODY>";							 \
	 for x in *.html; do echo "<P><A HREF="'"'$$x'"'">$$x</A></P>";done; \
	 echo "</BODY></HTML>") > man-index.html

install:
	if [ ! -d ${MANDIR}/man1 ] ; then mkdir -p ${MANDIR}/man1 ; fi
	if [ ! -d ${MANDIR}/man5 ] ; then mkdir -p ${MANDIR}/man5 ; fi
	if [ ! -d ${MANDIR}/man8 ] ; then mkdir -p ${MANDIR}/man8 ; fi
	$(INSTALL) -m 644 $S/aliases.5	${MANDIR}/man5
	$(INSTALL) -m 644 $S/errormail.8 ${MANDIR}/man8
	$(INSTALL) -m 644 $S/hold.8	${MANDIR}/man8
	$(INSTALL) -m 644 $S/mailbox.8	${MANDIR}/man8
	$(INSTALL) -m 644 $S/mailq.1	${MANDIR}/man1
	$(INSTALL) -m 644 $S/mboxpath.1	${MANDIR}/man1
	$(INSTALL) -m 644 $S/mailrm.1	${MANDIR}/man1
	$(INSTALL) -m 644 $S/newaliases.1 ${MANDIR}/man1
	$(INSTALL) -m 644 $S/rmail.1	${MANDIR}/man1
	$(INSTALL) -m 644 $S/router.8	${MANDIR}/man8
	$(INSTALL) -m 644 $S/scheduler.8 ${MANDIR}/man8
	$(INSTALL) -m 644 $S/sendmail.8	${MANDIR}/man8
	$(INSTALL) -m 644 $S/sm.8	${MANDIR}/man8
	$(INSTALL) -m 644 $S/smtp.8	${MANDIR}/man8
	$(INSTALL) -m 644 $S/smtpserver.8 ${MANDIR}/man8
	$(INSTALL) -m 644 $S/mprobe.8	${MANDIR}/man8
	$(INSTALL) -m 644 $S/ssl.1	${MANDIR}/man1
	$(INSTALL) -m 644 $S/zmailer.1	${MANDIR}/man1
	$(INSTALL) -m 644 $S/zmailer.3	${MANDIR}/man3
	$(INSTALL) -m 644 $S/manual-expirer.8 ${MANDIR}/man8
	$(INSTALL) -m 644 $S/expirer.8	${MANDIR}/man8
	$(INSTALL) -m 644 $S/zmsh.1	${MANDIR}/man1
	$(INSTALL) -m 644 vacation.1	${MANDIR}/man1


aliases.5.ps: $(srcdir)/aliases.5
	groff -man $< > $@
authuser.3.ps: $(srcdir)/authuser.3
	groff -man $< > $@
mailq.1.ps: $(srcdir)/mailq.1
	groff -man $< > $@
mailrm.1.ps: $(srcdir)/mailrm.1
	groff -man $< > $@
newaliases.1.ps: $(srcdir)/newaliases.1
	groff -man $< > $@
rmail.1.ps: $(srcdir)/rmail.1
	groff -man $< > $@
ssl.1.ps: $(srcdir)/ssl.1
	groff -man $< > $@
vacation.1.ps: vacation.1
	groff -man $< > $@
zmailer.1.ps: $(srcdir)/zmailer.1
	groff -man $< > $@
zmsh.1.ps: $(srcdir)/zmsh.1
	groff -man $< > $@
zmailer.3.ps: $(srcdir)/zmailer.3
	groff -man $< > $@
errormail.8.ps: $(srcdir)/errormail.8
	groff -man $< > $@
hold.8.ps: $(srcdir)/hold.8
	groff -man $< > $@
router.8.ps: $(srcdir)/router.8
	groff -man $< > $@
scheduler.8.ps: $(srcdir)/scheduler.8
	groff -man $< > $@
sendmail.8.ps: $(srcdir)/sendmail.8
	groff -man $< > $@
sm.8.ps: $(srcdir)/sm.8
	groff -man $< > $@
smtp.8.ps: $(srcdir)/smtp.8
	groff -man $< > $@
smtpserver.8.ps: $(srcdir)/smtpserver.8
	groff -man $< > $@
manual-expirer.8.ps: $(srcdir)/manual-expirer.8
	groff -man $< > $@
expirer.8.ps: $(srcdir)/expirer.8
	groff -man $< > $@
mprobe.8.ps: $(srcdir)/mprobe.8
	groff -man $< > $@
mailbox.8.ps: $(srcdir)/mailbox.8
	groff -man $< > $@
mboxpath.1.ps: $(srcdir)/mboxpath.1
	groff -man $< > $@



aliases.5.html: $(srcdir)/aliases.5
	groff -man -Thtml $< > $@
authuser.3.html: $(srcdir)/authuser.3
	groff -man -Thtml $< > $@
mailq.1.html: $(srcdir)/mailq.1
	groff -man -Thtml $< > $@
mailrm.1.html: $(srcdir)/mailrm.1
	groff -man -Thtml $< > $@
newaliases.1.html: $(srcdir)/newaliases.1
	groff -man -Thtml $< > $@
rmail.1.html: $(srcdir)/rmail.1
	groff -man -Thtml $< > $@
ssl.1.html: $(srcdir)/ssl.1
	groff -man -Thtml $< > $@
vacation.1.html: vacation.1
	groff -man -Thtml $< > $@
zmailer.1.html: $(srcdir)/zmailer.1
	groff -man -Thtml $< > $@
zmsh.1.html: $(srcdir)/zmsh.1
	groff -man -Thtml $< > $@
zmailer.3.html: $(srcdir)/zmailer.3
	groff -man -Thtml $< > $@
errormail.8.html: $(srcdir)/errormail.8
	groff -man -Thtml $< > $@
hold.8.html: $(srcdir)/hold.8
	groff -man -Thtml $< > $@
router.8.html: $(srcdir)/router.8
	groff -man -Thtml $< > $@
scheduler.8.html: $(srcdir)/scheduler.8
	groff -man -Thtml $< > $@
sendmail.8.html: $(srcdir)/sendmail.8
	groff -man -Thtml $< > $@
sm.8.html: $(srcdir)/sm.8
	groff -man -Thtml $< > $@
smtp.8.html: $(srcdir)/smtp.8
	groff -man -Thtml $< > $@
smtpserver.8.html: $(srcdir)/smtpserver.8
	groff -man -Thtml $< > $@
manual-expirer.8.html: $(srcdir)/manual-expirer.8
	groff -man -Thtml $< > $@
expirer.8.html: $(srcdir)/expirer.8
	groff -man -Thtml $< > $@
mprobe.8.html: $(srcdir)/mprobe.8
	groff -man -Thtml $< > $@
mailbox.8.html: $(srcdir)/mailbox.8
	groff -man -Thtml $< > $@
mboxpath.1.html: $(srcdir)/mboxpath.1
	groff -man -Thtml $< > $@
