Pre-2.0 release, MFC some driver fixes related to interrupt management.
[dragonfly.git] / etc / mail / Makefile
blobc65c47204df48630ee0f07cac277682399fa6e67
2 # $FreeBSD: src/etc/mail/Makefile,v 1.9.2.23 2003/02/12 03:57:52 gshapiro Exp $
3 # $DragonFly: src/etc/mail/Makefile,v 1.3 2005/07/25 00:24:31 gshapiro Exp $
5 # This Makefile provides an easy way to generate the configuration
6 # file and database maps for the sendmail(8) daemon.
8 # The user-driven targets are:
10 # all - Build cf, maps and aliases
11 # cf - Build the .cf file from .mc file
12 # maps - Build the feature maps
13 # aliases - Build the sendmail aliases
14 # install - Install the .cf file as /etc/mail/sendmail.cf
16 # For acting on both the MTA daemon and MSP queue running daemon:
17 # start - Start both the sendmail MTA daemon and MSP queue running
18 # daemon with the flags defined in /etc/defaults/rc.conf or
19 # /etc/rc.conf
20 # stop - Stop both the sendmail MTA daemon and MSP queue running
21 # daemon
22 # restart - Restart both the sendmail MTA daemon and MSP queue running
23 # daemon
25 # For acting on just the MTA daemon:
26 # start-mta - Start the sendmail MTA daemon with the flags defined in
27 # /etc/defaults/rc.conf or /etc/rc.conf
28 # stop-mta - Stop the sendmail MTA daemon
29 # restart-mta - Restart the sendmail MTA daemon
31 # For acting on just the MSP queue running daemon:
32 # start-mspq - Start the sendmail MSP queue running daemon with the
33 # flags defined in /etc/defaults/rc.conf or /etc/rc.conf
34 # stop-mspq - Stop the sendmail MSP queue running daemon
35 # restart-mspq - Restart the sendmail MSP queue running daemon
37 # Calling `make' will generate the updated versions when either the
38 # aliases or one of the map files were changed.
40 # A `make install` is only necessary after modifying the .mc file. In
41 # this case one would normally also call `make restart' to allow the
42 # running sendmail to pick up the changes as well.
44 # ------------------------------------------------------------------------
45 # This Makefile uses `<HOSTNAME>.mc' as the default MTA .mc file. This
46 # can be changed by defining SENDMAIL_MC in /etc/make.conf, e.g.:
48 # SENDMAIL_MC=/etc/mail/myconfig.mc
50 # If '<HOSTNAME>.mc' does not exist, it is created using 'dragonfly.mc'
51 # as a template.
53 # It also uses '<HOSTNAME>.submit.mc' as the default mail submission .mc
54 # file. This can be changed by defining SENDMAIL_SUBMIT_MC in
55 # /etc/make.conf, e.g.:
57 # SENDMAIL_SUBMIT_MC=/etc/mail/mysubmit.mc
59 # If '<HOSTNAME>.submit.mc' does not exist, it is created using
60 # 'dragonfly.submit.mc' as a template.
61 # ------------------------------------------------------------------------
63 # The Makefile knows about the following maps:
64 # access, bitdomain, domaintable, genericstable, mailertable, userdb,
65 # uucpdomain, virtusertable
68 .ifndef SENDMAIL_MC
69 SENDMAIL_MC!= hostname
70 SENDMAIL_MC:= ${SENDMAIL_MC}.mc
72 ${SENDMAIL_MC}:
73 cp dragonfly.mc ${SENDMAIL_MC}
74 .endif
76 .ifndef SENDMAIL_SUBMIT_MC
77 SENDMAIL_SUBMIT_MC!= hostname
78 SENDMAIL_SUBMIT_MC:= ${SENDMAIL_SUBMIT_MC}.submit.mc
80 ${SENDMAIL_SUBMIT_MC}:
81 cp dragonfly.submit.mc ${SENDMAIL_SUBMIT_MC}
82 .endif
84 INSTALL_CF= ${SENDMAIL_MC:R}.cf
86 .ifndef SENDMAIL_SET_USER_ID
87 INSTALL_SUBMIT_CF= ${SENDMAIL_SUBMIT_MC:R}.cf
88 .endif
90 SENDMAIL_ALIASES?= /etc/mail/aliases
93 # This is the directory where the sendmail configuration files are
94 # located.
96 .if exists(/usr/share/sendmail/cf)
97 SENDMAIL_CF_DIR?= /usr/share/sendmail/cf
98 .elif exists(/usr/src/contrib/sendmail/cf)
99 SENDMAIL_CF_DIR?= /usr/src/contrib/sendmail/cf
100 .endif
103 # The sendmail startup script
105 SENDMAIL_START_SCRIPT?= /etc/rc.sendmail
108 # Some useful programs we need.
110 SENDMAIL?= /usr/sbin/sendmail
111 MAKEMAP?= /usr/sbin/makemap
112 M4?= /usr/bin/m4
114 # Permissions for generated maps
115 SENDMAIL_MAP_PERMS?= 0640
117 # Set a reasonable default
118 .MAIN: all
121 # ------------------------------------------------------------------------
123 # The Makefile picks up the list of files from SENDMAIL_MAP_SRC and
124 # stores the matching .db filenames in SENDMAIL_MAP_OBJ if the file
125 # exists in the current directory. SENDMAIL_MAP_TYPE is the database
126 # type to use when calling makemap.
128 SENDMAIL_MAP_SRC+= mailertable domaintable bitdomain uucpdomain \
129 genericstable virtusertable access
130 SENDMAIL_MAP_OBJ=
131 SENDMAIL_MAP_TYPE?= hash
133 .for _f in ${SENDMAIL_MAP_SRC} userdb
134 .if exists(${_f})
135 SENDMAIL_MAP_OBJ+= ${_f}.db
136 .endif
137 .endfor
140 # The makemap command is used to generate a hashed map from the textfile.
142 .for _f in ${SENDMAIL_MAP_SRC}
143 .if (exists(${_f}.sample) && !exists(${_f}))
144 ${_f}: ${_f}.sample
145 sed -e 's/^/#/' < ${.OODATE} > ${.TARGET}
146 .endif
148 ${_f}.db: ${_f}
149 ${MAKEMAP} ${SENDMAIL_MAP_TYPE} ${.TARGET} < ${.OODATE}
150 chmod ${SENDMAIL_MAP_PERMS} ${.TARGET}
151 .endfor
153 userdb.db: userdb
154 ${MAKEMAP} btree ${.TARGET} < ${.OODATE}
155 chmod ${SENDMAIL_MAP_PERMS} ${.TARGET}
159 # The .cf file needs to be recreated if the templates were modified.
161 M4FILES!= find ${SENDMAIL_CF_DIR} -type f -name '*.m4' -print
164 # M4(1) is used to generate the .cf file from the .mc file.
166 .SUFFIXES: .cf .mc
168 .mc.cf: ${M4FILES}
169 ${M4} -D_CF_DIR_=${SENDMAIL_CF_DIR}/ ${SENDMAIL_M4_FLAGS} \
170 ${SENDMAIL_CF_DIR}/m4/cf.m4 ${@:R}.mc > ${.TARGET}
173 # Aliases are handled separately since they normally reside in /etc
174 # and can be rebuild without the help of makemap.
176 .for _f in ${SENDMAIL_ALIASES}
177 ${_f}.db: ${_f}
178 ${SENDMAIL} -bi -OAliasFile=${.ALLSRC}
179 chmod ${SENDMAIL_MAP_PERMS} ${.TARGET}
180 .endfor
183 # ------------------------------------------------------------------------
186 all: cf maps aliases
188 clean:
190 depend:
192 cf: ${INSTALL_CF} ${INSTALL_SUBMIT_CF}
194 .ifdef SENDMAIL_SET_USER_ID
195 install: install-cf
196 .else
197 install: install-cf install-submit-cf
198 .endif
200 install-cf: ${INSTALL_CF}
201 .if ${INSTALL_CF} != /etc/mail/sendmail.cf
202 ${INSTALL} -m ${SHAREMODE} ${INSTALL_CF} /etc/mail/sendmail.cf
203 .endif
206 install-submit-cf: ${INSTALL_SUBMIT_CF}
207 .ifdef SENDMAIL_SET_USER_ID
208 @echo ">>> ERROR: You should not create a submit.cf file if you are using a"
209 @echo " set-user-ID sendmail binary (SENDMAIL_SET_USER_ID is set"
210 @echo " in make.conf)."
211 @false
212 .else
213 .if ${INSTALL_SUBMIT_CF} != /etc/mail/submit.cf
214 ${INSTALL} -m ${SHAREMODE} ${INSTALL_SUBMIT_CF} /etc/mail/submit.cf
215 .endif
216 .endif
218 aliases: ${SENDMAIL_ALIASES:%=%.db}
220 maps: ${SENDMAIL_MAP_OBJ}
222 start start-mta start-mspq:
223 @if [ -r ${SENDMAIL_START_SCRIPT} ]; then \
224 echo -n 'Starting:'; \
225 sh ${SENDMAIL_START_SCRIPT} $@; \
226 echo '.'; \
229 stop stop-mta stop-mspq:
230 @if [ -r ${SENDMAIL_START_SCRIPT} ]; then \
231 echo -n 'Stopping:'; \
232 sh ${SENDMAIL_START_SCRIPT} $@; \
233 echo '.'; \
236 restart restart-mta restart-mspq:
237 @if [ -r ${SENDMAIL_START_SCRIPT} ]; then \
238 echo -n 'Restarting:'; \
239 sh ${SENDMAIL_START_SCRIPT} $@; \
240 echo '.'; \
243 # User defined targets
244 .if exists(Makefile.local)
245 .include "Makefile.local"
246 .endif
248 # For the definition of $SHAREMODE
249 .include <bsd.own.mk>