Makefile revision 86639
1#	@(#)Makefile	8.19 (Berkeley) 1/14/97
2# $FreeBSD: head/etc/sendmail/Makefile 86639 2001-11-20 03:41:05Z 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
26
27# Local SENDMAIL_MC or SENDMAIL_CF may be set in /etc/make.conf.
28# Warning! If set, this causes 'make install' to always copy it
29# over /etc/mail/sendmail.cf!!!
30# Caveat emptor!  Be sure you want this before you enable it.
31.if defined(SENDMAIL_MC)
32INSTALL_CF=	${SENDMAIL_MC:R}.cf
33.else
34.if defined(SENDMAIL_CF)
35INSTALL_CF=	${SENDMAIL_CF}
36.endif
37.endif
38
39DEST_CF=	${DESTDIR}/etc/mail/sendmail.cf
40
41ALL+=		${INSTALL_CF}
42
43# Additional .cf files to build
44.if defined(SENDMAIL_ADDITIONAL_MC)
45SENDMAIL_ADDITIONAL_CF=	${SENDMAIL_ADDITIONAL_MC:S/.mc$/.cf/g}
46ALL+=		${SENDMAIL_ADDITIONAL_CF}
47.endif
48
49CLEANFILES+=	${ALL}
50
51all:		${ALL}
52
53depend:
54
55install:	${INSTALL_CF}
56.if (defined(SENDMAIL_MC) && defined(SENDMAIL_CF))
57	@echo ">>> ERROR: Both SENDMAIL_CF and SENDMAIL_MC can not be set"
58	@false
59.endif
60.if defined(INSTALL_CF)
61.if ${INSTALL_CF} != ${DEST_CF}
62	${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 ${INSTALL_CF} \
63		${DEST_CF}
64.endif
65.if defined(SENDMAIL_ADDITIONAL_CF)
66	${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 \
67		${SENDMAIL_ADDITIONAL_CF} ${DESTDIR}/etc/mail
68.endif
69.endif
70
71# Helper for src/etc/Makefile
72distribution:	freebsd.cf freebsd.mc ${INSTALL_CF}
73.if (defined(SENDMAIL_MC) && defined(SENDMAIL_CF))
74	@echo ">>> ERROR: Both SENDMAIL_CF and SENDMAIL_MC can not be set"
75	@false
76.endif
77	${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/freebsd.mc \
78		${DESTDIR}/etc/mail/freebsd.mc
79	${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 freebsd.cf \
80		${DESTDIR}/etc/mail/freebsd.cf
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.else
87	${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 freebsd.cf \
88		${DEST_CF}
89.endif
90	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 ${SMDIR}/helpfile \
91	    ${DESTDIR}/etc/mail/helpfile
92	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
93	    ${DESTDIR}/var/log/sendmail.st
94
95.include <bsd.prog.mk>
96