prefix		= /usr
localstatedir	= /var/run/teapop
exec_prefix	= /usr
sbindir		= ${exec_prefix}/sbin
popauth_file	= no

CHMOD    = /bin/chmod
INSTALL  = /usr/bin/install -c
MV       = /bin/mv
RM       = /bin/rm
SED      = /bin/sed

build:
	@ echo Creating cronpopauth.pl;					\
	${SED} -e 's%@_PERL@%/usr/bin/perl%g'					\
	cronpopauth.pl.in						\
	| ${SED} -e 's%@_localstatedir@%/var/run/teapop%g'		\
	| ${SED} -e 's%@_sbindir@%${exec_prefix}/sbin%g'				\
	| ${SED} -e 's%@_popauth_file@%no%g'		\
	> cronpopauth.pl ;						\
	${CHMOD} 0755 cronpopauth.pl;					\

install: build
	@ echo Installing cronpopauth.pl;				\
	${INSTALL} -d ${DESTDIR}/${sbindir};				\
	${INSTALL} cronpopauth.pl ${DESTDIR}/${sbindir};		\

makefile: ../config/timestamp
	@ echo Updating Makefile
	@ if [ -f Makefile.tmp ]; then					\
		echo "Please remove Makefile.tmp";			\
		false;							\
	fi
	@ ${MV} Makefile Makefile.tmp
	@ ${SED} -e 's%^INSTALL *= *\.\..*%INSTALL  = ../config/install-sh -c%'\
		Makefile.tmp > Makefile
	@ ${RM} Makefile.tmp

../config/timestamp:
	@ echo Please run the configure script first
	@ false

depend:

clean:
	${RM} -f cronpopauth.pl

distclean: clean
	${RM} -f Makefile
