--- a/sendmail/Makefile.m4
+++ b/sendmail/Makefile.m4
@@ -69,6 +69,7 @@ install-set-user-id: bldCURRENT_PRODUCT
 	${INSTALL} -c -m ${S`'BINMODE} bldCURRENT_PRODUCT ${DESTDIR}${M`'BINDIR}
 	for i in ${sendmailTARGET_LINKS}; do \
 		rm -f $$i; \
+		mkdir -p $$(dirname $$i); \
 		${LN} ${LNOPTS} ${M`'BINDIR}/sendmail $$i; \
 	done
 
@@ -77,6 +78,7 @@ install-sm-mta: bldCURRENT_PRODUCT
 	${INSTALL} -c -m ${M`'BINMODE} bldCURRENT_PRODUCT ${DESTDIR}${M`'BINDIR}/sm-mta
 	for i in confMTA_LINKS; do \
 		rm -f $$i; \
+		mkdir -p $$(dirname $$i); \
 		${LN} ${LNOPTS} ${M`'BINDIR}/sm-mta $$i; \
 	done
 
--- a/devtools/M4/UNIX/links.m4
+++ b/devtools/M4/UNIX/links.m4
@@ -23,6 +23,7 @@ define(`bldMAKE_SOURCE_LINKS',
 define(`bldMAKE_TARGET_LINKS',
 `	for i in $2; do \
 		rm -f $$i; \
+		mkdir -p $$(dirname $$i); \
 		ln -s $1 $$i; \
 	done'
 )dnl
--- a/cf/cf/Makefile
+++ b/cf/cf/Makefile
@@ -80,9 +80,11 @@ install:
 install-cf:  install-sendmail-cf install-submit-cf
 
 install-sendmail-cf: $(CF).cf
+	mkdir -p ${DESTDIR}$(MAILDIR)
 	$(INSTALL) -c -m $(CFMODE) $(CF).cf ${DESTDIR}$(MAILDIR)/sendmail.cf
 
 install-submit-cf: $(SUBMIT).cf
+	mkdir -p ${DESTDIR}$(MAILDIR)
 	$(INSTALL) -c -m $(CFMODE) $(SUBMIT).cf ${DESTDIR}$(MAILDIR)/submit.cf
 
 depend:
