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