]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - targets/Makefile.xtras
Merge OpenSSL 3.0.9
[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_${MACHINE:tu} != cd ${_here} && \
37         find . \( ${${.MAKE.DEPENDFILE:T} ${.MAKE.DEPENDFILE_PREFIX}:L:O:u:@m@-name $m -o@:tW:S,-o$,,} \) | \
38         sed 's,/Makefile.*,,;s,^./,,' | sort -u
39
40 .for _machine in ${ALL_MACHINE_LIST}
41 _targets_${_machine} != cd ${_here} && \
42         find . \( ${.MAKE.DEPENDFILE_PREFERENCE:T:M*${MACHINE}*:S,${MACHINE},${_machine},g:O:u:@m@-name $m -o@:tW:S,-o$,,} \) | \
43         sed 's,/Makefile.*,,;s,^./,,' | sort -u
44 BUILD_TARGETS_${_machine:tu} += ${_targets_${_machine}}
45 .endfor
46
47 show-valid-targets:
48 .for _machine in ${ALL_MACHINE_LIST:O}
49 .if !empty(BUILD_TARGETS_${_machine:tu})
50         @echo "Build targets for ${_machine} (leave out the ${DIRDEPS_TARGETS_DIRS:S,${_here:T},,:S,^/,,:S,$,/,}):"
51         @echo -e "${BUILD_TARGETS_${_machine:tu}:O:ts\n}" | sed -e 's,^,  ,'
52         @echo
53 .endif
54 .endfor
55         @echo "Other targets:"; echo "${OTHER_TARGETS:O:ts\n}" | sed -e 's,^,  ,'
56 .endif
57
58 help: show-help
59 show-help:
60         @echo; \
61         echo "You can see the targets which are valid for a given machine"; \
62         echo "by running '${MAKE_MACHINE_CMD} show-valid-targets'"; \
63         echo "For other information, read: ${HELP_DOCS:@d@${.newline}$d@}"; \
64         echo
65
66 not-valid-target:
67         @echo "ERROR: '${_TARGETS}' is not a valid target for ${MACHINE}."
68
69 .if make(destroy*)
70 .include <bsd.obj.mk>
71 .endif
72
73 .for t in ${_TARGETS:Nlove}
74 .if !target($t)
75 $t: not-valid-target show-help
76 .endif
77 .endfor