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