make sure that processed directories are printed on make V=99
[openwrt/staging/yousong.git] / include / verbose.mk
1 #
2 # Copyright (C) 2006 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 ifeq ($(NO_TRACE_MAKE),)
9 NO_TRACE_MAKE := $(MAKE) V=99
10 export NO_TRACE_MAKE
11 endif
12
13 ifndef KBUILD_VERBOSE
14 KBUILD_VERBOSE:=0
15 endif
16 ifeq ("$(origin V)", "command line")
17 KBUILD_VERBOSE:=$(V)
18 endif
19
20 ifeq ($(IS_TTY),1)
21 _Y:=\\033[33m
22 _N:=\\033[m
23 endif
24
25 ifneq ($(KBUILD_VERBOSE),99)
26 define MESSAGE
27 printf "$(_Y)%s$(_N)\n" "$(1)" >&8
28 endef
29
30 ifeq ($(QUIET),1)
31 ifneq ($(CURDIR),$(TOPDIR))
32 _DIR:=$(patsubst $(TOPDIR)/%,%,${CURDIR})
33 else
34 _DIR:=
35 endif
36 _NULL:=$(if $(MAKECMDGOALS),$(shell \
37 $(call MESSAGE, make[$(MAKELEVEL)]$(if $(_DIR), -C $(_DIR)) $(MAKECMDGOALS)); \
38 ))
39 SUBMAKE=$(MAKE)
40 else
41 ifeq ($(KBUILD_VERBOSE),0)
42 SILENT:=>/dev/null 2>&1
43 else
44 SILENT:=
45 endif
46 export QUIET:=1
47 SUBMAKE=cmd() { $(SILENT) $(MAKE) -s $$* || { echo "make $$*: build failed. Please re-run make with V=99 to see what's going on"; false; } } 8>&1 9>&2; cmd
48 endif
49
50 .SILENT: $(MAKECMDGOALS)
51 else
52 SUBMAKE=$(MAKE) -w
53 define MESSAGE
54 printf "%s\n" "$(1)"
55 endef
56 endif