In r257079, SRCDIR is pointed to ${.CURDIR} when not set. However,

Makefile.inc1 is being called in sub-make's where make(1) would,
by default, implicitly chdir(2) to ${.OBJDIR} before executing any
targets.  This would make some targets, like delete-old, when trying
to derive various variables introduced by change r256921 using
``make -f Makefile.inc1'' that also rely on SRCDIR to fail.

This changeset adds an explicit cd ${.CURDIR} before these unwrapped
make calls, making them in line with the other ones that are already
being wrapped with the explicit chdir's.

Tested by:	gjb
MFC after:	5 days
This commit is contained in:
Xin LI 2013-10-29 17:46:26 +00:00
parent 3e4d5cd37b
commit 8b78b15bb7

View File

@ -1686,6 +1686,7 @@ delete-old-files:
# argument list will get too long. Using .for/.endfor make "loops" will make # argument list will get too long. Using .for/.endfor make "loops" will make
# the Makefile parser segfault. # the Makefile parser segfault.
@exec 3<&0; \ @exec 3<&0; \
cd ${.CURDIR}; \
${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
-V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \ -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
while read file; do \ while read file; do \
@ -1708,7 +1709,8 @@ delete-old-files:
check-old-files: check-old-files:
@echo ">>> Checking for old files" @echo ">>> Checking for old files"
@${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ @cd ${.CURDIR}; \
${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
-V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \ -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
while read file; do \ while read file; do \
if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
@ -1729,6 +1731,7 @@ delete-old-libs:
@echo ">>> Removing old libraries" @echo ">>> Removing old libraries"
@echo "${OLD_LIBS_MESSAGE}" | fmt @echo "${OLD_LIBS_MESSAGE}" | fmt
@exec 3<&0; \ @exec 3<&0; \
cd ${.CURDIR}; \
${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
-V OLD_LIBS | xargs -n1 | \ -V OLD_LIBS | xargs -n1 | \
while read file; do \ while read file; do \
@ -1748,7 +1751,8 @@ delete-old-libs:
check-old-libs: check-old-libs:
@echo ">>> Checking for old libraries" @echo ">>> Checking for old libraries"
@${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ @cd ${.CURDIR}; \
${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
-V OLD_LIBS | xargs -n1 | \ -V OLD_LIBS | xargs -n1 | \
while read file; do \ while read file; do \
if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
@ -1763,7 +1767,8 @@ check-old-libs:
delete-old-dirs: delete-old-dirs:
@echo ">>> Removing old directories" @echo ">>> Removing old directories"
@${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ @cd ${.CURDIR}; \
${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
-V OLD_DIRS | xargs -n1 | sort -r | \ -V OLD_DIRS | xargs -n1 | sort -r | \
while read dir; do \ while read dir; do \
if [ -d "${DESTDIR}/$${dir}" ]; then \ if [ -d "${DESTDIR}/$${dir}" ]; then \
@ -1776,7 +1781,8 @@ delete-old-dirs:
check-old-dirs: check-old-dirs:
@echo ">>> Checking for old directories" @echo ">>> Checking for old directories"
@${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ @cd ${.CURDIR}; \
${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
-V OLD_DIRS | xargs -n1 | \ -V OLD_DIRS | xargs -n1 | \
while read dir; do \ while read dir; do \
if [ -d "${DESTDIR}/$${dir}" ]; then \ if [ -d "${DESTDIR}/$${dir}" ]; then \