xref: /freebsd/contrib/sendmail/src/Makefile.m4 (revision 0b3105a37d7adcadcb720112fed4dc4e8040be99)
1dnl $Id: Makefile.m4,v 8.143 2013-09-04 19:49:04 ca Exp $
2include(confBUILDTOOLSDIR`/M4/switch.m4')
3
4define(`confREQUIRE_LIBSM', `true')
5define(`confREQUIRE_SM_OS_H', `true')
6bldPRODUCT_START(`executable', `sendmail')
7define(`bldBIN_TYPE', `G')
8define(`bldINSTALL_DIR', `')
9define(`bldSOURCES', `main.c alias.c arpadate.c bf.c collect.c conf.c control.c convtime.c daemon.c deliver.c domain.c envelope.c err.c headers.c macro.c map.c mci.c milter.c mime.c parseaddr.c queue.c ratectrl.c readcf.c recipient.c sasl.c savemail.c sfsasl.c shmticklib.c sm_resolve.c srvrsmtp.c stab.c stats.c sysexits.c timers.c tls.c trace.c udb.c usersmtp.c util.c version.c ')
10PREPENDDEF(`confENVDEF', `confMAPDEF')
11bldPUSH_SMLIB(`sm')
12bldPUSH_SMLIB(`smutil')
13
14
15dnl hack: /etc/mail is not defined as "location of .cf" in the build system
16define(`bldTARGET_INST_DEP', ifdef(`confINST_DEP', `confINST_DEP',
17`${DESTDIR}/etc/mail/submit.cf ${DESTDIR}${MSPQ}'))dnl
18define(`bldTARGET_LINKS', ifdef(`confLINKS', `confLINKS',
19`${DESTDIR}${UBINDIR}/newaliases ${DESTDIR}${UBINDIR}/mailq ${DESTDIR}${UBINDIR}/hoststat ${DESTDIR}${UBINDIR}/purgestat')
20)dnl
21
22# location of sendmail statistics file (usually /etc/mail/ or /var/log)
23STDIR= ifdef(`confSTDIR', `confSTDIR', `/etc/mail')
24
25# statistics file name
26STFILE=	ifdef(`confSTFILE', `confSTFILE', `statistics')
27MSPSTFILE=ifdef(`confMSP_STFILE', `confMSP_STFILE', `sm-client.st')
28
29# full path to installed statistics file (usually ${STDIR}/statistics)
30STPATH= ${STDIR}/${STFILE}
31
32# location of sendmail helpfile file (usually /etc/mail)
33HFDIR= ifdef(`confHFDIR', `confHFDIR', `/etc/mail')
34
35# full path to installed help file (usually ${HFDIR}/helpfile)
36HFFILE= ${HFDIR}/ifdef(`confHFFILE', `confHFFILE', `helpfile')
37
38ifdef(`confSMSRCADD', `APPENDDEF(`confSRCADD', `confSMSRCADD')')
39ifdef(`confSMOBJADD', `APPENDDEF(`confOBJADD', `confSMOBJADD')')
40
41bldPUSH_TARGET(`statistics')
42divert(bldTARGETS_SECTION)
43statistics:
44	${CP} /dev/null statistics
45
46${DESTDIR}/etc/mail/submit.cf:
47	@echo "Please read INSTALL if anything fails while installing the binary."
48	@echo "${DESTDIR}/etc/mail/submit.cf will be installed now."
49	cd ${SRCDIR}/cf/cf && make install-submit-cf
50
51MSPQ=ifdef(`confMSP_QUEUE_DIR', `confMSP_QUEUE_DIR', `/var/spool/clientmqueue')
52
53${DESTDIR}${MSPQ}:
54	@echo "Please read INSTALL if anything fails while installing the binary."
55	@echo "You must have setup a new user ${MSPQOWN} and a new group ${GBINGRP}"
56	@echo "as explained in sendmail/SECURITY."
57	mkdir -p ${DESTDIR}${MSPQ}
58	chown ${MSPQOWN} ${DESTDIR}${MSPQ}
59	chgrp ${GBINGRP} ${DESTDIR}${MSPQ}
60	chmod 0770 ${DESTDIR}${MSPQ}
61
62divert(0)
63
64ifdef(`confSETUSERID_INSTALL', `bldPUSH_INSTALL_TARGET(`install-set-user-id')')
65ifdef(`confMTA_INSTALL', `bldPUSH_INSTALL_TARGET(`install-sm-mta')')
66ifdef(`confNO_HELPFILE_INSTALL',, `bldPUSH_INSTALL_TARGET(`install-hf')')
67ifdef(`confNO_STATISTICS_INSTALL',, `bldPUSH_INSTALL_TARGET(`install-st')')
68divert(bldTARGETS_SECTION)
69
70install-set-user-id: bldCURRENT_PRODUCT ifdef(`confNO_HELPFILE_INSTALL',, `install-hf') ifdef(`confNO_STATISTICS_INSTALL',, `install-st') ifdef(`confNO_MAN_BUILD',, `install-docs')
71	${INSTALL} -c -o ${S`'BINOWN} -g ${S`'BINGRP} -m ${S`'BINMODE} bldCURRENT_PRODUCT ${DESTDIR}${M`'BINDIR}
72	for i in ${sendmailTARGET_LINKS}; do \
73		rm -f $$i; \
74		${LN} ${LNOPTS} ${M`'BINDIR}/sendmail $$i; \
75	done
76
77define(`confMTA_LINKS', `${DESTDIR}${UBINDIR}/newaliases ${DESTDIR}${UBINDIR}/mailq ${DESTDIR}${UBINDIR}/hoststat ${DESTDIR}${UBINDIR}/purgestat')
78install-sm-mta: bldCURRENT_PRODUCT
79	${INSTALL} -c -o ${M`'BINOWN} -g ${M`'BINGRP} -m ${M`'BINMODE} bldCURRENT_PRODUCT ${DESTDIR}${M`'BINDIR}/sm-mta
80	for i in confMTA_LINKS; do \
81		rm -f $$i; \
82		${LN} ${LNOPTS} ${M`'BINDIR}/sm-mta $$i; \
83	done
84
85install-hf:
86	if [ ! -d ${DESTDIR}${HFDIR} ]; then mkdir -p ${DESTDIR}${HFDIR}; else :; fi
87	${INSTALL} -c -o ${UBINOWN} -g ${UBINGRP} -m 444 helpfile ${DESTDIR}${HFFILE}
88
89install-st: statistics
90	if [ ! -d ${DESTDIR}${STDIR} ]; then mkdir -p ${DESTDIR}${STDIR}; else :; fi
91	${INSTALL} -c -o ${SBINOWN} -g ${UBINGRP} -m ifdef(`confSTMODE', `confSTMODE', `0600') statistics ${DESTDIR}${STPATH}
92
93install-submit-st: statistics ${DESTDIR}${MSPQ}
94	${INSTALL} -c -o ${MSPQOWN} -g ${GBINGRP} -m ifdef(`confSTMODE', `confSTMODE', `0600') statistics ${DESTDIR}${MSPQ}/${MSPSTFILE}
95
96divert(0)
97bldPRODUCT_END
98
99bldPRODUCT_START(`manpage', `sendmail')
100define(`bldSOURCES', `sendmail.8 aliases.5 mailq.1 newaliases.1')
101bldPRODUCT_END
102
103bldFINISH
104