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 | |
8 | ifndef OPENWRT_VERBOSE |
9 | OPENWRT_VERBOSE:= |
10 | endif |
11 | ifeq ("$(origin V)", "command line") |
12 | OPENWRT_VERBOSE:=$(V) |
13 | endif |
14 | |
15 | ifeq ($(OPENWRT_VERBOSE),1) |
16 | OPENWRT_VERBOSE:=w |
17 | endif |
18 | ifeq ($(OPENWRT_VERBOSE),99) |
19 | OPENWRT_VERBOSE:=s |
20 | endif |
21 | |
22 | ifeq ($(NO_TRACE_MAKE),) |
23 | NO_TRACE_MAKE := $(MAKE) V=s$(OPENWRT_VERBOSE) |
24 | export NO_TRACE_MAKE |
25 | endif |
26 | |
27 | ifeq ($(IS_TTY),1) |
28 | ifneq ($(strip $(NO_COLOR)),1) |
29 | _Y:=\\033[33m |
30 | _N:=\\033[m |
31 | endif |
32 | endif |
33 | |
34 | ifeq ($(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) |
56 | else |
57 | SUBMAKE=$(MAKE) -w |
58 | define MESSAGE |
59 | printf "%s\n" "$(1)" |
60 | endef |
61 | endif |
62 | |