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