xref: /dragonfly/etc/sendmail/Makefile (revision 6e285212)
1#	@(#)Makefile	8.19 (Berkeley) 1/14/97
2# $FreeBSD: src/etc/sendmail/Makefile,v 1.3.2.17 2002/08/07 16:31:41 ru Exp $
3# $DragonFly: src/etc/sendmail/Makefile,v 1.2 2003/06/17 04:24:48 dillon Exp $
4
5M4=		m4
6CHMOD=		chmod
7ROMODE=		444
8RM=		rm -f
9
10SENDMAIL_DIR=	${.CURDIR}/../../contrib/sendmail
11SMDIR=		${SENDMAIL_DIR}/src
12CFDIR=		${SENDMAIL_DIR}/cf
13
14# this is overkill, but....
15M4FILES!=	find ${CFDIR} -type f -name '*.m4' -print
16
17.SUFFIXES:	.mc .cf
18
19.mc.cf:		${M4FILES}
20	${RM} ${.TARGET}
21	(cd ${.CURDIR} && \
22	    ${M4} -D_CF_DIR_=${CFDIR}/ ${SENDMAIL_M4_FLAGS} \
23		${CFDIR}/m4/cf.m4 ${@:R}.mc) > ${.TARGET}
24	${CHMOD} ${ROMODE} ${.TARGET}
25
26ALL=		freebsd.cf
27CLEANFILES+=	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:R}.cf
35.else
36.if defined(SENDMAIL_CF)
37INSTALL_CF=	${SENDMAIL_CF}
38.endif
39.endif
40
41.ifndef SENDMAIL_SET_USER_ID
42.if defined(SENDMAIL_SUBMIT_MC)
43INSTALL_SUBMIT_CF=${SENDMAIL_SUBMIT_MC:R}.cf
44.endif
45.endif
46
47DEST_CF=	${DESTDIR}/etc/mail/sendmail.cf
48DEST_SUBMIT_CF=	${DESTDIR}/etc/mail/submit.cf
49
50ALL+=		${INSTALL_CF} ${INSTALL_SUBMIT_CF}
51
52# Make sure we don't remove /etc/mail/sendmail.cf on make clean
53# since this will break a running system during a buildworld.
54.if defined(INSTALL_CF)
55.if ${INSTALL_CF} != ${DEST_CF}
56CLEANFILES+=	${INSTALL_CF}
57.endif
58.endif
59
60.if defined(INSTALL_SUBMIT_CF)
61.if ${INSTALL_SUBMIT_CF} != ${DEST_SUBMIT_CF}
62CLEANFILES+=	${INSTALL_SUBMIT_CF}
63.endif
64.endif
65
66# Additional .cf files to build
67.if defined(SENDMAIL_ADDITIONAL_MC)
68SENDMAIL_ADDITIONAL_CF=	${SENDMAIL_ADDITIONAL_MC:S/.mc$/.cf/g}
69ALL+=		${SENDMAIL_ADDITIONAL_CF}
70CLEANFILES+=	${SENDMAIL_ADDITIONAL_CF}
71.endif
72
73all:		${ALL}
74
75depend:
76
77install:	${INSTALL_CF} ${INSTALL_SUBMIT_CF}
78.if (defined(SENDMAIL_MC) && defined(SENDMAIL_CF))
79	@echo ">>> ERROR: Both SENDMAIL_CF and SENDMAIL_MC can not be set"
80	@false
81.endif
82.if defined(INSTALL_CF)
83.if ${INSTALL_CF} != ${DEST_CF}
84	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${INSTALL_CF} \
85		${DEST_CF}
86.endif
87.endif
88.if defined(SENDMAIL_ADDITIONAL_CF)
89	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
90		${SENDMAIL_ADDITIONAL_CF} ${DESTDIR}/etc/mail
91.endif
92.ifndef SENDMAIL_SET_USER_ID
93.if defined(INSTALL_SUBMIT_CF)
94.if ${INSTALL_SUBMIT_CF} != ${DEST_SUBMIT_CF}
95	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
96		${INSTALL_SUBMIT_CF} ${DEST_SUBMIT_CF}
97.endif
98.endif
99.endif
100
101# Helper for src/etc/Makefile
102distribution:	freebsd.cf freebsd.mc ${INSTALL_CF} ${INSTALL_SUBMIT_CF}
103.if (defined(SENDMAIL_MC) && defined(SENDMAIL_CF))
104	@echo ">>> ERROR: Both SENDMAIL_CF and SENDMAIL_MC can not be set"
105	@false
106.endif
107	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/freebsd.mc \
108		${DESTDIR}/etc/mail/freebsd.mc
109	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 freebsd.cf \
110		${DESTDIR}/etc/mail/freebsd.cf
111.if defined(INSTALL_CF)
112.if ${INSTALL_CF} != ${DEST_CF}
113	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${INSTALL_CF} \
114		${DEST_CF}
115.endif
116.else
117	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 freebsd.cf \
118		${DEST_CF}
119.endif
120	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 ${CFDIR}/cf/submit.mc \
121	    ${DESTDIR}/etc/mail/freebsd.submit.mc
122	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 ${CFDIR}/cf/submit.cf \
123	    ${DESTDIR}/etc/mail/freebsd.submit.cf
124.ifndef SENDMAIL_SET_USER_ID
125.if defined(INSTALL_SUBMIT_CF)
126.if ${INSTALL_SUBMIT_CF} != ${DEST_SUBMIT_CF}
127	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
128		${INSTALL_SUBMIT_CF} ${DEST_SUBMIT_CF}
129.endif
130.else
131	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 ${CFDIR}/cf/submit.cf \
132	    ${DEST_SUBMIT_CF}
133.endif
134.endif
135	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 ${SMDIR}/helpfile \
136	    ${DESTDIR}/etc/mail/helpfile
137	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \
138	    ${DESTDIR}/var/log/sendmail.st
139
140.include <bsd.prog.mk>
141