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