blob: 98a1d6e889b820a98fd8d58b3d4a3f42ed6ea999 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001# 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
13ifeq ($(DUMP),)
14 ifeq ($(DEBUG),all)
15 build_debug:=dltvr
16 else
17 build_debug:=$(DEBUG)
18 endif
19endif
20
21ifneq ($(DEBUG),)
22
23define debug
24$$(findstring $(2),$$(if $$(DEBUG_SCOPE_DIR),$$(if $$(filter $$(DEBUG_SCOPE_DIR)%,$(1)),$(build_debug)),$(build_debug)))
25endef
26
27define warn
28$$(if $(call debug,$(1),$(2)),$$(warning $(3)))
29endef
30
31define debug_eval
32$$(if $(call debug,$(1),$(2)),$(3))
33endef
34
35define warn_eval
36$(call warn,$(1),$(2),$(3) $(4))
37$(4)
38endef
39
40else
41
42debug:=
43warn:=
44debug_eval:=
45warn_eval = $(4)
46
47endif
48