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