Makefile revision 100872
138102Speter#	@(#)Makefile	8.19 (Berkeley) 1/14/97
250472Speter# $FreeBSD: head/etc/sendmail/Makefile 100872 2002-07-29 09:40:17Z ru $
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
2591187SgshapiroALL=		freebsd.cf
2691187SgshapiroCLEANFILES+=	freebsd.cf
2738102Speter
2872846Sgshapiro# Local SENDMAIL_MC or SENDMAIL_CF may be set in /etc/make.conf.
2972846Sgshapiro# Warning! If set, this causes 'make install' to always copy it
3072846Sgshapiro# over /etc/mail/sendmail.cf!!!
3138102Speter# Caveat emptor!  Be sure you want this before you enable it.
3272846Sgshapiro.if defined(SENDMAIL_MC)
3372846SgshapiroINSTALL_CF=	${SENDMAIL_MC:R}.cf
3472846Sgshapiro.else
3538102Speter.if defined(SENDMAIL_CF)
3672846SgshapiroINSTALL_CF=	${SENDMAIL_CF}
3738102Speter.endif
3872846Sgshapiro.endif
3938102Speter
4094676Sgshapiro.ifndef SENDMAIL_SET_USER_ID
4194676Sgshapiro.if defined(SENDMAIL_SUBMIT_MC)
4294676SgshapiroINSTALL_SUBMIT_CF=${SENDMAIL_SUBMIT_MC:R}.cf
4394676Sgshapiro.endif
4494676Sgshapiro.endif
4594676Sgshapiro
4680176SgshapiroDEST_CF=	${DESTDIR}/etc/mail/sendmail.cf
4794676SgshapiroDEST_SUBMIT_CF=	${DESTDIR}/etc/mail/submit.cf
4880176Sgshapiro
4994676SgshapiroALL+=		${INSTALL_CF} ${INSTALL_SUBMIT_CF}
5072846Sgshapiro
5191187Sgshapiro# Make sure we don't remove /etc/mail/sendmail.cf on make clean
5291187Sgshapiro# since this will break a running system during a buildworld.
5391187Sgshapiro.if defined(INSTALL_CF)
5491187Sgshapiro.if ${INSTALL_CF} != ${DEST_CF}
5591187SgshapiroCLEANFILES+=	${INSTALL_CF}
5691187Sgshapiro.endif
5791187Sgshapiro.endif
5891187Sgshapiro
5994676Sgshapiro.if defined(INSTALL_SUBMIT_CF)
6094676Sgshapiro.if ${INSTALL_SUBMIT_CF} != ${DEST_SUBMIT_CF}
6194676SgshapiroCLEANFILES+=	${INSTALL_SUBMIT_CF}
6294676Sgshapiro.endif
6394676Sgshapiro.endif
6494676Sgshapiro
6572918Sgshapiro# Additional .cf files to build
6672918Sgshapiro.if defined(SENDMAIL_ADDITIONAL_MC)
6786639SgshapiroSENDMAIL_ADDITIONAL_CF=	${SENDMAIL_ADDITIONAL_MC:S/.mc$/.cf/g}
6886639SgshapiroALL+=		${SENDMAIL_ADDITIONAL_CF}
6991187SgshapiroCLEANFILES+=	${SENDMAIL_ADDITIONAL_CF}
7072918Sgshapiro.endif
7172918Sgshapiro
7273210Sgshapiroall:		${ALL}
7338102Speter
7438102Speterdepend:
7538102Speter
7694676Sgshapiroinstall:	${INSTALL_CF} ${INSTALL_SUBMIT_CF}
7772846Sgshapiro.if (defined(SENDMAIL_MC) && defined(SENDMAIL_CF))
7872846Sgshapiro	@echo ">>> ERROR: Both SENDMAIL_CF and SENDMAIL_MC can not be set"
7972846Sgshapiro	@false
8072846Sgshapiro.endif
8173210Sgshapiro.if defined(INSTALL_CF)
8280176Sgshapiro.if ${INSTALL_CF} != ${DEST_CF}
83100872Sru	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${INSTALL_CF} \
8480176Sgshapiro		${DEST_CF}
8538102Speter.endif
8694676Sgshapiro.endif
8786639Sgshapiro.if defined(SENDMAIL_ADDITIONAL_CF)
88100872Sru	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
8986639Sgshapiro		${SENDMAIL_ADDITIONAL_CF} ${DESTDIR}/etc/mail
9080176Sgshapiro.endif
9194676Sgshapiro.ifndef SENDMAIL_SET_USER_ID
9294676Sgshapiro.if defined(INSTALL_SUBMIT_CF)
9394676Sgshapiro.if ${INSTALL_SUBMIT_CF} != ${DEST_SUBMIT_CF}
94100872Sru	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
9594676Sgshapiro		${INSTALL_SUBMIT_CF} ${DEST_SUBMIT_CF}
9686639Sgshapiro.endif
9794676Sgshapiro.endif
9894676Sgshapiro.endif
9938102Speter
10038102Speter# Helper for src/etc/Makefile
10194676Sgshapirodistribution:	freebsd.cf freebsd.mc ${INSTALL_CF} ${INSTALL_SUBMIT_CF}
10272846Sgshapiro.if (defined(SENDMAIL_MC) && defined(SENDMAIL_CF))
10372846Sgshapiro	@echo ">>> ERROR: Both SENDMAIL_CF and SENDMAIL_MC can not be set"
10472846Sgshapiro	@false
10572846Sgshapiro.endif
106100872Sru	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/freebsd.mc \
10772845Sgshapiro		${DESTDIR}/etc/mail/freebsd.mc
108100872Sru	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 freebsd.cf \
10972845Sgshapiro		${DESTDIR}/etc/mail/freebsd.cf
11072846Sgshapiro.if defined(INSTALL_CF)
11180176Sgshapiro.if ${INSTALL_CF} != ${DEST_CF}
112100872Sru	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${INSTALL_CF} \
11380176Sgshapiro		${DEST_CF}
11480176Sgshapiro.endif
11572846Sgshapiro.else
116100872Sru	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 freebsd.cf \
11780176Sgshapiro		${DEST_CF}
11872846Sgshapiro.endif
119100872Sru	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 ${CFDIR}/cf/submit.mc \
12094676Sgshapiro	    ${DESTDIR}/etc/mail/freebsd.submit.mc
121100872Sru	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 ${CFDIR}/cf/submit.cf \
12294676Sgshapiro	    ${DESTDIR}/etc/mail/freebsd.submit.cf
12394676Sgshapiro.ifndef SENDMAIL_SET_USER_ID
12494676Sgshapiro.if defined(INSTALL_SUBMIT_CF)
12594676Sgshapiro.if ${INSTALL_SUBMIT_CF} != ${DEST_SUBMIT_CF}
126100872Sru	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
12794676Sgshapiro		${INSTALL_SUBMIT_CF} ${DEST_SUBMIT_CF}
12890802Sgshapiro.endif
12994676Sgshapiro.else
130100872Sru	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 ${CFDIR}/cf/submit.cf \
13194676Sgshapiro	    ${DEST_SUBMIT_CF}
13294676Sgshapiro.endif
13394676Sgshapiro.endif
134100872Sru	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 ${SMDIR}/helpfile \
13573250Sgshapiro	    ${DESTDIR}/etc/mail/helpfile
136100872Sru	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \
13772846Sgshapiro	    ${DESTDIR}/var/log/sendmail.st
13838102Speter
13938102Speter.include <bsd.prog.mk>
140