freebsd-dev/etc/sendmail/Makefile
Gregory Neil Shapiro f92921ddff Build the submit.cf file instead of installing the version that ships
with the vendor sendmail distribution.  By doing so, we avoid mergemaster
warnings after every 'make' in /etc/mail/.

Reported by:	Jeremy Chadwick <koitsu@parodius.com>
MFC after:	3 days
X-MFC after:	and re approval
2003-09-01 03:40:33 +00:00

109 lines
3.2 KiB
Makefile

# @(#)Makefile 8.19 (Berkeley) 1/14/97
# $FreeBSD$
M4= m4
CHMOD= chmod
ROMODE= 444
RM= rm -f
SENDMAIL_DIR= ${.CURDIR}/../../contrib/sendmail
SMDIR= ${SENDMAIL_DIR}/src
CFDIR= ${SENDMAIL_DIR}/cf
# this is overkill, but....
M4FILES!= find ${CFDIR} -type f -name '*.m4' -print
.SUFFIXES: .mc .cf
.mc.cf: ${M4FILES}
${RM} ${.TARGET}
${M4} -D_CF_DIR_=${CFDIR}/ ${SENDMAIL_M4_FLAGS} \
${CFDIR}/m4/cf.m4 ${.IMPSRC} > ${.TARGET}
${CHMOD} ${ROMODE} ${.TARGET}
DEST_CF= ${DESTDIR}/etc/mail/sendmail.cf
DEST_SUBMIT_CF= ${DESTDIR}/etc/mail/submit.cf
ALL= freebsd.cf freebsd.submit.cf
CLEANFILES= freebsd.cf freebsd.submit.cf
# Local SENDMAIL_MC or SENDMAIL_CF may be set in /etc/make.conf.
# Warning! If set, this causes 'make install' to always copy it
# over /etc/mail/sendmail.cf!!!
# Caveat emptor! Be sure you want this before you enable it.
.if defined(SENDMAIL_MC)
INSTALL_CF= ${SENDMAIL_MC:T:R}.cf
ALL+= ${INSTALL_CF}
CLEANFILES+= ${SENDMAIL_MC:T:R}.cf
${INSTALL_CF}: ${SENDMAIL_MC}
.elif defined(SENDMAIL_CF)
ALL+= ${SENDMAIL_CF}
INSTALL_CF= ${SENDMAIL_CF}
.endif
.if !defined(SENDMAIL_SET_USER_ID) && defined(SENDMAIL_SUBMIT_MC)
INSTALL_SUBMIT_CF= ${SENDMAIL_SUBMIT_MC:T:R}.cf
ALL+= ${INSTALL_SUBMIT_CF}
CLEANFILES+= ${INSTALL_SUBMIT_CF}
${INSTALL_SUBMIT_CF}: ${SENDMAIL_SUBMIT_MC}
.endif
# Additional .cf files to build.
.if defined(SENDMAIL_ADDITIONAL_MC)
SENDMAIL_ADDITIONAL_CF= ${SENDMAIL_ADDITIONAL_MC:T:S/.mc$/.cf/}
ALL+= ${SENDMAIL_ADDITIONAL_CF}
CLEANFILES+= ${SENDMAIL_ADDITIONAL_CF}
.for mc in ${SENDMAIL_ADDITIONAL_MC}
${mc:T:R}.cf: ${mc}
.endfor
.endif
all: ${ALL}
# Build the installed submit.cf from the sendmail distributed submit.mc.
freebsd.submit.cf: ${CFDIR}/cf/submit.mc
${RM} ${.TARGET}
${M4} -D_CF_DIR_=${CFDIR}/ ${SENDMAIL_M4_FLAGS} \
${CFDIR}/m4/cf.m4 ${.ALLSRC} > ${.TARGET}
${CHMOD} ${ROMODE} ${.TARGET}
install distribution:
.if defined(SENDMAIL_MC) && defined(SENDMAIL_CF)
@echo ">>> ERROR: Both SENDMAIL_MC and SENDMAIL_CF cannot be set"
@false
.endif
.if make(distribution)
${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
${.CURDIR}/freebsd.mc freebsd.cf ${DESTDIR}/etc/mail
${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
${CFDIR}/cf/submit.mc ${DESTDIR}/etc/mail/freebsd.submit.mc
${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
freebsd.submit.cf ${DESTDIR}/etc/mail
${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
${SMDIR}/helpfile ${DESTDIR}/etc/mail
${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 640 \
/dev/null ${DESTDIR}/var/log/sendmail.st
.endif
.if defined(INSTALL_CF) && ${INSTALL_CF} != ${DEST_CF}
${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
${INSTALL_CF} ${DEST_CF}
.elif make(distribution)
${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
freebsd.cf ${DEST_CF}
.endif
.if defined(SENDMAIL_ADDITIONAL_CF) && make(install)
${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
${SENDMAIL_ADDITIONAL_CF} ${DESTDIR}/etc/mail
.endif
.if !defined(SENDMAIL_SET_USER_ID)
.if defined(INSTALL_SUBMIT_CF) && ${INSTALL_SUBMIT_CF} != ${DEST_SUBMIT_CF}
${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
${INSTALL_SUBMIT_CF} ${DEST_SUBMIT_CF}
.elif make(distribution)
${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
freebsd.submit.cf ${DEST_SUBMIT_CF}
.endif
.endif
.include <bsd.prog.mk>