]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - targets/Makefile.xtras
DIRDEPS_BUILD: Allow destroy-(arch|host|stage) from top-level.
[FreeBSD/FreeBSD.git] / targets / Makefile.xtras
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
16 MAKE_CMD= mk
17 MAKE_MACHINE_CMD= mk --machine <machine>
18 .else
19 # not using 'mk'
20 MAKE_CMD= ${.MAKE:T}
21 MAKE_MACHINE_CMD= env MACHINE=<machine> ${.MAKE:T}
22 .endif
23
24 no-default:
25         @echo "ERROR: there is no supported default target."; \
26         echo "Try '${MAKE_CMD} help'"
27
28
29 .if make(show-valid-targets)
30 OTHER_TARGETS = \
31         destroy \
32         destroy-arch \
33         destroy-host \
34         destroy-stage \
35
36 BUILD_TARGETS != cd ${_here} && \
37         find . \( -name Makefile.depend -o -name ${.MAKE.DEPENDFILE:T} \) | \
38         sed 's,/Makefile.*,,;s,^./,,' | sort -u
39
40 show-valid-targets:
41         @echo "Build targets for ${MACHINE} (leave out the ${target_dirs:S,${_here:T},,:S,^/,,:S,$,/,}):"
42         @echo "${BUILD_TARGETS:ts\n}"
43         @echo; echo "Other targets:"; echo "${OTHER_TARGETS:ts\n}"
44 .endif
45
46 help: show-help
47 show-help:
48         @echo; \
49         echo "You can see the targets which are valid for a given machine"; \
50         echo "by running '${MAKE_MACHINE_CMD} show-valid-targets'"; \
51         echo "For other information, read: ${HELP_DOCS:@d@${.newline}$d@}"; \
52         echo
53
54 not-valid-target:
55         @echo "ERROR: '${_TARGETS}' is not a valid target for ${MACHINE}."
56
57 .include <bsd.obj.mk>
58
59 .for t in ${_TARGETS:Nlove}
60 .if !target($t)
61 $t: not-valid-target show-help
62 .endif
63 .endfor