build: move the SH_FUNC eval to the beginning of the opkg control file build command...
[openwrt/openwrt.git] / 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
16 ifeq ($(DUMP),)
17 ifeq ($(DEBUG),all)
18 build_debug:=dltvr
19 else
20 build_debug:=$(DEBUG)
21 endif
22 endif
23
24 define debug
25 $$(findstring $(2),$$(if $$(DEBUG_SCOPE_DIR),$$(if $$(filter $$(DEBUG_SCOPE_DIR)%,$(1)),$(build_debug)),$(build_debug)))
26 endef
27
28 define warn
29 $$(if $(call debug,$(1),$(2)),$$(warning $(3)))
30 endef
31
32 define debug_eval
33 $$(if $(call debug,$(1),$(2)),$(3))
34 endef
35
36 define warn_eval
37 $(call warn,$(1),$(2),$(3) $(4))
38 $(4)
39 endef
40
41