xref: /freebsd/etc/sendmail/Makefile (revision 8c3a85eaeb0552569e81be43091a18b9e702cc41)
176bfe4c3SPeter Wemm
276bfe4c3SPeter WemmM4=		m4
376bfe4c3SPeter WemmCHMOD=		chmod
476bfe4c3SPeter WemmROMODE=		444
576bfe4c3SPeter WemmRM=		rm -f
6a38a3724SGregory Neil Shapiro
76dcff5b7SWarner LoshSENDMAIL_DIR=	${SRCTOP}/contrib/sendmail
8a38a3724SGregory Neil ShapiroSMDIR=		${SENDMAIL_DIR}/src
977e399e8SGregory Neil ShapiroSENDMAIL_CF_DIR?=${SENDMAIL_DIR}/cf
10fab9e3acSGregory Neil Shapiro
11fab9e3acSGregory Neil Shapiro# this is overkill, but....
1277e399e8SGregory Neil ShapiroM4FILES!=	find ${SENDMAIL_CF_DIR} -type f -name '*.m4' -print
1376bfe4c3SPeter Wemm
1476bfe4c3SPeter Wemm.SUFFIXES: .mc .cf
1576bfe4c3SPeter Wemm
16fab9e3acSGregory Neil Shapiro.mc.cf: ${M4FILES}
17fab9e3acSGregory Neil Shapiro	${RM} ${.TARGET}
18e1848069SGregory Neil Shapiro	${M4} -D_CF_DIR_=${SENDMAIL_CF_DIR}/ -D_NO_MAKEINFO_ \
19e1848069SGregory Neil Shapiro	    ${SENDMAIL_M4_FLAGS} \
2077e399e8SGregory Neil Shapiro	    ${SENDMAIL_CF_DIR}/m4/cf.m4 ${.IMPSRC} > ${.TARGET}
21fab9e3acSGregory Neil Shapiro	${CHMOD} ${ROMODE} ${.TARGET}
2276bfe4c3SPeter Wemm
23255bbde2SGregory Neil ShapiroDEST_CF=	${DESTDIR}/etc/mail/sendmail.cf
24255bbde2SGregory Neil ShapiroDEST_SUBMIT_CF=	${DESTDIR}/etc/mail/submit.cf
25255bbde2SGregory Neil Shapiro
26f92921ddSGregory Neil ShapiroALL=		freebsd.cf freebsd.submit.cf
27f92921ddSGregory Neil ShapiroCLEANFILES=	freebsd.cf freebsd.submit.cf
2876bfe4c3SPeter Wemm
2925219d25SGregory Neil Shapiro# Local SENDMAIL_MC or SENDMAIL_CF may be set in /etc/make.conf.
3025219d25SGregory Neil Shapiro# Warning!  If set, this causes 'make install' to always copy it
3125219d25SGregory Neil Shapiro# over /etc/mail/sendmail.cf!!!
3276bfe4c3SPeter Wemm# Caveat emptor!  Be sure you want this before you enable it.
33bee2fe72SRuslan Ermilov.if defined(SENDMAIL_MC) && defined(SENDMAIL_CF)
34bee2fe72SRuslan Ermilov.error Both SENDMAIL_MC and SENDMAIL_CF cannot be set.
35bee2fe72SRuslan Ermilov.elif defined(SENDMAIL_MC)
36255bbde2SGregory Neil ShapiroINSTALL_CF=	${SENDMAIL_MC:T:R}.cf
37255bbde2SGregory Neil ShapiroALL+=		${INSTALL_CF}
386cabd2d9SGregory Neil ShapiroCLEANFILES+=	${SENDMAIL_MC:T:R}.cf
39255bbde2SGregory Neil Shapiro${INSTALL_CF}: ${SENDMAIL_MC}
40255bbde2SGregory Neil Shapiro.elif defined(SENDMAIL_CF)
416cabd2d9SGregory Neil ShapiroALL+=		${SENDMAIL_CF}
4225219d25SGregory Neil ShapiroINSTALL_CF=	${SENDMAIL_CF}
4325219d25SGregory Neil Shapiro.endif
44255bbde2SGregory Neil Shapiro
45255bbde2SGregory Neil Shapiro.if !defined(SENDMAIL_SET_USER_ID) && defined(SENDMAIL_SUBMIT_MC)
46255bbde2SGregory Neil ShapiroINSTALL_SUBMIT_CF= ${SENDMAIL_SUBMIT_MC:T:R}.cf
47255bbde2SGregory Neil ShapiroALL+=		${INSTALL_SUBMIT_CF}
486cabd2d9SGregory Neil ShapiroCLEANFILES+=	${INSTALL_SUBMIT_CF}
49255bbde2SGregory Neil Shapiro${INSTALL_SUBMIT_CF}: ${SENDMAIL_SUBMIT_MC}
5025219d25SGregory Neil Shapiro.endif
5125219d25SGregory Neil Shapiro
52255bbde2SGregory Neil Shapiro# Additional .cf files to build.
53e6c77250SGregory Neil Shapiro.if defined(SENDMAIL_ADDITIONAL_MC)
54255bbde2SGregory Neil ShapiroSENDMAIL_ADDITIONAL_CF= ${SENDMAIL_ADDITIONAL_MC:T:S/.mc$/.cf/}
55c8e96857SGregory Neil ShapiroALL+=		${SENDMAIL_ADDITIONAL_CF}
566cabd2d9SGregory Neil ShapiroCLEANFILES+=	${SENDMAIL_ADDITIONAL_CF}
57255bbde2SGregory Neil Shapiro.for mc in ${SENDMAIL_ADDITIONAL_MC}
58255bbde2SGregory Neil Shapiro${mc:T:R}.cf: ${mc}
59255bbde2SGregory Neil Shapiro.endfor
60e6c77250SGregory Neil Shapiro.endif
61e6c77250SGregory Neil Shapiro
62fab9e3acSGregory Neil Shapiroall: ${ALL}
6376bfe4c3SPeter Wemm
64bee2fe72SRuslan Ermilovdistribution:
65*8c3a85eaSBaptiste Daroussin	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 -T "package=sendmail,config" \
66255bbde2SGregory Neil Shapiro	    ${.CURDIR}/freebsd.mc freebsd.cf ${DESTDIR}/etc/mail
67*8c3a85eaSBaptiste Daroussin	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 -T "package=sendmail,config" \
681f9b7c96SGregory Neil Shapiro	    ${.CURDIR}/freebsd.submit.mc freebsd.submit.cf ${DESTDIR}/etc/mail
69*8c3a85eaSBaptiste Daroussin	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 -T "package=sendmail,config" \
70255bbde2SGregory Neil Shapiro	    ${SMDIR}/helpfile ${DESTDIR}/etc/mail
71ff446b05SPeter Wemm.if defined(INSTALL_CF)
72*8c3a85eaSBaptiste Daroussin	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 -T "package=sendmail,config" \
73255bbde2SGregory Neil Shapiro	    ${INSTALL_CF} ${DEST_CF}
74ff446b05SPeter Wemm.else
75*8c3a85eaSBaptiste Daroussin	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 -T "package=sendmail,config" \
76ff446b05SPeter Wemm	    freebsd.cf ${DEST_CF}
7714d6d765SGregory Neil Shapiro.endif
78bee2fe72SRuslan Ermilov.if defined(SENDMAIL_ADDITIONAL_CF)
79*8c3a85eaSBaptiste Daroussin	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 -T "package=sendmail,config" \
80c8e96857SGregory Neil Shapiro	    ${SENDMAIL_ADDITIONAL_CF} ${DESTDIR}/etc/mail
81c8e96857SGregory Neil Shapiro.endif
82ff446b05SPeter Wemm.if !defined(SENDMAIL_SET_USER_ID)
83ff446b05SPeter Wemm.if defined(INSTALL_SUBMIT_CF)
84*8c3a85eaSBaptiste Daroussin	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 -T "package=sendmail,config" \
8514d6d765SGregory Neil Shapiro	    ${INSTALL_SUBMIT_CF} ${DEST_SUBMIT_CF}
86ff446b05SPeter Wemm.else
87*8c3a85eaSBaptiste Daroussin	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 -T "package=sendmail,config" \
88ff446b05SPeter Wemm	    freebsd.submit.cf ${DEST_SUBMIT_CF}
89ff446b05SPeter Wemm.endif
9014d6d765SGregory Neil Shapiro.endif
9176bfe4c3SPeter Wemm
9276bfe4c3SPeter Wemm.include <bsd.prog.mk>
93