next round of build system cleanup - convert package/ to new structure
[openwrt.org/openwrt.git] / include / verbose.mk
mbm 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 #
mbm 7 # $Id:$
8
nbd 9 ifeq ($(NO_TRACE_MAKE),)
10 NO_TRACE_MAKE := $(MAKE) V=99
nbd 11 SUBMAKE := $(MAKE)
nbd 12 export NO_TRACE_MAKE
nbd 13 export SUBMAKE
nbd 14 endif
nbd 15
mbm 16 ifndef KBUILD_VERBOSE
nbd 17 KBUILD_VERBOSE:=0
18 endif
19 ifeq ("$(origin V)", "command line")
20 KBUILD_VERBOSE:=$(V)
mbm 21 endif
22
nbd 23 ifeq ($(IS_TTY),1)
mbm 24 _Y:="\\033[33m" # yellow
25 _N:="\\033[m" #normal
mbm 26 endif
27
mbm 28 define MESSAGE
nbd 29 /bin/echo -e "$(_Y)$(1)$(_N)" >&3
mbm 30 endef
31
mbm 32 ifneq ($(KBUILD_VERBOSE),99)
mbm 33 ifeq ($(QUIET),1)
nbd 34 ifneq ($(CURDIR),$(TOPDIR))
35 _DIR:=$(patsubst $(TOPDIR)/%,%,${CURDIR})
36 else
37 _DIR:=
38 endif
39 _NULL:=$(if $(MAKECMDGOALS),$(shell \
40 $(call MESSAGE, "make[$(MAKELEVEL)]$(if $(_DIR), -C $(_DIR)) $(MAKECMDGOALS)"); \
41 ))
mbm 42 else
mbm 43 ifeq ($(KBUILD_VERBOSE),0)
44 MAKE:=&>/dev/null $(MAKE)
45 endif
nbd 46 export QUIET:=1
nbd 47 MAKE:=cmd() { $(MAKE) -s $$* || { echo "make $$*: build failed. Please re-run make with V=99 to see what's going on"; false; } } 3>&1 4>&2; cmd
mbm 48 endif
49
50 .SILENT: $(MAKECMDGOALS)
51 endif
52
comments