kernel: update ssb and bcma to linux-next next-20110627
[openwrt/svn-archive/archive.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 ifneq ($(strip $(NO_COLOR)),1)
22 _Y:=\\033[33m
23 _N:=\\033[m
24 endif
25 endif
26
27 ifneq ($(KBUILD_VERBOSE),99)
28 define MESSAGE
29 printf "$(_Y)%s$(_N)\n" "$(1)" >&8
30 endef
31
32 ifeq ($(QUIET),1)
33 ifneq ($(CURDIR),$(TOPDIR))
34 _DIR:=$(patsubst $(TOPDIR)/%,%,${CURDIR})
35 else
36 _DIR:=
37 endif
38 _NULL:=$(if $(MAKECMDGOALS),$(shell \
39 $(call MESSAGE, make[$(MAKELEVEL)]$(if $(_DIR), -C $(_DIR)) $(MAKECMDGOALS)); \
40 ))
41 SUBMAKE=$(MAKE)
42 else
43 ifeq ($(KBUILD_VERBOSE),0)
44 SILENT:=>/dev/null 2>&1
45 else
46 SILENT:=
47 endif
48 export QUIET:=1
49 SUBMAKE=cmd() { $(SILENT) $(MAKE) -s $$* < /dev/null || { echo "make $$*: build failed. Please re-run make with V=99 to see what's going on"; false; } } 8>&1 9>&2; cmd
50 endif
51
52 .SILENT: $(MAKECMDGOALS)
53 else
54 SUBMAKE=$(MAKE) -w
55 define MESSAGE
56 printf "%s\n" "$(1)"
57 endef
58 endif