git: 061e8e6ba60e - main - Makefile.xtras: fix show-valid-targets

From: Simon J. Gerraty <sjg_at_FreeBSD.org>
Date: Thu, 20 Apr 2023 02:00:25 UTC
The branch main has been updated by sjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=061e8e6ba60e10e7d25e45e63d44a54186ed845e

commit 061e8e6ba60e10e7d25e45e63d44a54186ed845e
Author:     Simon J. Gerraty <sjg@FreeBSD.org>
AuthorDate: 2023-04-20 01:59:53 +0000
Commit:     Simon J. Gerraty <sjg@FreeBSD.org>
CommitDate: 2023-04-20 01:59:53 +0000

    Makefile.xtras: fix show-valid-targets
    
    Use ALL_MACHINE_LIST and leverage .MAKE.DEPENDFILE_PREFERENCE
---
 targets/Makefile.xtras | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/targets/Makefile.xtras b/targets/Makefile.xtras
index 124bddc9b01c..6e328cd3e7cd 100644
--- a/targets/Makefile.xtras
+++ b/targets/Makefile.xtras
@@ -34,21 +34,20 @@ OTHER_TARGETS = \
 	destroy-stage \
 
 BUILD_TARGETS_${MACHINE:tu} != cd ${_here} && \
-	find . \( -name Makefile.depend -o -name ${.MAKE.DEPENDFILE:T} \) | \
+	find . \( ${${.MAKE.DEPENDFILE:T} ${.MAKE.DEPENDFILE_PREFIX}:L:O:u:@m@-name $m -o@:tW:S,-o$,,} \) | \
 	sed 's,/Makefile.*,,;s,^./,,' | sort -u
 
-.for _machine in ${all_machine_list}
+.for _machine in ${ALL_MACHINE_LIST}
 _targets_${_machine} != cd ${_here} && \
-	find . \( -name Makefile.depend.${_machine} -o \
-	    -name ${.MAKE.DEPENDFILE:T}.${_machine} \) | \
+	find . \( ${.MAKE.DEPENDFILE_PREFERENCE:T:M*${MACHINE}*:S,${MACHINE},${_machine},g:O:u:@m@-name $m -o@:tW:S,-o$,,} \) | \
 	sed 's,/Makefile.*,,;s,^./,,' | sort -u
 BUILD_TARGETS_${_machine:tu} += ${_targets_${_machine}}
 .endfor
 
 show-valid-targets:
-.for _machine in ${all_machine_list:O}
+.for _machine in ${ALL_MACHINE_LIST:O}
 .if !empty(BUILD_TARGETS_${_machine:tu})
-	@echo "Build targets for ${_machine} (leave out the ${target_dirs:S,${_here:T},,:S,^/,,:S,$,/,}):"
+	@echo "Build targets for ${_machine} (leave out the ${DIRDEPS_TARGETS_DIRS:S,${_here:T},,:S,^/,,:S,$,/,}):"
 	@echo -e "${BUILD_TARGETS_${_machine:tu}:O:ts\n}" | sed -e 's,^,  ,'
 	@echo
 .endif