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