1# @(#)Makefile 8.19 (Berkeley) 1/14/97 2# $FreeBSD$ 3 4M4= m4 5CHMOD= chmod 6ROMODE= 444 7RM= rm -f 8 9SENDMAIL_DIR= ${.CURDIR}/../../contrib/sendmail 10SMDIR= ${SENDMAIL_DIR}/src 11SENDMAIL_CF_DIR?=${SENDMAIL_DIR}/cf 12 13# this is overkill, but.... 14M4FILES!= find ${SENDMAIL_CF_DIR} -type f -name '*.m4' -print 15 16.SUFFIXES: .mc .cf 17 18.mc.cf: ${M4FILES} 19 ${RM} ${.TARGET} 20 ${M4} -D_CF_DIR_=${SENDMAIL_CF_DIR}/ ${SENDMAIL_M4_FLAGS} \ 21 ${SENDMAIL_CF_DIR}/m4/cf.m4 ${.IMPSRC} > ${.TARGET} 22 ${CHMOD} ${ROMODE} ${.TARGET} 23 24DEST_CF= ${DESTDIR}/etc/mail/sendmail.cf 25DEST_SUBMIT_CF= ${DESTDIR}/etc/mail/submit.cf 26 27ALL= freebsd.cf freebsd.submit.cf 28CLEANFILES= freebsd.cf freebsd.submit.cf 29 30# Local SENDMAIL_MC or SENDMAIL_CF may be set in /etc/make.conf. 31# Warning! If set, this causes 'make install' to always copy it 32# over /etc/mail/sendmail.cf!!! 33# Caveat emptor! Be sure you want this before you enable it. 34.if defined(SENDMAIL_MC) 35INSTALL_CF= ${SENDMAIL_MC:T:R}.cf 36ALL+= ${INSTALL_CF} 37CLEANFILES+= ${SENDMAIL_MC:T:R}.cf 38${INSTALL_CF}: ${SENDMAIL_MC} 39.elif defined(SENDMAIL_CF) 40ALL+= ${SENDMAIL_CF} 41INSTALL_CF= ${SENDMAIL_CF} 42.endif 43 44.if !defined(SENDMAIL_SET_USER_ID) && defined(SENDMAIL_SUBMIT_MC) 45INSTALL_SUBMIT_CF= ${SENDMAIL_SUBMIT_MC:T:R}.cf 46ALL+= ${INSTALL_SUBMIT_CF} 47CLEANFILES+= ${INSTALL_SUBMIT_CF} 48${INSTALL_SUBMIT_CF}: ${SENDMAIL_SUBMIT_MC} 49.endif 50 51# Additional .cf files to build. 52.if defined(SENDMAIL_ADDITIONAL_MC) 53SENDMAIL_ADDITIONAL_CF= ${SENDMAIL_ADDITIONAL_MC:T:S/.mc$/.cf/} 54ALL+= ${SENDMAIL_ADDITIONAL_CF} 55CLEANFILES+= ${SENDMAIL_ADDITIONAL_CF} 56.for mc in ${SENDMAIL_ADDITIONAL_MC} 57${mc:T:R}.cf: ${mc} 58.endfor 59.endif 60 61all: ${ALL} 62 63# Build the installed submit.cf from the sendmail distributed submit.mc. 64freebsd.submit.cf: ${SENDMAIL_CF_DIR}/cf/submit.mc 65 ${RM} ${.TARGET} 66 ${M4} -D_CF_DIR_=${SENDMAIL_CF_DIR}/ ${SENDMAIL_M4_FLAGS} \ 67 ${SENDMAIL_CF_DIR}/m4/cf.m4 ${.ALLSRC} > ${.TARGET} 68 ${CHMOD} ${ROMODE} ${.TARGET} 69 70install distribution: 71.if defined(SENDMAIL_MC) && defined(SENDMAIL_CF) 72 @echo ">>> ERROR: Both SENDMAIL_MC and SENDMAIL_CF cannot be set" 73 @false 74.endif 75.if make(distribution) 76 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \ 77 ${.CURDIR}/freebsd.mc freebsd.cf ${DESTDIR}/etc/mail 78 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \ 79 ${SENDMAIL_CF_DIR}/cf/submit.mc \ 80 ${DESTDIR}/etc/mail/freebsd.submit.mc 81 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \ 82 freebsd.submit.cf ${DESTDIR}/etc/mail 83 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \ 84 ${SMDIR}/helpfile ${DESTDIR}/etc/mail 85 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 640 \ 86 /dev/null ${DESTDIR}/var/log/sendmail.st 87.endif 88.if defined(INSTALL_CF) && ${INSTALL_CF} != ${DEST_CF} 89 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \ 90 ${INSTALL_CF} ${DEST_CF} 91.elif make(distribution) 92 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \ 93 freebsd.cf ${DEST_CF} 94.endif 95.if defined(SENDMAIL_ADDITIONAL_CF) && make(install) 96 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \ 97 ${SENDMAIL_ADDITIONAL_CF} ${DESTDIR}/etc/mail 98.endif 99.if !defined(SENDMAIL_SET_USER_ID) 100.if defined(INSTALL_SUBMIT_CF) && ${INSTALL_SUBMIT_CF} != ${DEST_SUBMIT_CF} 101 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \ 102 ${INSTALL_SUBMIT_CF} ${DEST_SUBMIT_CF} 103.elif make(distribution) 104 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \ 105 freebsd.submit.cf ${DEST_SUBMIT_CF} 106.endif 107.endif 108 109.include <bsd.prog.mk> 110