- Prevent buildworld from trying to write to /etc/mail/

- Stop 'make clean' from removing SENDMAIL_CF
- install and distribute targets should not attempt to build anything
- SENDMAIL_ADDITIONAL_CF were not installed in the distribution case
- If SENDMAIL_SET_USER_ID was defined, submit.cf was needlessly installed
  in the distribution case
- Collapse install and distribution target into one to remove code
  duplication

Submitted by:	ru
MFC after:	5 days
This commit is contained in:
gshapiro 2003-07-06 18:51:10 +00:00
parent bea7d6e107
commit e1349a1026

View File

@ -17,123 +17,84 @@ M4FILES!= find ${CFDIR} -type f -name '*.m4' -print
.mc.cf: ${M4FILES}
${RM} ${.TARGET}
(cd ${.CURDIR} && \
${M4} -D_CF_DIR_=${CFDIR}/ ${SENDMAIL_M4_FLAGS} \
${CFDIR}/m4/cf.m4 ${@:R}.mc) > ${.TARGET}
${M4} -D_CF_DIR_=${CFDIR}/ ${SENDMAIL_M4_FLAGS} \
${CFDIR}/m4/cf.m4 ${.IMPSRC} > ${.TARGET}
${CHMOD} ${ROMODE} ${.TARGET}
ALL= freebsd.cf
CLEANFILES+= freebsd.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:R}.cf
.else
.if defined(SENDMAIL_CF)
INSTALL_CF= ${SENDMAIL_CF}
.endif
.endif
.ifndef SENDMAIL_SET_USER_ID
.if defined(SENDMAIL_SUBMIT_MC)
INSTALL_SUBMIT_CF=${SENDMAIL_SUBMIT_MC:R}.cf
.endif
.endif
DEST_CF= ${DESTDIR}/etc/mail/sendmail.cf
DEST_SUBMIT_CF= ${DESTDIR}/etc/mail/submit.cf
ALL+= ${INSTALL_CF} ${INSTALL_SUBMIT_CF}
ALL= freebsd.cf
# Make sure we don't remove /etc/mail/sendmail.cf on make clean
# since this will break a running system during a buildworld.
.if defined(INSTALL_CF)
.if ${INSTALL_CF} != ${DEST_CF}
CLEANFILES+= ${INSTALL_CF}
.endif
# 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}
${INSTALL_CF}: ${SENDMAIL_MC}
.elif defined(SENDMAIL_CF)
INSTALL_CF= ${SENDMAIL_CF}
.endif
.if defined(INSTALL_SUBMIT_CF)
.if ${INSTALL_SUBMIT_CF} != ${DEST_SUBMIT_CF}
CLEANFILES+= ${INSTALL_SUBMIT_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}
${INSTALL_SUBMIT_CF}: ${SENDMAIL_SUBMIT_MC}
.endif
# Additional .cf files to build
# Additional .cf files to build.
.if defined(SENDMAIL_ADDITIONAL_MC)
SENDMAIL_ADDITIONAL_CF= ${SENDMAIL_ADDITIONAL_MC:S/.mc$/.cf/g}
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
CLEANFILES= ${ALL}
all: ${ALL}
depend:
install: ${INSTALL_CF} ${INSTALL_SUBMIT_CF}
.if (defined(SENDMAIL_MC) && defined(SENDMAIL_CF))
@echo ">>> ERROR: Both SENDMAIL_CF and SENDMAIL_MC can not be set"
install distribution:
.if defined(SENDMAIL_MC) && defined(SENDMAIL_CF)
@echo ">>> ERROR: Both SENDMAIL_MC and SENDMAIL_CF cannot be set"
@false
.endif
.if defined(INSTALL_CF)
.if ${INSTALL_CF} != ${DEST_CF}
${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${INSTALL_CF} \
${DEST_CF}
.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 \
${CFDIR}/cf/submit.cf ${DESTDIR}/etc/mail/freebsd.submit.cf
${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)
.if defined(SENDMAIL_ADDITIONAL_CF) && make(install)
${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
${SENDMAIL_ADDITIONAL_CF} ${DESTDIR}/etc/mail
.endif
.ifndef SENDMAIL_SET_USER_ID
.if defined(INSTALL_SUBMIT_CF)
.if ${INSTALL_SUBMIT_CF} != ${DEST_SUBMIT_CF}
.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 \
${CFDIR}/cf/submit.cf ${DEST_SUBMIT_CF}
.endif
.endif
.endif
# Helper for src/etc/Makefile
distribution: freebsd.cf freebsd.mc ${INSTALL_CF} ${INSTALL_SUBMIT_CF}
.if (defined(SENDMAIL_MC) && defined(SENDMAIL_CF))
@echo ">>> ERROR: Both SENDMAIL_CF and SENDMAIL_MC can not be set"
@false
.endif
${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/freebsd.mc \
${DESTDIR}/etc/mail/freebsd.mc
${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 freebsd.cf \
${DESTDIR}/etc/mail/freebsd.cf
.if defined(INSTALL_CF)
.if ${INSTALL_CF} != ${DEST_CF}
${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${INSTALL_CF} \
${DEST_CF}
.endif
.else
${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 freebsd.cf \
${DEST_CF}
.endif
${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 ${CFDIR}/cf/submit.mc \
${DESTDIR}/etc/mail/freebsd.submit.mc
${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 ${CFDIR}/cf/submit.cf \
${DESTDIR}/etc/mail/freebsd.submit.cf
.ifndef SENDMAIL_SET_USER_ID
.if defined(INSTALL_SUBMIT_CF)
.if ${INSTALL_SUBMIT_CF} != ${DEST_SUBMIT_CF}
${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
${INSTALL_SUBMIT_CF} ${DEST_SUBMIT_CF}
.endif
.else
${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 ${CFDIR}/cf/submit.cf \
${DEST_SUBMIT_CF}
.endif
.endif
${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 ${SMDIR}/helpfile \
${DESTDIR}/etc/mail/helpfile
${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \
${DESTDIR}/var/log/sendmail.st
.include <bsd.prog.mk>