Make installing to a non-existent directory an error.

Before this, if a file was installed to DESTDIR/some/dir and that directory
was missing due to not having ran 'make distrib-dirs' yet, the file would
be installed as 'some/dir'.  For something like bsd.incs.mk with INCLUDEDIR
being a sub-directory of /usr/include, this could result in all of the headers
being installed to a file rather than getting a directory of them.

Now it will error that the file/directory does not exist rather than hide
the issue.

Another option being discussed is to implement GNU's install -D flag which
would auto create any missing directories.

This is a mitigation of the problem.  The proper order to the build is to
run 'make distrib-dirs' first, but that can be forgotten if building from
a sub-directory after updating the source code to the latest revision.

MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
This commit is contained in:
Bryan Drewery 2015-10-15 22:49:56 +00:00
parent 7b9c2f1643
commit 61c20fc782
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=289391
7 changed files with 15 additions and 15 deletions

View File

@ -69,7 +69,7 @@ _${group}INS: ${_${group}CONFS}
${.ALLSRC} ${DESTDIR}${${group}DIR}/${${group}NAME}
.else
${INSTALL} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \
${.ALLSRC} ${DESTDIR}${${group}DIR}
${.ALLSRC} ${DESTDIR}${${group}DIR}/
.endif
.endif

View File

@ -75,7 +75,7 @@ _${group}INS: ${_${group}FILES}
${DESTDIR}${${group}DIR}/${${group}NAME}
.else
${INSTALL} -o ${${group}OWN} -g ${${group}GRP} \
-m ${${group}MODE} ${.ALLSRC} ${DESTDIR}${${group}DIR}
-m ${${group}MODE} ${.ALLSRC} ${DESTDIR}${${group}DIR}/
.endif
.endif

View File

@ -70,7 +70,7 @@ _${group}INS: ${_${group}INCS}
${.ALLSRC} ${DESTDIR}${${group}DIR}/${${group}NAME}
.else
${INSTALL} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \
${.ALLSRC} ${DESTDIR}${${group}DIR}
${.ALLSRC} ${DESTDIR}${${group}DIR}/
.endif
.endif

View File

@ -177,11 +177,11 @@ CLEANFILES+= ${INFO:S/$/.info.*.html/} ${INFO:S/$/.info/}
install: ${INSTALLINFODIRS}
.if !empty(IFILES:N*.html)
${INSTALL} -o ${INFOOWN} -g ${INFOGRP} -m ${INFOMODE} \
${IFILES:N*.html} ${DESTDIR}${INFODIR}
${IFILES:N*.html} ${DESTDIR}${INFODIR}/
.endif
.if !empty(FORMATS:Mhtml)
${INSTALL} -o ${INFOOWN} -g ${INFOGRP} -m ${INFOMODE} \
${INFO:S/$/.info.*.html/} ${DESTDIR}${INFODIR}
${INFO:S/$/.info.*.html/} ${DESTDIR}${INFODIR}/
.endif
.else
# The indirection in the following is to avoid the null install rule

View File

@ -339,23 +339,23 @@ realinstall: _libinstall
_libinstall:
.if defined(LIB) && !empty(LIB) && ${MK_INSTALLLIB} != "no"
${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
${_INSTALLFLAGS} lib${LIB_PRIVATE}${LIB}.a ${DESTDIR}${_LIBDIR}
${_INSTALLFLAGS} lib${LIB_PRIVATE}${LIB}.a ${DESTDIR}${_LIBDIR}/
.endif
.if ${MK_PROFILE} != "no" && defined(LIB) && !empty(LIB)
${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
${_INSTALLFLAGS} lib${LIB_PRIVATE}${LIB}_p.a ${DESTDIR}${_LIBDIR}
${_INSTALLFLAGS} lib${LIB_PRIVATE}${LIB}_p.a ${DESTDIR}${_LIBDIR}/
.endif
.if defined(SHLIB_NAME)
${INSTALL} ${STRIP} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
${_INSTALLFLAGS} ${_SHLINSTALLFLAGS} \
${SHLIB_NAME} ${DESTDIR}${_SHLIBDIR}
${SHLIB_NAME} ${DESTDIR}${_SHLIBDIR}/
.if ${MK_DEBUG_FILES} != "no"
.if defined(DEBUGMKDIR)
${INSTALL} -T debug -d ${DESTDIR}${DEBUGFILEDIR}
${INSTALL} -T debug -d ${DESTDIR}${DEBUGFILEDIR}/
.endif
${INSTALL} -T debug -o ${LIBOWN} -g ${LIBGRP} -m ${DEBUGMODE} \
${_INSTALLFLAGS} \
${SHLIB_NAME}.debug ${DESTDIR}${DEBUGFILEDIR}
${SHLIB_NAME}.debug ${DESTDIR}${DEBUGFILEDIR}/
.endif
.if defined(SHLIB_LINK)
.if commands(${SHLIB_LINK:R}.ld)
@ -378,11 +378,11 @@ _libinstall:
.endif # SHIB_NAME
.if defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) && ${MK_TOOLCHAIN} != "no"
${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
${_INSTALLFLAGS} lib${LIB}_pic.a ${DESTDIR}${_LIBDIR}
${_INSTALLFLAGS} lib${LIB}_pic.a ${DESTDIR}${_LIBDIR}/
.endif
.if defined(WANT_LINT) && !defined(NO_LINT) && defined(LIB) && !empty(LIB)
${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
${_INSTALLFLAGS} ${LINTLIB} ${DESTDIR}${LINTLIBDIR}
${_INSTALLFLAGS} ${LINTLIB} ${DESTDIR}${LINTLIBDIR}/
.endif
.endif # !defined(INTERNALLIB)

View File

@ -187,7 +187,7 @@ _maninstall: ${MAN}
.endfor
.else
.for _page _sect in ${.ALLSRC:C/\.([^.]*)$/.\1 \1/}
@d=${DESTDIR}${MANDIR}${_sect}${MANSUBDIR}; \
@d=${DESTDIR}${MANDIR}${_sect}${MANSUBDIR}/; \
${ECHO} ${MINSTALL} ${_page} $${d}; \
${MINSTALL} $${page} $${d};
.endfor
@ -201,7 +201,7 @@ _maninstall: ${MAN}
.else
.for __page in ${MAN}
${MINSTALL} ${__page:T:S/$/${MCOMPRESS_EXT}/g} \
${DESTDIR}${MANDIR}${__page:E}${MANSUBDIR}
${DESTDIR}${MANDIR}${__page:E}${MANSUBDIR}/
.if defined(MANBUILDCAT) && !empty(MANBUILDCAT)
${MINSTALL} ${__page:T:S/$/${CATEXT}${MCOMPRESS_EXT}/g} \
${DESTDIR}${CATDIR}${__page:E}${MANSUBDIR}/${__page:T:S/$/${MCOMPRESS_EXT}/}

View File

@ -205,7 +205,7 @@ _proginstall:
${_INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR}/${PROGNAME}
.if ${MK_DEBUG_FILES} != "no"
.if defined(DEBUGMKDIR)
${INSTALL} -T debug -d ${DESTDIR}${DEBUGFILEDIR}
${INSTALL} -T debug -d ${DESTDIR}${DEBUGFILEDIR}/
.endif
${INSTALL} -T debug -o ${BINOWN} -g ${BINGRP} -m ${DEBUGMODE} \
${PROGNAME}.debug ${DESTDIR}${DEBUGFILEDIR}/${PROGNAME}.debug