new verbose/trace script for make
[openwrt/openwrt.git] / openwrt / include / verbose.mk
1 # OpenWrt.org 2006
2 # $Id:$
3
4 ifeq ($(DUMP),)
5 ifndef KBUILD_VERBOSE
6 KBUILD_VERBOSE=0
7 ifeq ("$(origin V)", "command line")
8 KBUILD_VERBOSE=$(V)
9 endif
10 endif
11
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 MAKE:=3>&1 4>&2 $(MAKE)
22 endif
23
24 .SILENT: $(MAKECMDGOALS)
25 endif