.SUFFIXES: .in .pl

PERL5		=	@PERL5@
USER		=	@USER@
WEB_DIARY_DIR	=	@WEB_DIARY_DIR@
LIBDIR		=	@LIBDIR@

MTA_CTRL_FILE	=	dot.forward
#MTA_CTRL_FILE	=	dot.qmail

TARGET		=	mail2tdf.pl ${MTA_CTRL_FILE}


################################################################
all:    ${TARGET}

mail2tdf.pl:	mail2tdf.pl.in
	sed 's!%PerlPath%!${PERL5}!g; s!%WebDiaryDir%!${WEB_DIARY_DIR}!g; s!%LibDir%!${LIBDIR}!g' $? > $@

# for MTA
dot.forward:	dot.forward.in
	sed 's!%PerlPath%!@PERL5@!g; s!%User%!${USER}!g; s!%WebDiaryDir%!${WEB_DIARY_DIR}!g' $? > $@

dot.qmail:	dot.qmail.in
	sed 's!%PerlPath%!@PERL5@!g; s!%Home%!${HOME}!g; s!%WebDiaryDir%!${WEB_DIARY_DIR}!g' $? > $@

# install
install:	${TARGET}
	cp mail2tdf.pl ${WEB_DIARY_DIR}
	cp ${MTA_CTRL_FILE} ${HOME}
	chmod 600 ${MTA_CTRL_FILE}

clean:
	rm -f ${TARGET}


