xref: /freebsd/etc/sendmail/Makefile (revision 50536c6135890949d9e3dd99740fe47a3ee94bfb)
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
11CFDIR=		${SENDMAIL_DIR}/cf
12
13# this is overkill, but....
14M4FILES!=	find ${CFDIR} -type f -name '*.m4' -print
15
16.SUFFIXES: .mc .cf
17
18.mc.cf: ${M4FILES}
19	${RM} ${.TARGET}
20	${M4} -D_CF_DIR_=${CFDIR}/ ${SENDMAIL_M4_FLAGS} \
21	    ${CFDIR}/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
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)
34INSTALL_CF=	${SENDMAIL_MC:T:R}.cf
35ALL+=		${INSTALL_CF}
36${INSTALL_CF}: ${SENDMAIL_MC}
37.elif defined(SENDMAIL_CF)
38INSTALL_CF=	${SENDMAIL_CF}
39.endif
40
41.if !defined(SENDMAIL_SET_USER_ID) && defined(SENDMAIL_SUBMIT_MC)
42INSTALL_SUBMIT_CF= ${SENDMAIL_SUBMIT_MC:T:R}.cf
43ALL+=		${INSTALL_SUBMIT_CF}
44${INSTALL_SUBMIT_CF}: ${SENDMAIL_SUBMIT_MC}
45.endif
46
47# Additional .cf files to build.
48.if defined(SENDMAIL_ADDITIONAL_MC)
49SENDMAIL_ADDITIONAL_CF= ${SENDMAIL_ADDITIONAL_MC:T:S/.mc$/.cf/}
50ALL+=		${SENDMAIL_ADDITIONAL_CF}
51.for mc in ${SENDMAIL_ADDITIONAL_MC}
52${mc:T:R}.cf: ${mc}
53.endfor
54.endif
55
56CLEANFILES=	${ALL}
57
58all: ${ALL}
59
60install distribution:
61.if defined(SENDMAIL_MC) && defined(SENDMAIL_CF)
62	@echo ">>> ERROR: Both SENDMAIL_MC and SENDMAIL_CF cannot be set"
63	@false
64.endif
65.if make(distribution)
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	    ${CFDIR}/cf/submit.mc ${DESTDIR}/etc/mail/freebsd.submit.mc
70	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
71	    ${CFDIR}/cf/submit.cf ${DESTDIR}/etc/mail/freebsd.submit.cf
72	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
73	    ${SMDIR}/helpfile ${DESTDIR}/etc/mail
74	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 640 \
75	    /dev/null ${DESTDIR}/var/log/sendmail.st
76.endif
77.if defined(INSTALL_CF) && ${INSTALL_CF} != ${DEST_CF}
78	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
79	    ${INSTALL_CF} ${DEST_CF}
80.elif make(distribution)
81	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
82	    freebsd.cf ${DEST_CF}
83.endif
84.if defined(SENDMAIL_ADDITIONAL_CF) && make(install)
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.if 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.elif make(distribution)
93	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
94	    ${CFDIR}/cf/submit.cf ${DEST_SUBMIT_CF}
95.endif
96.endif
97
98.include <bsd.prog.mk>
99