You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
1.9KB

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