This should get rid of the weird error (don't know how to make
.../all/debug-*.tgz) when switching from !DEBUG_PACKAGES to DEBUG_PACKAGES.
Basically, this introduces a "build two targets at once" in bsd.port.mk.
make has some glue to figure out whether this is a "duplicate the work" or
"one target builds two things" (already used for yacc and friends), by
looking for variations on $@... which includes $@D for better or worse, hence
the small tweak.
This should work on all settings, including running make -jN package
(which doesn't make a lot of sense, but whatever).
Please check/test
Index: bsd.port.mk
===
RCS file: /cvs/ports/infrastructure/mk/bsd.port.mk,v
retrieving revision 1.1505
diff -u -p -r1.1505 bsd.port.mk
--- bsd.port.mk 26 Nov 2019 11:49:02 - 1.1505
+++ bsd.port.mk 27 Nov 2019 16:49:05 -
@@ -1183,6 +1183,7 @@ _EXCLUDE_DEBUG_PLISTS = ${_WRKDEBUG} ${_
PKG_ARGS${_S} += -A'${PKG_ARCH${_S}}'
_pkg${_S} = ${_PKGFILE${_S}}
+_pkg_cookie${_S} = ${_PACKAGE_COOKIE${_S}}
. if ${DEBUG_PACKAGES:M${_S}}
_DBG_PKG_ARGS${_S} := ${PKG_ARGS${_S}}
@@ -1194,6 +1195,7 @@ _DBG_PKG_ARGS${_S} += -DFULLPKGPATH=debu
_DBG_PKG_ARGS${_S} += -f ${_WRKDEBUG}/${PLIST${_S}:T}
_EXCLUDE_DEBUG_PLISTS += ${_WRKDEBUG}/${PLIST${_S}:T}
_pkg${_S} += ${_DBG_PKGFILE${_S}}
+_pkg_cookie${_S} += ${_DBG_PACKAGE_COOKIE${_S}}
. endif
# Finish filling out package command, and package dependencies
@@ -2073,8 +2075,8 @@ ${_CACHE_REPO}${_p}:
# The real package
-${_PACKAGE_COOKIE${_S}}:
- @${_PBUILD} install -d ${PACKAGE_REPOSITORY_MODE} ${@D} ${_TMP_REPO}
+${_pkg_cookie${_S}}:
+ @${_PBUILD} install -d ${PACKAGE_REPOSITORY_MODE} ${_PKG_REPO${_S}}
${_TMP_REPO}
. if ${FETCH_PACKAGES:L} != "no" &&
!defined(_TRIED_FETCHING_${_PACKAGE_COOKIE${_S}})
@${_INSTALL_CACHE_REPO} ${_CACHE_REPO}
@cd ${.CURDIR}; gotit=true; for p in ${_pkg${_S}}; do \