X-Git-Url: https://git.archive.openwrt.org/?a=blobdiff_plain;f=include%2Fverbose.mk;h=4abdf8d661fa6f137111992348999d2e6e0a3d2f;hb=e6004d6b089f8a7ce5055f11283cf51678fb1758;hp=be7d5f76bdd8cb911a9815f61951a183cb955d68;hpb=b09cd08eaff61c7f1cfb33806e8c0fd1c41a3739;p=openwrt.git diff --git a/include/verbose.mk b/include/verbose.mk index be7d5f76bd..4abdf8d661 100644 --- a/include/verbose.mk +++ b/include/verbose.mk @@ -6,29 +6,45 @@ # # $Id:$ -NO_TRACE_MAKE:=$(MAKE) V=99 +ifeq ($(NO_TRACE_MAKE),) +NO_TRACE_MAKE := $(MAKE) V=99 +SUBMAKE := $(MAKE) +export NO_TRACE_MAKE +export SUBMAKE +endif ifndef KBUILD_VERBOSE - KBUILD_VERBOSE=0 - ifeq ("$(origin V)", "command line") - KBUILD_VERBOSE=$(V) - endif + KBUILD_VERBOSE:=0 +endif +ifeq ("$(origin V)", "command line") + KBUILD_VERBOSE:=$(V) +endif + +ifeq ($(IS_TTY),1) + _Y:="\\033[33m" # yellow + _N:="\\033[m" #normal endif +define MESSAGE + /bin/echo -e "$(_Y)$(1)$(_N)" >&3 +endef + ifneq ($(KBUILD_VERBOSE),99) ifeq ($(QUIET),1) - $(MAKECMDGOALS): trace - trace: FORCE - @[ -f "$(MAKECMDGOALS)" ] || { \ - [ -z "$${PWD##$$TOPDIR}" ] || DIR=" -C $${PWD##$$TOPDIR/}"; \ - echo -e "\33[33mmake[$$(($(MAKELEVEL)+1))]$$DIR $(MAKECMDGOALS)\33[m" >&3; \ - } + ifneq ($(CURDIR),$(TOPDIR)) + _DIR:=$(patsubst $(TOPDIR)/%,%,${CURDIR}) + else + _DIR:= + endif + _NULL:=$(if $(MAKECMDGOALS),$(shell \ + $(call MESSAGE, "make[$(MAKELEVEL)]$(if $(_DIR), -C $(_DIR)) $(MAKECMDGOALS)"); \ + )) else - export QUIET:=1 ifeq ($(KBUILD_VERBOSE),0) MAKE:=&>/dev/null $(MAKE) endif - 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 + export QUIET:=1 + 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 endif .SILENT: $(MAKECMDGOALS)