xref: /freebsd/etc/sendmail/Makefile (revision bee2fe7236bc50719d68149951a4f952ef4f5dcd)
176bfe4c3SPeter Wemm#	@(#)Makefile	8.19 (Berkeley) 1/14/97
29b7a44a6SPeter Wemm# $FreeBSD$
376bfe4c3SPeter Wemm
476bfe4c3SPeter WemmM4=		m4
576bfe4c3SPeter WemmCHMOD=		chmod
676bfe4c3SPeter WemmROMODE=		444
776bfe4c3SPeter WemmRM=		rm -f
8a38a3724SGregory Neil Shapiro
9a38a3724SGregory Neil ShapiroSENDMAIL_DIR=	${.CURDIR}/../../contrib/sendmail
10a38a3724SGregory Neil ShapiroSMDIR=		${SENDMAIL_DIR}/src
1177e399e8SGregory Neil ShapiroSENDMAIL_CF_DIR?=${SENDMAIL_DIR}/cf
12fab9e3acSGregory Neil Shapiro
13fab9e3acSGregory Neil Shapiro# this is overkill, but....
1477e399e8SGregory Neil ShapiroM4FILES!=	find ${SENDMAIL_CF_DIR} -type f -name '*.m4' -print
1576bfe4c3SPeter Wemm
1676bfe4c3SPeter Wemm.SUFFIXES: .mc .cf
1776bfe4c3SPeter Wemm
18fab9e3acSGregory Neil Shapiro.mc.cf: ${M4FILES}
19fab9e3acSGregory Neil Shapiro	${RM} ${.TARGET}
2077e399e8SGregory Neil Shapiro	${M4} -D_CF_DIR_=${SENDMAIL_CF_DIR}/ ${SENDMAIL_M4_FLAGS} \
2177e399e8SGregory Neil Shapiro	    ${SENDMAIL_CF_DIR}/m4/cf.m4 ${.IMPSRC} > ${.TARGET}
22fab9e3acSGregory Neil Shapiro	${CHMOD} ${ROMODE} ${.TARGET}
2376bfe4c3SPeter Wemm
24255bbde2SGregory Neil ShapiroDEST_CF=	${DESTDIR}/etc/mail/sendmail.cf
25255bbde2SGregory Neil ShapiroDEST_SUBMIT_CF=	${DESTDIR}/etc/mail/submit.cf
26255bbde2SGregory Neil Shapiro
27f92921ddSGregory Neil ShapiroALL=		freebsd.cf freebsd.submit.cf
28f92921ddSGregory Neil ShapiroCLEANFILES=	freebsd.cf freebsd.submit.cf
2976bfe4c3SPeter Wemm
3025219d25SGregory Neil Shapiro# Local SENDMAIL_MC or SENDMAIL_CF may be set in /etc/make.conf.
3125219d25SGregory Neil Shapiro# Warning!  If set, this causes 'make install' to always copy it
3225219d25SGregory Neil Shapiro# over /etc/mail/sendmail.cf!!!
3376bfe4c3SPeter Wemm# Caveat emptor!  Be sure you want this before you enable it.
34bee2fe72SRuslan Ermilov.if defined(SENDMAIL_MC) && defined(SENDMAIL_CF)
35bee2fe72SRuslan Ermilov.error Both SENDMAIL_MC and SENDMAIL_CF cannot be set.
36bee2fe72SRuslan Ermilov.elif defined(SENDMAIL_MC)
37255bbde2SGregory Neil ShapiroINSTALL_CF=	${SENDMAIL_MC:T:R}.cf
38255bbde2SGregory Neil ShapiroALL+=		${INSTALL_CF}
396cabd2d9SGregory Neil ShapiroCLEANFILES+=	${SENDMAIL_MC:T:R}.cf
40255bbde2SGregory Neil Shapiro${INSTALL_CF}: ${SENDMAIL_MC}
41255bbde2SGregory Neil Shapiro.elif defined(SENDMAIL_CF)
426cabd2d9SGregory Neil ShapiroALL+=		${SENDMAIL_CF}
4325219d25SGregory Neil ShapiroINSTALL_CF=	${SENDMAIL_CF}
4425219d25SGregory Neil Shapiro.endif
45255bbde2SGregory Neil Shapiro
46255bbde2SGregory Neil Shapiro.if !defined(SENDMAIL_SET_USER_ID) && defined(SENDMAIL_SUBMIT_MC)
47255bbde2SGregory Neil ShapiroINSTALL_SUBMIT_CF= ${SENDMAIL_SUBMIT_MC:T:R}.cf
48255bbde2SGregory Neil ShapiroALL+=		${INSTALL_SUBMIT_CF}
496cabd2d9SGregory Neil ShapiroCLEANFILES+=	${INSTALL_SUBMIT_CF}
50255bbde2SGregory Neil Shapiro${INSTALL_SUBMIT_CF}: ${SENDMAIL_SUBMIT_MC}
5125219d25SGregory Neil Shapiro.endif
5225219d25SGregory Neil Shapiro
53255bbde2SGregory Neil Shapiro# Additional .cf files to build.
54e6c77250SGregory Neil Shapiro.if defined(SENDMAIL_ADDITIONAL_MC)
55255bbde2SGregory Neil ShapiroSENDMAIL_ADDITIONAL_CF= ${SENDMAIL_ADDITIONAL_MC:T:S/.mc$/.cf/}
56c8e96857SGregory Neil ShapiroALL+=		${SENDMAIL_ADDITIONAL_CF}
576cabd2d9SGregory Neil ShapiroCLEANFILES+=	${SENDMAIL_ADDITIONAL_CF}
58255bbde2SGregory Neil Shapiro.for mc in ${SENDMAIL_ADDITIONAL_MC}
59255bbde2SGregory Neil Shapiro${mc:T:R}.cf: ${mc}
60255bbde2SGregory Neil Shapiro.endfor
61e6c77250SGregory Neil Shapiro.endif
62e6c77250SGregory Neil Shapiro
63fab9e3acSGregory Neil Shapiroall: ${ALL}
6476bfe4c3SPeter Wemm
65bee2fe72SRuslan Ermilovdistribution:
66255bbde2SGregory Neil Shapiro	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
67255bbde2SGregory Neil Shapiro	    ${.CURDIR}/freebsd.mc freebsd.cf ${DESTDIR}/etc/mail
68255bbde2SGregory Neil Shapiro	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
691f9b7c96SGregory Neil Shapiro	    ${.CURDIR}/freebsd.submit.mc freebsd.submit.cf ${DESTDIR}/etc/mail
70255bbde2SGregory Neil Shapiro	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
71255bbde2SGregory Neil Shapiro	    ${SMDIR}/helpfile ${DESTDIR}/etc/mail
72255bbde2SGregory Neil Shapiro	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 640 \
73255bbde2SGregory Neil Shapiro	    /dev/null ${DESTDIR}/var/log/sendmail.st
74bee2fe72SRuslan Ermilov	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
75bee2fe72SRuslan Ermilov	    freebsd.cf ${DEST_CF}
76bee2fe72SRuslan Ermilov	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
77bee2fe72SRuslan Ermilov	    freebsd.submit.cf ${DEST_SUBMIT_CF}
78bee2fe72SRuslan Ermilov
79bee2fe72SRuslan Ermilovinstall:
80255bbde2SGregory Neil Shapiro.if defined(INSTALL_CF) && ${INSTALL_CF} != ${DEST_CF}
81255bbde2SGregory Neil Shapiro	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
82255bbde2SGregory Neil Shapiro	    ${INSTALL_CF} ${DEST_CF}
8314d6d765SGregory Neil Shapiro.endif
84bee2fe72SRuslan Ermilov.if defined(SENDMAIL_ADDITIONAL_CF)
85d2893b16SRuslan Ermilov	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
86c8e96857SGregory Neil Shapiro	    ${SENDMAIL_ADDITIONAL_CF} ${DESTDIR}/etc/mail
87c8e96857SGregory Neil Shapiro.endif
88bee2fe72SRuslan Ermilov.if !defined(SENDMAIL_SET_USER_ID) && \
89bee2fe72SRuslan Ermilov    defined(INSTALL_SUBMIT_CF) && ${INSTALL_SUBMIT_CF} != ${DEST_SUBMIT_CF}
90d2893b16SRuslan Ermilov	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
9114d6d765SGregory Neil Shapiro	    ${INSTALL_SUBMIT_CF} ${DEST_SUBMIT_CF}
9214d6d765SGregory Neil Shapiro.endif
9376bfe4c3SPeter Wemm
9476bfe4c3SPeter Wemm.include <bsd.prog.mk>
95