xref: /freebsd/etc/sendmail/Makefile (revision e9ac41698b2f322d55ccf9da50a3596edb2c1800)
176bfe4c3SPeter WemmM4=		m4
276bfe4c3SPeter WemmCHMOD=		chmod
376bfe4c3SPeter WemmROMODE=		444
476bfe4c3SPeter WemmRM=		rm -f
5a38a3724SGregory Neil Shapiro
66dcff5b7SWarner LoshSENDMAIL_DIR=	${SRCTOP}/contrib/sendmail
7a38a3724SGregory Neil ShapiroSMDIR=		${SENDMAIL_DIR}/src
877e399e8SGregory Neil ShapiroSENDMAIL_CF_DIR?=${SENDMAIL_DIR}/cf
9fab9e3acSGregory Neil Shapiro
10fab9e3acSGregory Neil Shapiro# this is overkill, but....
1177e399e8SGregory Neil ShapiroM4FILES!=	find ${SENDMAIL_CF_DIR} -type f -name '*.m4' -print
1276bfe4c3SPeter Wemm
1376bfe4c3SPeter Wemm.SUFFIXES: .mc .cf
1476bfe4c3SPeter Wemm
15fab9e3acSGregory Neil Shapiro.mc.cf: ${M4FILES}
16fab9e3acSGregory Neil Shapiro	${RM} ${.TARGET}
17e1848069SGregory Neil Shapiro	${M4} -D_CF_DIR_=${SENDMAIL_CF_DIR}/ -D_NO_MAKEINFO_ \
18e1848069SGregory Neil Shapiro	    ${SENDMAIL_M4_FLAGS} \
1977e399e8SGregory Neil Shapiro	    ${SENDMAIL_CF_DIR}/m4/cf.m4 ${.IMPSRC} > ${.TARGET}
20fab9e3acSGregory Neil Shapiro	${CHMOD} ${ROMODE} ${.TARGET}
2176bfe4c3SPeter Wemm
22255bbde2SGregory Neil ShapiroDEST_CF=	${DESTDIR}/etc/mail/sendmail.cf
23255bbde2SGregory Neil ShapiroDEST_SUBMIT_CF=	${DESTDIR}/etc/mail/submit.cf
24255bbde2SGregory Neil Shapiro
25f92921ddSGregory Neil ShapiroALL=		freebsd.cf freebsd.submit.cf
26f92921ddSGregory Neil ShapiroCLEANFILES=	freebsd.cf freebsd.submit.cf
2776bfe4c3SPeter Wemm
2825219d25SGregory Neil Shapiro# Local SENDMAIL_MC or SENDMAIL_CF may be set in /etc/make.conf.
2925219d25SGregory Neil Shapiro# Warning!  If set, this causes 'make install' to always copy it
3025219d25SGregory Neil Shapiro# over /etc/mail/sendmail.cf!!!
3176bfe4c3SPeter Wemm# Caveat emptor!  Be sure you want this before you enable it.
32bee2fe72SRuslan Ermilov.if defined(SENDMAIL_MC) && defined(SENDMAIL_CF)
33bee2fe72SRuslan Ermilov.error Both SENDMAIL_MC and SENDMAIL_CF cannot be set.
34bee2fe72SRuslan Ermilov.elif defined(SENDMAIL_MC)
35255bbde2SGregory Neil ShapiroINSTALL_CF=	${SENDMAIL_MC:T:R}.cf
36255bbde2SGregory Neil ShapiroALL+=		${INSTALL_CF}
376cabd2d9SGregory Neil ShapiroCLEANFILES+=	${SENDMAIL_MC:T:R}.cf
38255bbde2SGregory Neil Shapiro${INSTALL_CF}: ${SENDMAIL_MC}
39255bbde2SGregory Neil Shapiro.elif defined(SENDMAIL_CF)
406cabd2d9SGregory Neil ShapiroALL+=		${SENDMAIL_CF}
4125219d25SGregory Neil ShapiroINSTALL_CF=	${SENDMAIL_CF}
4225219d25SGregory Neil Shapiro.endif
43255bbde2SGregory Neil Shapiro
44255bbde2SGregory Neil Shapiro.if !defined(SENDMAIL_SET_USER_ID) && defined(SENDMAIL_SUBMIT_MC)
45255bbde2SGregory Neil ShapiroINSTALL_SUBMIT_CF= ${SENDMAIL_SUBMIT_MC:T:R}.cf
46255bbde2SGregory Neil ShapiroALL+=		${INSTALL_SUBMIT_CF}
476cabd2d9SGregory Neil ShapiroCLEANFILES+=	${INSTALL_SUBMIT_CF}
48255bbde2SGregory Neil Shapiro${INSTALL_SUBMIT_CF}: ${SENDMAIL_SUBMIT_MC}
4925219d25SGregory Neil Shapiro.endif
5025219d25SGregory Neil Shapiro
51255bbde2SGregory Neil Shapiro# Additional .cf files to build.
52e6c77250SGregory Neil Shapiro.if defined(SENDMAIL_ADDITIONAL_MC)
53255bbde2SGregory Neil ShapiroSENDMAIL_ADDITIONAL_CF= ${SENDMAIL_ADDITIONAL_MC:T:S/.mc$/.cf/}
54c8e96857SGregory Neil ShapiroALL+=		${SENDMAIL_ADDITIONAL_CF}
556cabd2d9SGregory Neil ShapiroCLEANFILES+=	${SENDMAIL_ADDITIONAL_CF}
56255bbde2SGregory Neil Shapiro.for mc in ${SENDMAIL_ADDITIONAL_MC}
57255bbde2SGregory Neil Shapiro${mc:T:R}.cf: ${mc}
58255bbde2SGregory Neil Shapiro.endfor
59e6c77250SGregory Neil Shapiro.endif
60e6c77250SGregory Neil Shapiro
61fab9e3acSGregory Neil Shapiroall: ${ALL}
6276bfe4c3SPeter Wemm
63bee2fe72SRuslan Ermilovdistribution:
64*8c3a85eaSBaptiste Daroussin	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 -T "package=sendmail,config" \
65255bbde2SGregory Neil Shapiro	    ${.CURDIR}/freebsd.mc freebsd.cf ${DESTDIR}/etc/mail
66*8c3a85eaSBaptiste Daroussin	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 -T "package=sendmail,config" \
671f9b7c96SGregory Neil Shapiro	    ${.CURDIR}/freebsd.submit.mc freebsd.submit.cf ${DESTDIR}/etc/mail
68*8c3a85eaSBaptiste Daroussin	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 -T "package=sendmail,config" \
69255bbde2SGregory Neil Shapiro	    ${SMDIR}/helpfile ${DESTDIR}/etc/mail
70ff446b05SPeter Wemm.if defined(INSTALL_CF)
71*8c3a85eaSBaptiste Daroussin	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 -T "package=sendmail,config" \
72255bbde2SGregory Neil Shapiro	    ${INSTALL_CF} ${DEST_CF}
73ff446b05SPeter Wemm.else
74*8c3a85eaSBaptiste Daroussin	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 -T "package=sendmail,config" \
75ff446b05SPeter Wemm	    freebsd.cf ${DEST_CF}
7614d6d765SGregory Neil Shapiro.endif
77bee2fe72SRuslan Ermilov.if defined(SENDMAIL_ADDITIONAL_CF)
78*8c3a85eaSBaptiste Daroussin	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 -T "package=sendmail,config" \
79c8e96857SGregory Neil Shapiro	    ${SENDMAIL_ADDITIONAL_CF} ${DESTDIR}/etc/mail
80c8e96857SGregory Neil Shapiro.endif
81ff446b05SPeter Wemm.if !defined(SENDMAIL_SET_USER_ID)
82ff446b05SPeter Wemm.if defined(INSTALL_SUBMIT_CF)
83*8c3a85eaSBaptiste Daroussin	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 -T "package=sendmail,config" \
8414d6d765SGregory Neil Shapiro	    ${INSTALL_SUBMIT_CF} ${DEST_SUBMIT_CF}
85ff446b05SPeter Wemm.else
86*8c3a85eaSBaptiste Daroussin	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 -T "package=sendmail,config" \
87ff446b05SPeter Wemm	    freebsd.submit.cf ${DEST_SUBMIT_CF}
88ff446b05SPeter Wemm.endif
8914d6d765SGregory Neil Shapiro.endif
9076bfe4c3SPeter Wemm
9176bfe4c3SPeter Wemm.include <bsd.prog.mk>
92