ath79: update WA/XC devices UBNT_VERSION to 8.7.4
[openwrt/staging/wigyori.git] / include / debug.mk
1 # SPDX-License-Identifier: GPL-2.0-only
2 #
3 # Copyright (C) 2007-2020 OpenWrt.org
4
5 # debug flags:
6 #
7 # d: show subdirectory tree
8 # t: show added targets
9 # l: show legacy targets
10 # r: show autorebuild messages
11 # v: verbose (no .SILENCE for common targets)
12
13 ifeq ($(DUMP),)
14 ifeq ($(DEBUG),all)
15 build_debug:=dltvr
16 else
17 build_debug:=$(DEBUG)
18 endif
19 endif
20
21 ifneq ($(DEBUG),)
22
23 define debug
24 $$(findstring $(2),$$(if $$(DEBUG_SCOPE_DIR),$$(if $$(filter $$(DEBUG_SCOPE_DIR)%,$(1)),$(build_debug)),$(build_debug)))
25 endef
26
27 define warn
28 $$(if $(call debug,$(1),$(2)),$$(warning $(3)))
29 endef
30
31 define debug_eval
32 $$(if $(call debug,$(1),$(2)),$(3))
33 endef
34
35 define warn_eval
36 $(call warn,$(1),$(2),$(3) $(4))
37 $(4)
38 endef
39
40 else
41
42 debug:=
43 warn:=
44 debug_eval:=
45 warn_eval = $(4)
46
47 endif
48