xref: /trunk/main/solenv/gbuild/Output.mk (revision b63233d8)
17871dc3eSAndrew Rist#**************************************************************
27871dc3eSAndrew Rist#
37871dc3eSAndrew Rist#  Licensed to the Apache Software Foundation (ASF) under one
47871dc3eSAndrew Rist#  or more contributor license agreements.  See the NOTICE file
57871dc3eSAndrew Rist#  distributed with this work for additional information
67871dc3eSAndrew Rist#  regarding copyright ownership.  The ASF licenses this file
77871dc3eSAndrew Rist#  to you under the Apache License, Version 2.0 (the
87871dc3eSAndrew Rist#  "License"); you may not use this file except in compliance
97871dc3eSAndrew Rist#  with the License.  You may obtain a copy of the License at
107871dc3eSAndrew Rist#
117871dc3eSAndrew Rist#    http://www.apache.org/licenses/LICENSE-2.0
127871dc3eSAndrew Rist#
137871dc3eSAndrew Rist#  Unless required by applicable law or agreed to in writing,
147871dc3eSAndrew Rist#  software distributed under the License is distributed on an
157871dc3eSAndrew Rist#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
167871dc3eSAndrew Rist#  KIND, either express or implied.  See the License for the
177871dc3eSAndrew Rist#  specific language governing permissions and limitations
187871dc3eSAndrew Rist#  under the License.
197871dc3eSAndrew Rist#
207871dc3eSAndrew Rist#**************************************************************
217871dc3eSAndrew Rist
227871dc3eSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir# user notifications and formatting
25cdf0e10cSrcweir
26cdf0e10cSrcweirdefine gb_Output__format_type
27cdf0e10cSrcweir[ $(word 2,$(1) build clean) $(2) ]
28cdf0e10cSrcweirendef
29cdf0e10cSrcweir
30cdf0e10cSrcweirdefine gb_Output__format_target
31cdf0e10cSrcweir$(1)
32cdf0e10cSrcweirendef
33cdf0e10cSrcweir
34cdf0e10cSrcweirdefine gb_Output_error
35cdf0e10cSrcweir$(error $(1))
36cdf0e10cSrcweirendef
37cdf0e10cSrcweir
38cdf0e10cSrcweirdefine gb_Output_announce_title
39cdf0e10cSrcweirendef
40cdf0e10cSrcweir
41cdf0e10cSrcweirdefine gb_Output_announce_bell
42cdf0e10cSrcweirendef
43cdf0e10cSrcweir
44cdf0e10cSrcweirdefine gb_Output_info
45cdf0e10cSrcweir$(info [ info  $(2) ] $(1))
46cdf0e10cSrcweirendef
47cdf0e10cSrcweir
48cdf0e10cSrcweirdefine gb_Output_warn
49cdf0e10cSrcweir$(warning $(NEWLINE)[ WARN  $(2) ] !!!$(NEWLINE)[ WARN  $(2) ] !!! $(1)$(NEWLINE)[ WARN  $(2) ] !!!)
50cdf0e10cSrcweirendef
51cdf0e10cSrcweir
52cdf0e10cSrcweirgb_Output_ESCAPE := $(shell echo|awk 'BEGIN { printf "%c", 27 }' -)
53cdf0e10cSrcweirgb_Output_BELL := $(shell echo|awk 'BEGIN { printf "%c", 7 }' -)
54cdf0e10cSrcweir
55cdf0e10cSrcweir# only enable colorized output if
56cdf0e10cSrcweir# - gb_COLOR is set
57cdf0e10cSrcweir# - we have a known term
58cdf0e10cSrcweirifneq ($(strip $(gb_COLOR)),)
59*b63233d8Sdamjanifneq ($(filter $(TERM),Eterm aterm gnome kterm linux rxvt rxvt-unicode screen xterm xterm-color xtermc),)
60cdf0e10cSrcweir
61cdf0e10cSrcweirgb_Output_COLOR_RESET := $(gb_Output_ESCAPE)[0m
62cdf0e10cSrcweirgb_Output_COLOR_RESETANDESCAPE := $(gb_Output_COLOR_RESET)$(gb_Output_ESCAPE)
63cdf0e10cSrcweir
64cdf0e10cSrcweirgb_Output_COLOR_OUTBUILD_LEVEL1 := $(gb_Output_COLOR_RESETANDESCAPE)[37;40m
65cdf0e10cSrcweirgb_Output_COLOR_OUTBUILD_LEVEL2 := $(gb_Output_COLOR_RESETANDESCAPE)[37;40m
66cdf0e10cSrcweirgb_Output_COLOR_OUTBUILD_LEVEL3 := $(gb_Output_COLOR_RESETANDESCAPE)[37;40m
67cdf0e10cSrcweirgb_Output_COLOR_OUTBUILD_LEVEL4 := $(gb_Output_COLOR_RESETANDESCAPE)[37;40m
68cdf0e10cSrcweirgb_Output_COLOR_OUTBUILD_LEVEL5 := $(gb_Output_COLOR_RESETANDESCAPE)[37;1;46m
69cdf0e10cSrcweirgb_Output_COLOR_OUTBUILD_LEVEL6 := $(gb_Output_COLOR_RESETANDESCAPE)[37;1;44m
70cdf0e10cSrcweir
71cdf0e10cSrcweirgb_Output_COLOR_INBUILD_LEVEL1 := $(gb_Output_COLOR_RESETANDESCAPE)[36;40m
72cdf0e10cSrcweirgb_Output_COLOR_INBUILD_LEVEL2 := $(gb_Output_COLOR_RESETANDESCAPE)[36;1;40m
73cdf0e10cSrcweirgb_Output_COLOR_INBUILD_LEVEL3 := $(gb_Output_COLOR_RESETANDESCAPE)[32;40m
74cdf0e10cSrcweirgb_Output_COLOR_INBUILD_LEVEL4 := $(gb_Output_COLOR_RESETANDESCAPE)[32;1;40m
75cdf0e10cSrcweirgb_Output_COLOR_INBUILD_LEVEL5 := $(gb_Output_COLOR_RESETANDESCAPE)[37;1;46m
76cdf0e10cSrcweirgb_Output_COLOR_INBUILD_LEVEL6 := $(gb_Output_COLOR_RESETANDESCAPE)[37;1;44m
77cdf0e10cSrcweir
78cdf0e10cSrcweirgb_Output_COLOR_OUTCLEAN_LEVEL1 := $(gb_Output_COLOR_RESETANDESCAPE)[37;40m
79cdf0e10cSrcweirgb_Output_COLOR_OUTCLEAN_LEVEL2 := $(gb_Output_COLOR_RESETANDESCAPE)[37;40m
80cdf0e10cSrcweirgb_Output_COLOR_OUTCLEAN_LEVEL3 := $(gb_Output_COLOR_RESETANDESCAPE)[37;40m
81cdf0e10cSrcweirgb_Output_COLOR_OUTCLEAN_LEVEL4 := $(gb_Output_COLOR_RESETANDESCAPE)[37;40m
82cdf0e10cSrcweirgb_Output_COLOR_OUTCLEAN_LEVEL5 := $(gb_Output_COLOR_RESETANDESCAPE)[33;1;41m
83cdf0e10cSrcweirgb_Output_COLOR_OUTCLEAN_LEVEL6 := $(gb_Output_COLOR_RESETANDESCAPE)[37;1;41m
84cdf0e10cSrcweir
85cdf0e10cSrcweirgb_Output_COLOR_INCLEAN_LEVEL1 := $(gb_Output_COLOR_RESETANDESCAPE)[33;40m
86cdf0e10cSrcweirgb_Output_COLOR_INCLEAN_LEVEL2 := $(gb_Output_COLOR_RESETANDESCAPE)[33;1;40m
87cdf0e10cSrcweirgb_Output_COLOR_INCLEAN_LEVEL3 := $(gb_Output_COLOR_RESETANDESCAPE)[31;40m
88cdf0e10cSrcweirgb_Output_COLOR_INCLEAN_LEVEL4 := $(gb_Output_COLOR_RESETANDESCAPE)[31;1;40m
89cdf0e10cSrcweirgb_Output_COLOR_INCLEAN_LEVEL5 := $(gb_Output_COLOR_RESETANDESCAPE)[33;1;41m
90cdf0e10cSrcweirgb_Output_COLOR_INCLEAN_LEVEL6 := $(gb_Output_COLOR_RESETANDESCAPE)[37;1;41m
91cdf0e10cSrcweir
92cdf0e10cSrcweirgb_Output_COLOR_ERROR := $(gb_Output_COLOR_RESETANDESCAPE)[37;1;41m
93cdf0e10cSrcweir
94cdf0e10cSrcweirdefine gb_Output__format_type
95cdf0e10cSrcweir$(subst :, ,$(word 2,$(1) \
96cdf0e10cSrcweir	$(gb_Output_COLOR_OUTBUILD_LEVEL$(3))[:$(gb_Output_COLOR_INBUILD_LEVEL$(3))build:$(subst $(WHITESPACE),:,$(2))$(gb_Output_COLOR_OUTBUILD_LEVEL$(3)):] \
97cdf0e10cSrcweir	$(gb_Output_COLOR_OUTCLEAN_LEVEL$(3))[:$(gb_Output_COLOR_INCLEAN_LEVEL$(3))clean:$(subst $(WHITESPACE),:,$(2))$(gb_Output_COLOR_OUTCLEAN_LEVEL$(3)):]))$(gb_Output_COLOR_RESET)
98cdf0e10cSrcweirendef
99cdf0e10cSrcweir
100cdf0e10cSrcweirdefine gb_Output_info
101cdf0e10cSrcweir$(info $(gb_Output_COLOR_OUTBUILD_LEVEL6)[ $(gb_Output_COLOR_INBUILD_LEVEL6)info  $(2)$(gb_Output_COLOR_OUTBUILD_LEVEL6) ]$(gb_Output_COLOR_RESET) $(1))
102cdf0e10cSrcweirendef
103cdf0e10cSrcweir
104cdf0e10cSrcweirdefine gb_Output_warn
105cdf0e10cSrcweir$(warning $(NEWLINE)$(gb_Output_COLOR_OUTCLEAN_LEVEL6)[ $(gb_Output_COLOR_INCLEAN_LEVEL6)WARN  $(2)$(gb_Output_COLOR_OUTCLEAN_LEVEL6) ]$(gb_Output_COLOR_RESET) !!!$(NEWLINE)$(gb_Output_COLOR_OUTCLEAN_LEVEL6)[ $(gb_Output_COLOR_INCLEAN_LEVEL6)WARN  $(2)$(gb_Output_COLOR_OUTCLEAN_LEVEL6) ]$(gb_Output_COLOR_RESET) !!! $(1)$(NEWLINE)$(gb_Output_COLOR_OUTCLEAN_LEVEL6)[ $(gb_Output_COLOR_INCLEAN_LEVEL6)WARN  $(2)$(gb_Output_COLOR_OUTCLEAN_LEVEL6) ]$(gb_Output_COLOR_RESET) !!!)
106cdf0e10cSrcweirendef
107cdf0e10cSrcweir
108cdf0e10cSrcweirdefine gb_Output_error
109cdf0e10cSrcweir$(error $(gb_Output_COLOR_ERROR)$(1)$(gb_Output_COLOR_RESET))
110cdf0e10cSrcweirendef
111cdf0e10cSrcweir
112cdf0e10cSrcweirendif
113cdf0e10cSrcweirendif
114cdf0e10cSrcweir
115cdf0e10cSrcweir# only enable title output if
116cdf0e10cSrcweir# - gb_TITLES is set
117cdf0e10cSrcweir# - we have a known term
118cdf0e10cSrcweirifneq ($(strip $(gb_TITLES)),)
119cdf0e10cSrcweirifneq ($(filter $(TERM),Eterm aterm gnome kterm rxvt rxvt-unicode screen xterm xterm-color),)
120cdf0e10cSrcweirdefine gb_Output_announce_title
121cdf0e10cSrcweir$(info $(gb_Output_ESCAPE)]2;gbuild: $(1)$(gb_Output_BELL)$(gb_Output_ESCAPE)[A)
122cdf0e10cSrcweirendef
123cdf0e10cSrcweir
124cdf0e10cSrcweir$(call gb_Output_announce_title,...)
125cdf0e10cSrcweir
126cdf0e10cSrcweirendif
127cdf0e10cSrcweirendif
128cdf0e10cSrcweir
129cdf0e10cSrcweir# only enable bell output if
130cdf0e10cSrcweir# - gb_BELL is set
131cdf0e10cSrcweir# - gb_TTY is true (not piping to a file)
132cdf0e10cSrcweirifneq ($(strip $(gb_BELL)),)
133cdf0e10cSrcweirdefine gb_Output_announce_bell
134cdf0e10cSrcweir$(info $(gb_Output_BELL)$(gb_Output_ESCAPE)[A)
135cdf0e10cSrcweirendef
136cdf0e10cSrcweirendif
137cdf0e10cSrcweir
138cdf0e10cSrcweirdefine gb_Output_announce
139cdf0e10cSrcweir$(info $(call gb_Output__format_type,$(2),$(3),$(4)) $(call gb_Output__format_target,$(1)))
140cdf0e10cSrcweirendef
141cdf0e10cSrcweir
142cdf0e10cSrcweir
143cdf0e10cSrcweir# vim: set noet sw=4 ts=4:
144