Root/include/debug.mk

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
8# debug flags:
9#
10# d: show subdirectory tree
11# t: show added targets
12# l: show legacy targets
13# r: show autorebuild messages
14# v: verbose (no .SILENCE for common targets)
15
16ifeq ($(DUMP),)
17  ifeq ($(DEBUG),all)
18    build_debug:=dltvr
19  else
20    build_debug:=$(DEBUG)
21  endif
22endif
23
24ifneq ($(DEBUG),)
25
26define debug
27$$(findstring $(2),$$(if $$(DEBUG_SCOPE_DIR),$$(if $$(filter $$(DEBUG_SCOPE_DIR)%,$(1)),$(build_debug)),$(build_debug)))
28endef
29
30define warn
31$$(if $(call debug,$(1),$(2)),$$(warning $(3)))
32endef
33
34define debug_eval
35$$(if $(call debug,$(1),$(2)),$(3))
36endef
37
38define warn_eval
39$(call warn,$(1),$(2),$(3) $(4))
40$(4)
41endef
42
43else
44
45debug:=
46warn:=
47debug_eval:=
48warn_eval = $(4)
49
50endif
51
52

Archive Download this file



interactive