xref: /freebsd/etc/sendmail/Makefile (revision ab393e9548f8cc0ee28499c411963b798ebb38a5)
1#	@(#)Makefile	8.19 (Berkeley) 1/14/97
2
3M4=		m4
4CHMOD=		chmod
5ROMODE=		444
6RM=		rm -f
7
8SENDMAIL_DIR=	${SRCTOP}/contrib/sendmail
9SMDIR=		${SENDMAIL_DIR}/src
10SENDMAIL_CF_DIR?=${SENDMAIL_DIR}/cf
11
12# this is overkill, but....
13M4FILES!=	find ${SENDMAIL_CF_DIR} -type f -name '*.m4' -print
14
15.SUFFIXES: .mc .cf
16
17.mc.cf: ${M4FILES}
18	${RM} ${.TARGET}
19	${M4} -D_CF_DIR_=${SENDMAIL_CF_DIR}/ -D_NO_MAKEINFO_ \
20	    ${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 -T "package=sendmail" \
67	    ${.CURDIR}/freebsd.mc freebsd.cf ${DESTDIR}/etc/mail
68	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 -T "package=sendmail" \
69	    ${.CURDIR}/freebsd.submit.mc freebsd.submit.cf ${DESTDIR}/etc/mail
70	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 -T "package=sendmail" \
71	    ${SMDIR}/helpfile ${DESTDIR}/etc/mail
72.if defined(INSTALL_CF)
73	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 -T "package=sendmail" \
74	    ${INSTALL_CF} ${DEST_CF}
75.else
76	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 -T "package=sendmail" \
77	    freebsd.cf ${DEST_CF}
78.endif
79.if defined(SENDMAIL_ADDITIONAL_CF)
80	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 -T "package=sendmail" \
81	    ${SENDMAIL_ADDITIONAL_CF} ${DESTDIR}/etc/mail
82.endif
83.if !defined(SENDMAIL_SET_USER_ID)
84.if defined(INSTALL_SUBMIT_CF)
85	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 -T "package=sendmail" \
86	    ${INSTALL_SUBMIT_CF} ${DEST_SUBMIT_CF}
87.else
88	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 -T "package=sendmail" \
89	    freebsd.submit.cf ${DEST_SUBMIT_CF}
90.endif
91.endif
92
93.include <bsd.prog.mk>
94