xref: /freebsd/etc/sendmail/Makefile (revision 9336e0699bda8a301cd2bfa37106b6ec5e32012e)
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) && defined(SENDMAIL_CF)
35.error Both SENDMAIL_MC and SENDMAIL_CF cannot be set.
36.elif defined(SENDMAIL_MC)
37INSTALL_CF=	${SENDMAIL_MC:T:R}.cf
38ALL+=		${INSTALL_CF}
39CLEANFILES+=	${SENDMAIL_MC:T:R}.cf
40${INSTALL_CF}: ${SENDMAIL_MC}
41.elif defined(SENDMAIL_CF)
42ALL+=		${SENDMAIL_CF}
43INSTALL_CF=	${SENDMAIL_CF}
44.endif
45
46.if !defined(SENDMAIL_SET_USER_ID) && defined(SENDMAIL_SUBMIT_MC)
47INSTALL_SUBMIT_CF= ${SENDMAIL_SUBMIT_MC:T:R}.cf
48ALL+=		${INSTALL_SUBMIT_CF}
49CLEANFILES+=	${INSTALL_SUBMIT_CF}
50${INSTALL_SUBMIT_CF}: ${SENDMAIL_SUBMIT_MC}
51.endif
52
53# Additional .cf files to build.
54.if defined(SENDMAIL_ADDITIONAL_MC)
55SENDMAIL_ADDITIONAL_CF= ${SENDMAIL_ADDITIONAL_MC:T:S/.mc$/.cf/}
56ALL+=		${SENDMAIL_ADDITIONAL_CF}
57CLEANFILES+=	${SENDMAIL_ADDITIONAL_CF}
58.for mc in ${SENDMAIL_ADDITIONAL_MC}
59${mc:T:R}.cf: ${mc}
60.endfor
61.endif
62
63all: ${ALL}
64
65distribution:
66	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
67	    ${.CURDIR}/freebsd.mc freebsd.cf ${DESTDIR}/etc/mail
68	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
69	    ${.CURDIR}/freebsd.submit.mc freebsd.submit.cf ${DESTDIR}/etc/mail
70	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
71	    ${SMDIR}/helpfile ${DESTDIR}/etc/mail
72	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 640 \
73	    /dev/null ${DESTDIR}/var/log/sendmail.st
74	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
75	    freebsd.cf ${DEST_CF}
76	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
77	    freebsd.submit.cf ${DEST_SUBMIT_CF}
78
79install:
80.if defined(INSTALL_CF) && ${INSTALL_CF} != ${DEST_CF}
81	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
82	    ${INSTALL_CF} ${DEST_CF}
83.endif
84.if defined(SENDMAIL_ADDITIONAL_CF)
85	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
86	    ${SENDMAIL_ADDITIONAL_CF} ${DESTDIR}/etc/mail
87.endif
88.if !defined(SENDMAIL_SET_USER_ID) && \
89    defined(INSTALL_SUBMIT_CF) && ${INSTALL_SUBMIT_CF} != ${DEST_SUBMIT_CF}
90	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
91	    ${INSTALL_SUBMIT_CF} ${DEST_SUBMIT_CF}
92.endif
93
94.include <bsd.prog.mk>
95