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