debug.mk 754 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #
  2. # Copyright (C) 2007 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. # debug flags:
  8. #
  9. # d: show subdirectory tree
  10. # t: show added targets
  11. # l: show legacy targets
  12. # r: show autorebuild messages
  13. # v: verbose (no .SILENCE for common targets)
  14. ifeq ($(DUMP),)
  15. ifeq ($(DEBUG),all)
  16. build_debug:=dltvr
  17. else
  18. build_debug:=$(DEBUG)
  19. endif
  20. endif
  21. define debug
  22. $$(findstring $(2),$$(if $$(DEBUG_DIR),$$(if $$(filter $$(DEBUG_DIR)%,$(1)),$(build_debug)),$(build_debug)))
  23. endef
  24. define warn
  25. $$(if $(call debug,$(1),$(2)),$$(warning $(3)))
  26. endef
  27. define debug_eval
  28. $$(if $(call debug,$(1),$(2)),$(3))
  29. endef
  30. define warn_eval
  31. $(call warn,$(1),$(2),$(3) $(4))
  32. $(4)
  33. endef