1# $FreeBSD$ 2# 3# Makefile.xtras - non-build targets 4 5# Resist the urge to fill this with miscellaneous junk 6 7# We are not building here (shouldn't be), so no meta mode. 8.MAKE.MODE = normal 9 10_here := ${_PARSEDIR} 11 12.MAIN: no-default 13 14.if !empty(SB_NAME) 15# mk wrapper 16MAKE_CMD= mk 17MAKE_MACHINE_CMD= mk --machine <machine> 18.else 19# not using 'mk' 20MAKE_CMD= ${.MAKE:T} 21MAKE_MACHINE_CMD= env MACHINE=<machine> ${.MAKE:T} 22.endif 23 24no-default: 25 @echo "ERROR: there is no supported default target."; \ 26 echo "Try '${MAKE_CMD} help'" 27 28 29.if make(show-valid-targets) 30OTHER_TARGETS = \ 31 destroy \ 32 destroy-arch \ 33 destroy-host \ 34 destroy-stage \ 35 36BUILD_TARGETS != cd ${_here} && \ 37 find . \( -name Makefile.depend -o -name ${.MAKE.DEPENDFILE:T} \) | \ 38 sed 's,/Makefile.*,,;s,^./,,' | sort -u 39 40BUILD_TARGETS_HOST != cd ${_here} && \ 41 find . \( -name Makefile.depend.host -o -name ${.MAKE.DEPENDFILE:T}.host \) | \ 42 sed 's,/Makefile.*,,;s,^./,,' | sort -u 43 44show-valid-targets: 45.if !empty(BUILD_TARGETS_HOST) 46 @echo "Build targets for host (leave out the ${target_dirs:S,${_here:T},,:S,^/,,:S,$,/,}):" 47 @echo "${BUILD_TARGETS_HOST:O:ts\n}" 48 @echo 49.endif 50 @echo "Build targets for ${MACHINE} (leave out the ${target_dirs:S,${_here:T},,:S,^/,,:S,$,/,}):" 51 @echo "${BUILD_TARGETS:O:ts\n}" 52 @echo; echo "Other targets:"; echo "${OTHER_TARGETS:O:ts\n}" 53.endif 54 55help: show-help 56show-help: 57 @echo; \ 58 echo "You can see the targets which are valid for a given machine"; \ 59 echo "by running '${MAKE_MACHINE_CMD} show-valid-targets'"; \ 60 echo "For other information, read: ${HELP_DOCS:@d@${.newline}$d@}"; \ 61 echo 62 63not-valid-target: 64 @echo "ERROR: '${_TARGETS}' is not a valid target for ${MACHINE}." 65 66.if make(destroy*) 67.include <bsd.obj.mk> 68.endif 69 70.for t in ${_TARGETS:Nlove} 71.if !target($t) 72$t: not-valid-target show-help 73.endif 74.endfor 75