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