Makefile revision 86639
138102Speter#	@(#)Makefile	8.19 (Berkeley) 1/14/97
250472Speter# $FreeBSD: head/etc/sendmail/Makefile 86639 2001-11-20 03:41:05Z gshapiro $
338102Speter
473210SgshapiroM4=		m4
573210SgshapiroCHMOD=		chmod
673210SgshapiroROMODE=		444
773210SgshapiroRM=		rm -f
838102Speter
973250SgshapiroSENDMAIL_DIR=	${.CURDIR}/../../contrib/sendmail
1073250SgshapiroSMDIR=		${SENDMAIL_DIR}/src
1173250SgshapiroCFDIR=		${SENDMAIL_DIR}/cf
1273250Sgshapiro
1373210Sgshapiro# this is overkill, but....
1473210SgshapiroM4FILES!=	find ${CFDIR} -type f -name '*.m4' -print
1538102Speter
1673210Sgshapiro.SUFFIXES:	.mc .cf
1773210Sgshapiro
1873210Sgshapiro.mc.cf:		${M4FILES}
1973210Sgshapiro	${RM} ${.TARGET}
2038102Speter	(cd ${.CURDIR} && \
2180175Sgshapiro	    ${M4} -D_CF_DIR_=${CFDIR}/ ${SENDMAIL_M4_FLAGS} \
2280175Sgshapiro		${CFDIR}/m4/cf.m4 ${@:R}.mc) > ${.TARGET}
2373210Sgshapiro	${CHMOD} ${ROMODE} ${.TARGET}
2438102Speter
2538102SpeterALL=	freebsd.cf
2638102Speter
2772846Sgshapiro# Local SENDMAIL_MC or SENDMAIL_CF may be set in /etc/make.conf.
2872846Sgshapiro# Warning! If set, this causes 'make install' to always copy it
2972846Sgshapiro# over /etc/mail/sendmail.cf!!!
3038102Speter# Caveat emptor!  Be sure you want this before you enable it.
3172846Sgshapiro.if defined(SENDMAIL_MC)
3272846SgshapiroINSTALL_CF=	${SENDMAIL_MC:R}.cf
3372846Sgshapiro.else
3438102Speter.if defined(SENDMAIL_CF)
3572846SgshapiroINSTALL_CF=	${SENDMAIL_CF}
3638102Speter.endif
3772846Sgshapiro.endif
3838102Speter
3980176SgshapiroDEST_CF=	${DESTDIR}/etc/mail/sendmail.cf
4080176Sgshapiro
4173210SgshapiroALL+=		${INSTALL_CF}
4272846Sgshapiro
4372918Sgshapiro# Additional .cf files to build
4472918Sgshapiro.if defined(SENDMAIL_ADDITIONAL_MC)
4586639SgshapiroSENDMAIL_ADDITIONAL_CF=	${SENDMAIL_ADDITIONAL_MC:S/.mc$/.cf/g}
4686639SgshapiroALL+=		${SENDMAIL_ADDITIONAL_CF}
4772918Sgshapiro.endif
4872918Sgshapiro
4973210SgshapiroCLEANFILES+=	${ALL}
5038102Speter
5173210Sgshapiroall:		${ALL}
5238102Speter
5338102Speterdepend:
5438102Speter
5573210Sgshapiroinstall:	${INSTALL_CF}
5672846Sgshapiro.if (defined(SENDMAIL_MC) && defined(SENDMAIL_CF))
5772846Sgshapiro	@echo ">>> ERROR: Both SENDMAIL_CF and SENDMAIL_MC can not be set"
5872846Sgshapiro	@false
5972846Sgshapiro.endif
6073210Sgshapiro.if defined(INSTALL_CF)
6180176Sgshapiro.if ${INSTALL_CF} != ${DEST_CF}
6272846Sgshapiro	${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 ${INSTALL_CF} \
6380176Sgshapiro		${DEST_CF}
6438102Speter.endif
6586639Sgshapiro.if defined(SENDMAIL_ADDITIONAL_CF)
6686639Sgshapiro	${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 \
6786639Sgshapiro		${SENDMAIL_ADDITIONAL_CF} ${DESTDIR}/etc/mail
6880176Sgshapiro.endif
6986639Sgshapiro.endif
7038102Speter
7138102Speter# Helper for src/etc/Makefile
7273210Sgshapirodistribution:	freebsd.cf freebsd.mc ${INSTALL_CF}
7372846Sgshapiro.if (defined(SENDMAIL_MC) && defined(SENDMAIL_CF))
7472846Sgshapiro	@echo ">>> ERROR: Both SENDMAIL_CF and SENDMAIL_MC can not be set"
7572846Sgshapiro	@false
7672846Sgshapiro.endif
7772845Sgshapiro	${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/freebsd.mc \
7872845Sgshapiro		${DESTDIR}/etc/mail/freebsd.mc
7938102Speter	${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 freebsd.cf \
8072845Sgshapiro		${DESTDIR}/etc/mail/freebsd.cf
8172846Sgshapiro.if defined(INSTALL_CF)
8280176Sgshapiro.if ${INSTALL_CF} != ${DEST_CF}
8372846Sgshapiro	${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 ${INSTALL_CF} \
8480176Sgshapiro		${DEST_CF}
8580176Sgshapiro.endif
8672846Sgshapiro.else
8772845Sgshapiro	${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 freebsd.cf \
8880176Sgshapiro		${DEST_CF}
8972846Sgshapiro.endif
9073250Sgshapiro	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 ${SMDIR}/helpfile \
9173250Sgshapiro	    ${DESTDIR}/etc/mail/helpfile
9272846Sgshapiro	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
9372846Sgshapiro	    ${DESTDIR}/var/log/sendmail.st
9438102Speter
9538102Speter.include <bsd.prog.mk>
96