xref: /freebsd/targets/Makefile.xtras (revision 506ef4b10b2ccc67dd2bf563a85f318bb50d2b0b)
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
36b6209a9bSSimon J. GerratyBUILD_TARGETS != cd ${_here} && \
37b6209a9bSSimon J. Gerraty	find . \( -name Makefile.depend -o -name ${.MAKE.DEPENDFILE:T} \) | \
38b6209a9bSSimon J. Gerraty	sed 's,/Makefile.*,,;s,^./,,' | sort -u
39b6209a9bSSimon J. Gerraty
40*506ef4b1SBryan DreweryBUILD_TARGETS_HOST != cd ${_here} && \
41*506ef4b1SBryan Drewery	find . \( -name Makefile.depend.host -o -name ${.MAKE.DEPENDFILE:T}.host \) | \
42*506ef4b1SBryan Drewery	sed 's,/Makefile.*,,;s,^./,,' | sort -u
43*506ef4b1SBryan Drewery
44b6209a9bSSimon J. Gerratyshow-valid-targets:
45*506ef4b1SBryan Drewery.if !empty(BUILD_TARGETS_HOST)
46*506ef4b1SBryan Drewery	@echo "Build targets for host (leave out the ${target_dirs:S,${_here:T},,:S,^/,,:S,$,/,}):"
47*506ef4b1SBryan Drewery	@echo "${BUILD_TARGETS_HOST:O:ts\n}"
48*506ef4b1SBryan Drewery	@echo
49*506ef4b1SBryan Drewery.endif
50f49116fcSSimon J. Gerraty	@echo "Build targets for ${MACHINE} (leave out the ${target_dirs:S,${_here:T},,:S,^/,,:S,$,/,}):"
51*506ef4b1SBryan Drewery	@echo "${BUILD_TARGETS:O:ts\n}"
52*506ef4b1SBryan Drewery	@echo; echo "Other targets:"; echo "${OTHER_TARGETS:O:ts\n}"
53b6209a9bSSimon J. Gerraty.endif
54b6209a9bSSimon J. Gerraty
55b6209a9bSSimon J. Gerratyhelp: show-help
56b6209a9bSSimon J. Gerratyshow-help:
57b6209a9bSSimon J. Gerraty	@echo; \
58b6209a9bSSimon J. Gerraty	echo "You can see the targets which are valid for a given machine"; \
59f49116fcSSimon J. Gerraty	echo "by running '${MAKE_MACHINE_CMD} show-valid-targets'"; \
60b6209a9bSSimon J. Gerraty	echo "For other information, read: ${HELP_DOCS:@d@${.newline}$d@}"; \
61b6209a9bSSimon J. Gerraty	echo
62b6209a9bSSimon J. Gerraty
63b6209a9bSSimon J. Gerratynot-valid-target:
64b6209a9bSSimon J. Gerraty	@echo "ERROR: '${_TARGETS}' is not a valid target for ${MACHINE}."
65b6209a9bSSimon J. Gerraty
665d5a53b4SBryan Drewery.if make(destroy*)
67b0db6676SBryan Drewery.include <bsd.obj.mk>
685d5a53b4SBryan Drewery.endif
69b6209a9bSSimon J. Gerraty
70b6209a9bSSimon J. Gerraty.for t in ${_TARGETS:Nlove}
71b6209a9bSSimon J. Gerraty.if !target($t)
72b6209a9bSSimon J. Gerraty$t: not-valid-target show-help
73b6209a9bSSimon J. Gerraty.endif
74b6209a9bSSimon J. Gerraty.endfor
75