git: 12496806098d - main - kern.post.mk: fix PORTSDIR handling

From: Yuri Pankov <yuripv_at_FreeBSD.org>
Date: Mon, 27 Mar 2023 11:59:48 UTC
The branch main has been updated by yuripv:

URL: https://cgit.FreeBSD.org/src/commit/?id=12496806098d9d9915817edcd0df17cdd27f60c8

commit 12496806098d9d9915817edcd0df17cdd27f60c8
Author:     Yuri Pankov <yuripv@FreeBSD.org>
AuthorDate: 2023-03-27 11:42:31 +0000
Commit:     Yuri Pankov <yuripv@FreeBSD.org>
CommitDate: 2023-03-27 11:57:57 +0000

    kern.post.mk: fix PORTSDIR handling
    
    Using subshell's PORTSDIR variable (via $${PORTSDIR}}) seems to be
    only working if PORTSDIR is specified directly on the make command
    line.
    
    Use ${PORTDIR} here instead so that setting the variable in
    /etc/{make,src,src-env}.conf would work (also works for variable
    being set on command line or in the environment).
    
    PR:             268299
    Reviewed by:    imp
    Differential Revision:  https://reviews.freebsd.org/D37868
---
 sys/conf/kern.post.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/conf/kern.post.mk b/sys/conf/kern.post.mk
index da234d5b88a6..c368d5f40df8 100644
--- a/sys/conf/kern.post.mk
+++ b/sys/conf/kern.post.mk
@@ -133,7 +133,7 @@ PORTSMODULESENV=\
 all:
 .for __i in ${PORTS_MODULES}
 	@${ECHO} "===> Ports module ${__i} (all)"
-	cd $${PORTSDIR:-/usr/ports}/${__i}; ${PORTSMODULESENV} ${MAKE} -B clean build
+	cd ${PORTSDIR:U/usr/ports}/${__i}; ${PORTSMODULESENV} ${MAKE} -B clean build
 .endfor
 
 .for __target in install reinstall clean
@@ -141,7 +141,7 @@ ${__target}: ports-${__target}
 ports-${__target}:
 .for __i in ${PORTS_MODULES}
 	@${ECHO} "===> Ports module ${__i} (${__target})"
-	cd $${PORTSDIR:-/usr/ports}/${__i}; ${PORTSMODULESENV} ${MAKE} -B ${__target:C/(re)?install/deinstall reinstall/}
+	cd ${PORTSDIR:U/usr/ports}/${__i}; ${PORTSMODULESENV} ${MAKE} -B ${__target:C/(re)?install/deinstall reinstall/}
 .endfor
 .endfor
 .endif