summaryrefslogtreecommitdiffstats
path: root/etc/sendmail/Makefile
blob: ca4443c19caf88f7f5ee1b105ad2b7b5d3279c47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#	@(#)Makefile	8.19 (Berkeley) 1/14/97
# $FreeBSD$

M4=		m4
CHMOD=		chmod
ROMODE=		444
RM=		rm -f

SENDMAIL_DIR=	${.CURDIR}/../../contrib/sendmail
SMDIR=		${SENDMAIL_DIR}/src
CFDIR=		${SENDMAIL_DIR}/cf

# this is overkill, but....
M4FILES!=	find ${CFDIR} -type f -name '*.m4' -print

.SUFFIXES:	.mc .cf

.mc.cf:		${M4FILES}
	${RM} ${.TARGET}
	(cd ${.CURDIR} && \
	    ${M4} -D_CF_DIR_=${CFDIR}/ ${SENDMAIL_M4_FLAGS} \
		${CFDIR}/m4/cf.m4 ${@:R}.mc) > ${.TARGET}
	${CHMOD} ${ROMODE} ${.TARGET}

ALL=		freebsd.cf
CLEANFILES+=	freebsd.cf

# Local SENDMAIL_MC or SENDMAIL_CF may be set in /etc/make.conf.
# Warning! If set, this causes 'make install' to always copy it
# over /etc/mail/sendmail.cf!!!
# Caveat emptor!  Be sure you want this before you enable it.
.if defined(SENDMAIL_MC)
INSTALL_CF=	${SENDMAIL_MC:R}.cf
.else
.if defined(SENDMAIL_CF)
INSTALL_CF=	${SENDMAIL_CF}
.endif
.endif

.ifndef SENDMAIL_SET_USER_ID
.if defined(SENDMAIL_SUBMIT_MC)
INSTALL_SUBMIT_CF=${SENDMAIL_SUBMIT_MC:R}.cf
.endif
.endif

DEST_CF=	${DESTDIR}/etc/mail/sendmail.cf
DEST_SUBMIT_CF=	${DESTDIR}/etc/mail/submit.cf

ALL+=		${INSTALL_CF} ${INSTALL_SUBMIT_CF}

# Make sure we don't remove /etc/mail/sendmail.cf on make clean
# since this will break a running system during a buildworld.
.if defined(INSTALL_CF)
.if ${INSTALL_CF} != ${DEST_CF}
CLEANFILES+=	${INSTALL_CF}
.endif
.endif

.if defined(INSTALL_SUBMIT_CF)
.if ${INSTALL_SUBMIT_CF} != ${DEST_SUBMIT_CF}
CLEANFILES+=	${INSTALL_SUBMIT_CF}
.endif
.endif

# Additional .cf files to build
.if defined(SENDMAIL_ADDITIONAL_MC)
SENDMAIL_ADDITIONAL_CF=	${SENDMAIL_ADDITIONAL_MC:S/.mc$/.cf/g}
ALL+=		${SENDMAIL_ADDITIONAL_CF}
CLEANFILES+=	${SENDMAIL_ADDITIONAL_CF}
.endif

all:		${ALL}

depend:

install:	${INSTALL_CF} ${INSTALL_SUBMIT_CF}
.if (defined(SENDMAIL_MC) && defined(SENDMAIL_CF))
	@echo ">>> ERROR: Both SENDMAIL_CF and SENDMAIL_MC can not be set"
	@false
.endif
.if defined(INSTALL_CF)
.if ${INSTALL_CF} != ${DEST_CF}
	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${INSTALL_CF} \
		${DEST_CF}
.endif
.endif
.if defined(SENDMAIL_ADDITIONAL_CF)
	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
		${SENDMAIL_ADDITIONAL_CF} ${DESTDIR}/etc/mail
.endif
.ifndef SENDMAIL_SET_USER_ID
.if defined(INSTALL_SUBMIT_CF)
.if ${INSTALL_SUBMIT_CF} != ${DEST_SUBMIT_CF}
	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
		${INSTALL_SUBMIT_CF} ${DEST_SUBMIT_CF}
.endif
.endif
.endif

# Helper for src/etc/Makefile
distribution:	freebsd.cf freebsd.mc ${INSTALL_CF} ${INSTALL_SUBMIT_CF}
.if (defined(SENDMAIL_MC) && defined(SENDMAIL_CF))
	@echo ">>> ERROR: Both SENDMAIL_CF and SENDMAIL_MC can not be set"
	@false
.endif
	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/freebsd.mc \
		${DESTDIR}/etc/mail/freebsd.mc
	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 freebsd.cf \
		${DESTDIR}/etc/mail/freebsd.cf
.if defined(INSTALL_CF)
.if ${INSTALL_CF} != ${DEST_CF}
	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${INSTALL_CF} \
		${DEST_CF}
.endif
.else
	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 freebsd.cf \
		${DEST_CF}
.endif
	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 ${CFDIR}/cf/submit.mc \
	    ${DESTDIR}/etc/mail/freebsd.submit.mc
	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 ${CFDIR}/cf/submit.cf \
	    ${DESTDIR}/etc/mail/freebsd.submit.cf
.ifndef SENDMAIL_SET_USER_ID
.if defined(INSTALL_SUBMIT_CF)
.if ${INSTALL_SUBMIT_CF} != ${DEST_SUBMIT_CF}
	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
		${INSTALL_SUBMIT_CF} ${DEST_SUBMIT_CF}
.endif
.else
	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 ${CFDIR}/cf/submit.cf \
	    ${DEST_SUBMIT_CF}
.endif
.endif
	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 ${SMDIR}/helpfile \
	    ${DESTDIR}/etc/mail/helpfile
	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \
	    ${DESTDIR}/var/log/sendmail.st

.include <bsd.prog.mk>
OpenPOWER on IntegriCloud