Makefile revision 91187
1#	@(#)Makefile	8.19 (Berkeley) 1/14/97
2# $FreeBSD: head/etc/sendmail/Makefile 91187 2002-02-24 02:38:23Z 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
40DEST_CF=	${DESTDIR}/etc/mail/sendmail.cf
41
42ALL+=		${INSTALL_CF}
43
44# Make sure we don't remove /etc/mail/sendmail.cf on make clean
45# since this will break a running system during a buildworld.
46.if defined(INSTALL_CF)
47.if ${INSTALL_CF} != ${DEST_CF}
48CLEANFILES+=	${INSTALL_CF}
49.endif
50.endif
51
52# Additional .cf files to build
53.if defined(SENDMAIL_ADDITIONAL_MC)
54SENDMAIL_ADDITIONAL_CF=	${SENDMAIL_ADDITIONAL_MC:S/.mc$/.cf/g}
55ALL+=		${SENDMAIL_ADDITIONAL_CF}
56CLEANFILES+=	${SENDMAIL_ADDITIONAL_CF}
57.endif
58
59all:		${ALL}
60
61depend:
62
63install:	${INSTALL_CF}
64.if (defined(SENDMAIL_MC) && defined(SENDMAIL_CF))
65	@echo ">>> ERROR: Both SENDMAIL_CF and SENDMAIL_MC can not be set"
66	@false
67.endif
68.if defined(INSTALL_CF)
69.if ${INSTALL_CF} != ${DEST_CF}
70	${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 ${INSTALL_CF} \
71		${DEST_CF}
72.endif
73.if defined(SENDMAIL_ADDITIONAL_CF)
74	${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 \
75		${SENDMAIL_ADDITIONAL_CF} ${DESTDIR}/etc/mail
76.endif
77.endif
78
79# Helper for src/etc/Makefile
80distribution:	freebsd.cf freebsd.mc ${INSTALL_CF}
81.if (defined(SENDMAIL_MC) && defined(SENDMAIL_CF))
82	@echo ">>> ERROR: Both SENDMAIL_CF and SENDMAIL_MC can not be set"
83	@false
84.endif
85	${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/freebsd.mc \
86		${DESTDIR}/etc/mail/freebsd.mc
87	${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 freebsd.cf \
88		${DESTDIR}/etc/mail/freebsd.cf
89.if defined(INSTALL_CF)
90.if ${INSTALL_CF} != ${DEST_CF}
91	${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 ${INSTALL_CF} \
92		${DEST_CF}
93.endif
94.else
95	${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 freebsd.cf \
96		${DEST_CF}
97.endif
98.ifndef SENDMAIL_SET_USER_ID
99	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 ${CFDIR}/cf/submit.mc \
100	    ${DESTDIR}/etc/mail/submit.mc
101	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 ${CFDIR}/cf/submit.cf \
102	    ${DESTDIR}/etc/mail/submit.cf
103.endif
104	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 ${SMDIR}/helpfile \
105	    ${DESTDIR}/etc/mail/helpfile
106	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
107	    ${DESTDIR}/var/log/sendmail.st
108
109.include <bsd.prog.mk>
110