Root/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
8ifndef OPENWRT_VERBOSE
9  OPENWRT_VERBOSE:=
10endif
11ifeq ("$(origin V)", "command line")
12  OPENWRT_VERBOSE:=$(V)
13endif
14
15ifeq ($(OPENWRT_VERBOSE),1)
16  OPENWRT_VERBOSE:=w
17endif
18ifeq ($(OPENWRT_VERBOSE),99)
19  OPENWRT_VERBOSE:=s
20endif
21
22ifeq ($(NO_TRACE_MAKE),)
23NO_TRACE_MAKE := $(MAKE) V=s$(OPENWRT_VERBOSE)
24export NO_TRACE_MAKE
25endif
26
27ifeq ($(IS_TTY),1)
28  ifneq ($(strip $(NO_COLOR)),1)
29    _Y:=\\033[33m
30    _N:=\\033[m
31  endif
32endif
33
34ifeq ($(findstring s,$(OPENWRT_VERBOSE)),)
35  define MESSAGE
36    printf "$(_Y)%s$(_N)\n" "$(1)" >&8
37  endef
38
39  ifeq ($(QUIET),1)
40    ifneq ($(CURDIR),$(TOPDIR))
41      _DIR:=$(patsubst $(TOPDIR)/%,%,${CURDIR})
42    else
43      _DIR:=
44    endif
45    _NULL:=$(if $(MAKECMDGOALS),$(shell \
46        $(call MESSAGE, make[$(MAKELEVEL)]$(if $(_DIR), -C $(_DIR)) $(MAKECMDGOALS)); \
47    ))
48    SUBMAKE=$(MAKE)
49  else
50    SILENT:=>/dev/null $(if $(findstring w,$(OPENWRT_VERBOSE)),,2>&1)
51    export QUIET:=1
52    SUBMAKE=cmd() { $(SILENT) $(MAKE) -s $$* < /dev/null || { echo "make $$*: build failed. Please re-run make with V=s to see what's going on"; false; } } 8>&1 9>&2; cmd
53  endif
54
55  .SILENT: $(MAKECMDGOALS)
56else
57  SUBMAKE=$(MAKE) -w
58  define MESSAGE
59    printf "%s\n" "$(1)"
60  endef
61endif
62

Archive Download this file



interactive