1
0

debug.mk 771 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # SPDX-License-Identifier: GPL-2.0-only
  2. #
  3. # Copyright (C) 2007-2020 OpenWrt.org
  4. # debug flags:
  5. #
  6. # d: show subdirectory tree
  7. # t: show added targets
  8. # l: show legacy targets
  9. # r: show autorebuild messages
  10. # v: verbose (no .SILENCE for common targets)
  11. ifeq ($(DUMP),)
  12. ifeq ($(DEBUG),all)
  13. build_debug:=dltvr
  14. else
  15. build_debug:=$(DEBUG)
  16. endif
  17. endif
  18. ifneq ($(DEBUG),)
  19. define debug
  20. $$(findstring $(2),$$(if $$(DEBUG_SCOPE_DIR),$$(if $$(filter $$(DEBUG_SCOPE_DIR)%,$(1)),$(build_debug)),$(build_debug)))
  21. endef
  22. define warn
  23. $$(if $(call debug,$(1),$(2)),$$(warning $(3)))
  24. endef
  25. define debug_eval
  26. $$(if $(call debug,$(1),$(2)),$(3))
  27. endef
  28. define warn_eval
  29. $(call warn,$(1),$(2),$(3) $(4))
  30. $(4)
  31. endef
  32. else
  33. debug:=
  34. warn:=
  35. debug_eval:=
  36. warn_eval = $(4)
  37. endif