prevent verbose script from corrupting .pkginfo
[openwrt-10.03/.git] / include / verbose.mk
1 # OpenWrt.org 2006
2 # $Id:$
3
4 ifndef KBUILD_VERBOSE
5   KBUILD_VERBOSE=0
6   ifeq ("$(origin V)", "command line")
7     KBUILD_VERBOSE=$(V)
8   endif
9 endif
10
11 ifneq ($(KBUILD_VERBOSE),99)
12   ifeq ($(QUIET),1)
13     $(MAKECMDGOALS): trace
14     trace: FORCE
15         @[ -f "$(MAKECMDGOALS)" ] || { \
16                 [ -z "$${PWD##$$TOPDIR}" ] || DIR=" -C $${PWD##$$TOPDIR/}"; \
17                 echo -e "\33[33mmake[$$(($(MAKELEVEL)+1))]$$DIR $(MAKECMDGOALS)\33[m" >&3; \
18         }
19   else
20     export QUIET:=1
21     NO_TRACE_MAKE:=$(MAKE) V=99
22     ifeq ($(KBUILD_VERBOSE),0)
23       MAKE:=&>/dev/null $(MAKE)
24     endif
25     MAKE:=3>&1 4>&2 $(MAKE)
26   endif
27
28   .SILENT: $(MAKECMDGOALS)
29 endif