minor changes
[openwrt-10.03/.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 # $Id:$
8
9 ifndef KBUILD_VERBOSE
10   KBUILD_VERBOSE=0
11   ifeq ("$(origin V)", "command line")
12     KBUILD_VERBOSE=$(V)
13   endif
14 endif
15
16 ifneq ($(KBUILD_VERBOSE),99)
17   ifeq ($(QUIET),1)
18     $(MAKECMDGOALS): trace
19     trace: FORCE
20         @[ -f "$(MAKECMDGOALS)" ] || { \
21                 [ -z "$${PWD##$$TOPDIR}" ] || DIR=" -C $${PWD##$$TOPDIR/}"; \
22                 echo -e "\33[33mmake[$$(($(MAKELEVEL)+1))]$$DIR $(MAKECMDGOALS)\33[m" >&3; \
23         }
24   else
25     export QUIET:=1
26     NO_TRACE_MAKE:=$(MAKE) V=99
27     ifeq ($(KBUILD_VERBOSE),0)
28       MAKE:=&>/dev/null $(MAKE)
29     endif
30     MAKE:=cmd() { $(MAKE) $$* || {  echo "Build failed. Please re-run make with V=99 to see what's going on"; /bin/false; } } 3>&1 4>&2; cmd
31   endif
32
33   .SILENT: $(MAKECMDGOALS)
34 endif