xref: /freebsd/etc/sendmail/Makefile (revision d1bdc2821fcd416ab9b238580386eb605a6128d0)
1M4=		m4
2CHMOD=		chmod
3ROMODE=		444
4RM=		rm -f
5
6SENDMAIL_DIR=	${SRCTOP}/contrib/sendmail
7SMDIR=		${SENDMAIL_DIR}/src
8SENDMAIL_CF_DIR?=${SENDMAIL_DIR}/cf
9
10# this is overkill, but....
11M4FILES!=	find ${SENDMAIL_CF_DIR} -type f -name '*.m4' -print
12
13.SUFFIXES: .mc .cf
14
15.mc.cf: ${M4FILES}
16	${RM} ${.TARGET}
17	${M4} -D_CF_DIR_=${SENDMAIL_CF_DIR}/ -D_NO_MAKEINFO_ \
18	    ${SENDMAIL_M4_FLAGS} \
19	    ${SENDMAIL_CF_DIR}/m4/cf.m4 ${.IMPSRC} > ${.TARGET}
20	${CHMOD} ${ROMODE} ${.TARGET}
21
22DEST_CF=	${DESTDIR}/etc/mail/sendmail.cf
23DEST_SUBMIT_CF=	${DESTDIR}/etc/mail/submit.cf
24
25ALL=		freebsd.cf freebsd.submit.cf
26CLEANFILES=	freebsd.cf freebsd.submit.cf
27
28# Local SENDMAIL_MC or SENDMAIL_CF may be set in /etc/make.conf.
29# Warning!  If set, this causes 'make install' to always copy it
30# over /etc/mail/sendmail.cf!!!
31# Caveat emptor!  Be sure you want this before you enable it.
32.if defined(SENDMAIL_MC) && defined(SENDMAIL_CF)
33.error Both SENDMAIL_MC and SENDMAIL_CF cannot be set.
34.elif 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
63distribution:
64	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 -T "package=sendmail,config" \
65	    ${.CURDIR}/freebsd.mc freebsd.cf ${DESTDIR}/etc/mail
66	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 -T "package=sendmail,config" \
67	    ${.CURDIR}/freebsd.submit.mc freebsd.submit.cf ${DESTDIR}/etc/mail
68	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 -T "package=sendmail,config" \
69	    ${SMDIR}/helpfile ${DESTDIR}/etc/mail
70.if defined(INSTALL_CF)
71	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 -T "package=sendmail,config" \
72	    ${INSTALL_CF} ${DEST_CF}
73.else
74	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 -T "package=sendmail,config" \
75	    freebsd.cf ${DEST_CF}
76.endif
77.if defined(SENDMAIL_ADDITIONAL_CF)
78	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 -T "package=sendmail,config" \
79	    ${SENDMAIL_ADDITIONAL_CF} ${DESTDIR}/etc/mail
80.endif
81.if !defined(SENDMAIL_SET_USER_ID)
82.if defined(INSTALL_SUBMIT_CF)
83	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 -T "package=sendmail,config" \
84	    ${INSTALL_SUBMIT_CF} ${DEST_SUBMIT_CF}
85.else
86	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 -T "package=sendmail,config" \
87	    freebsd.submit.cf ${DEST_SUBMIT_CF}
88.endif
89.endif
90
91.include <bsd.prog.mk>
92