Makefile revision 97199
1#	@(#)Makefile	8.19 (Berkeley) 1/14/97
2# $FreeBSD: head/etc/sendmail/Makefile 97199 2002-05-24 01:44:53Z gshapiro $
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	(cd ${.CURDIR} && \
21	    ${M4} -D_CF_DIR_=${CFDIR}/ ${SENDMAIL_M4_FLAGS} \
22		${CFDIR}/m4/cf.m4 ${@:R}.mc) > ${.TARGET}
23	${CHMOD} ${ROMODE} ${.TARGET}
24
25ALL=		freebsd.cf
26CLEANFILES+=	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)
33INSTALL_CF=	${SENDMAIL_MC:R}.cf
34.else
35.if defined(SENDMAIL_CF)
36INSTALL_CF=	${SENDMAIL_CF}
37.endif
38.endif
39
40.ifndef SENDMAIL_SET_USER_ID
41.if defined(SENDMAIL_SUBMIT_MC)
42INSTALL_SUBMIT_CF=${SENDMAIL_SUBMIT_MC:R}.cf
43.endif
44.endif
45
46DEST_CF=	${DESTDIR}/etc/mail/sendmail.cf
47DEST_SUBMIT_CF=	${DESTDIR}/etc/mail/submit.cf
48
49ALL+=		${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}
55CLEANFILES+=	${INSTALL_CF}
56.endif
57.endif
58
59.if defined(INSTALL_SUBMIT_CF)
60.if ${INSTALL_SUBMIT_CF} != ${DEST_SUBMIT_CF}
61CLEANFILES+=	${INSTALL_SUBMIT_CF}
62.endif
63.endif
64
65# Additional .cf files to build
66.if defined(SENDMAIL_ADDITIONAL_MC)
67SENDMAIL_ADDITIONAL_CF=	${SENDMAIL_ADDITIONAL_MC:S/.mc$/.cf/g}
68ALL+=		${SENDMAIL_ADDITIONAL_CF}
69CLEANFILES+=	${SENDMAIL_ADDITIONAL_CF}
70.endif
71
72all:		${ALL}
73
74depend:
75
76install:	${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} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 ${INSTALL_CF} \
84		${DEST_CF}
85.endif
86.endif
87.if defined(SENDMAIL_ADDITIONAL_CF)
88	${INSTALL} ${COPY} -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} ${COPY} -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
101distribution:	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} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/freebsd.mc \
107		${DESTDIR}/etc/mail/freebsd.mc
108	${INSTALL} ${COPY} -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} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 ${INSTALL_CF} \
113		${DEST_CF}
114.endif
115.else
116	${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 freebsd.cf \
117		${DEST_CF}
118.endif
119	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 ${CFDIR}/cf/submit.mc \
120	    ${DESTDIR}/etc/mail/freebsd.submit.mc
121	${INSTALL} -c -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} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 \
127		${INSTALL_SUBMIT_CF} ${DEST_SUBMIT_CF}
128.endif
129.else
130	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 ${CFDIR}/cf/submit.cf \
131	    ${DEST_SUBMIT_CF}
132.endif
133.endif
134	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 ${SMDIR}/helpfile \
135	    ${DESTDIR}/etc/mail/helpfile
136	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \
137	    ${DESTDIR}/var/log/sendmail.st
138
139.include <bsd.prog.mk>
140