accept V= from the environment as well
[openwrt/openwrt.git] / openwrt / 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 NO_TRACE_MAKE:=$(MAKE) V=99
10
11 ifndef KBUILD_VERBOSE
12 KBUILD_VERBOSE=$(V)
13 endif
14
15 ifneq ($(KBUILD_VERBOSE),99)
16 ifeq ($(QUIET),1)
17 $(MAKECMDGOALS): trace
18 trace: FORCE
19 @[ -f "$(MAKECMDGOALS)" ] || { \
20 [ -z "$${PWD##$$TOPDIR}" ] || DIR=" -C $${PWD##$$TOPDIR/}"; \
21 echo -e "\33[33mmake[$$(($(MAKELEVEL)+1))]$$DIR $(MAKECMDGOALS)\33[m" >&3; \
22 }
23 else
24 export QUIET:=1
25 ifeq ($(KBUILD_VERBOSE),0)
26 MAKE:=&>/dev/null $(MAKE)
27 endif
28 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
29 endif
30
31 .SILENT: $(MAKECMDGOALS)
32 else
33 NO_TRACE_MAKE:=$(MAKE)
34 endif