1b6209a9bSSimon J. Gerraty# $FreeBSD$ 2b6209a9bSSimon J. Gerraty# 3b6209a9bSSimon J. Gerraty# Makefile.xtras - non-build targets 4b6209a9bSSimon J. Gerraty 5b6209a9bSSimon J. Gerraty# Resist the urge to fill this with miscellaneous junk 6b6209a9bSSimon J. Gerraty 7b6209a9bSSimon J. Gerraty# We are not building here (shouldn't be), so no meta mode. 8b6209a9bSSimon J. Gerraty.MAKE.MODE = normal 9b6209a9bSSimon J. Gerraty 10b6209a9bSSimon J. Gerraty_here := ${_PARSEDIR} 11b6209a9bSSimon J. Gerraty 12b6209a9bSSimon J. Gerraty.MAIN: no-default 13b6209a9bSSimon J. Gerraty 14f49116fcSSimon J. Gerraty.if !empty(SB_NAME) 15f49116fcSSimon J. Gerraty# mk wrapper 16f49116fcSSimon J. GerratyMAKE_CMD= mk 17f49116fcSSimon J. GerratyMAKE_MACHINE_CMD= mk --machine <machine> 18f49116fcSSimon J. Gerraty.else 19f49116fcSSimon J. Gerraty# not using 'mk' 20f49116fcSSimon J. GerratyMAKE_CMD= ${.MAKE:T} 21f49116fcSSimon J. GerratyMAKE_MACHINE_CMD= env MACHINE=<machine> ${.MAKE:T} 22f49116fcSSimon J. Gerraty.endif 23f49116fcSSimon J. Gerraty 24b6209a9bSSimon J. Gerratyno-default: 25b6209a9bSSimon J. Gerraty @echo "ERROR: there is no supported default target."; \ 26f49116fcSSimon J. Gerraty echo "Try '${MAKE_CMD} help'" 27b6209a9bSSimon J. Gerraty 28b6209a9bSSimon J. Gerraty 29b6209a9bSSimon J. Gerraty.if make(show-valid-targets) 30b6209a9bSSimon J. GerratyOTHER_TARGETS = \ 31b6209a9bSSimon J. Gerraty destroy \ 3276e72d4aSBryan Drewery destroy-arch \ 3376e72d4aSBryan Drewery destroy-host \ 3476e72d4aSBryan Drewery destroy-stage \ 35b6209a9bSSimon J. Gerraty 36700cb7f9SBryan DreweryBUILD_TARGETS_${MACHINE:tu} != cd ${_here} && \ 37*061e8e6bSSimon J. Gerraty find . \( ${${.MAKE.DEPENDFILE:T} ${.MAKE.DEPENDFILE_PREFIX}:L:O:u:@m@-name $m -o@:tW:S,-o$,,} \) | \ 38b6209a9bSSimon J. Gerraty sed 's,/Makefile.*,,;s,^./,,' | sort -u 39b6209a9bSSimon J. Gerraty 40*061e8e6bSSimon J. Gerraty.for _machine in ${ALL_MACHINE_LIST} 41700cb7f9SBryan Drewery_targets_${_machine} != cd ${_here} && \ 42*061e8e6bSSimon J. Gerraty find . \( ${.MAKE.DEPENDFILE_PREFERENCE:T:M*${MACHINE}*:S,${MACHINE},${_machine},g:O:u:@m@-name $m -o@:tW:S,-o$,,} \) | \ 43506ef4b1SBryan Drewery sed 's,/Makefile.*,,;s,^./,,' | sort -u 44700cb7f9SBryan DreweryBUILD_TARGETS_${_machine:tu} += ${_targets_${_machine}} 45700cb7f9SBryan Drewery.endfor 46506ef4b1SBryan Drewery 47b6209a9bSSimon J. Gerratyshow-valid-targets: 48*061e8e6bSSimon J. Gerraty.for _machine in ${ALL_MACHINE_LIST:O} 49700cb7f9SBryan Drewery.if !empty(BUILD_TARGETS_${_machine:tu}) 50*061e8e6bSSimon J. Gerraty @echo "Build targets for ${_machine} (leave out the ${DIRDEPS_TARGETS_DIRS:S,${_here:T},,:S,^/,,:S,$,/,}):" 514f1c85dfSBryan Drewery @echo -e "${BUILD_TARGETS_${_machine:tu}:O:ts\n}" | sed -e 's,^, ,' 52506ef4b1SBryan Drewery @echo 53506ef4b1SBryan Drewery.endif 54700cb7f9SBryan Drewery.endfor 554f1c85dfSBryan Drewery @echo "Other targets:"; echo "${OTHER_TARGETS:O:ts\n}" | sed -e 's,^, ,' 56b6209a9bSSimon J. Gerraty.endif 57b6209a9bSSimon J. Gerraty 58b6209a9bSSimon J. Gerratyhelp: show-help 59b6209a9bSSimon J. Gerratyshow-help: 60b6209a9bSSimon J. Gerraty @echo; \ 61b6209a9bSSimon J. Gerraty echo "You can see the targets which are valid for a given machine"; \ 62f49116fcSSimon J. Gerraty echo "by running '${MAKE_MACHINE_CMD} show-valid-targets'"; \ 63b6209a9bSSimon J. Gerraty echo "For other information, read: ${HELP_DOCS:@d@${.newline}$d@}"; \ 64b6209a9bSSimon J. Gerraty echo 65b6209a9bSSimon J. Gerraty 66b6209a9bSSimon J. Gerratynot-valid-target: 67b6209a9bSSimon J. Gerraty @echo "ERROR: '${_TARGETS}' is not a valid target for ${MACHINE}." 68b6209a9bSSimon J. Gerraty 695d5a53b4SBryan Drewery.if make(destroy*) 70b0db6676SBryan Drewery.include <bsd.obj.mk> 715d5a53b4SBryan Drewery.endif 72b6209a9bSSimon J. Gerraty 73b6209a9bSSimon J. Gerraty.for t in ${_TARGETS:Nlove} 74b6209a9bSSimon J. Gerraty.if !target($t) 75b6209a9bSSimon J. Gerraty$t: not-valid-target show-help 76b6209a9bSSimon J. Gerraty.endif 77b6209a9bSSimon J. Gerraty.endfor 78