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 52*fb0ae187SYuri Dario# env variables names are uppercase only 53*fb0ae187SYuri Darioifeq ($(OS),OS2) 54*fb0ae187SYuri Dariogb_COLOR = $(GB_COLOR) 55*fb0ae187SYuri Dariogb_TITLES = $(GB_TITLES) 56*fb0ae187SYuri Darioendif 57*fb0ae187SYuri Dario 58*fb0ae187SYuri Dario# disable for OS/2 59*fb0ae187SYuri Darioifneq ($(OS),OS2) 60*fb0ae187SYuri Dariogb_Output_ESCAPE := $(shell echo|$(gb_AWK) 'BEGIN { printf "%c", 27 }' -) 61*fb0ae187SYuri Dariogb_Output_BELL := $(shell echo|$(gb_AWK) 'BEGIN { printf "%c", 7 }' -) 62*fb0ae187SYuri Darioendif 63*fb0ae187SYuri Dario 64cdf0e10cSrcweir 65cdf0e10cSrcweir# only enable colorized output if 66cdf0e10cSrcweir# - gb_COLOR is set 67cdf0e10cSrcweir# - we have a known term 68cdf0e10cSrcweirifneq ($(strip $(gb_COLOR)),) 69b63233d8Sdamjanifneq ($(filter $(TERM),Eterm aterm gnome kterm linux rxvt rxvt-unicode screen xterm xterm-color xtermc),) 70cdf0e10cSrcweir 71cdf0e10cSrcweirgb_Output_COLOR_RESET := $(gb_Output_ESCAPE)[0m 72cdf0e10cSrcweirgb_Output_COLOR_RESETANDESCAPE := $(gb_Output_COLOR_RESET)$(gb_Output_ESCAPE) 73cdf0e10cSrcweir 74cdf0e10cSrcweirgb_Output_COLOR_OUTBUILD_LEVEL1 := $(gb_Output_COLOR_RESETANDESCAPE)[37;40m 75cdf0e10cSrcweirgb_Output_COLOR_OUTBUILD_LEVEL2 := $(gb_Output_COLOR_RESETANDESCAPE)[37;40m 76cdf0e10cSrcweirgb_Output_COLOR_OUTBUILD_LEVEL3 := $(gb_Output_COLOR_RESETANDESCAPE)[37;40m 77cdf0e10cSrcweirgb_Output_COLOR_OUTBUILD_LEVEL4 := $(gb_Output_COLOR_RESETANDESCAPE)[37;40m 78cdf0e10cSrcweirgb_Output_COLOR_OUTBUILD_LEVEL5 := $(gb_Output_COLOR_RESETANDESCAPE)[37;1;46m 79cdf0e10cSrcweirgb_Output_COLOR_OUTBUILD_LEVEL6 := $(gb_Output_COLOR_RESETANDESCAPE)[37;1;44m 80cdf0e10cSrcweir 81cdf0e10cSrcweirgb_Output_COLOR_INBUILD_LEVEL1 := $(gb_Output_COLOR_RESETANDESCAPE)[36;40m 82cdf0e10cSrcweirgb_Output_COLOR_INBUILD_LEVEL2 := $(gb_Output_COLOR_RESETANDESCAPE)[36;1;40m 83cdf0e10cSrcweirgb_Output_COLOR_INBUILD_LEVEL3 := $(gb_Output_COLOR_RESETANDESCAPE)[32;40m 84cdf0e10cSrcweirgb_Output_COLOR_INBUILD_LEVEL4 := $(gb_Output_COLOR_RESETANDESCAPE)[32;1;40m 85cdf0e10cSrcweirgb_Output_COLOR_INBUILD_LEVEL5 := $(gb_Output_COLOR_RESETANDESCAPE)[37;1;46m 86cdf0e10cSrcweirgb_Output_COLOR_INBUILD_LEVEL6 := $(gb_Output_COLOR_RESETANDESCAPE)[37;1;44m 87cdf0e10cSrcweir 88cdf0e10cSrcweirgb_Output_COLOR_OUTCLEAN_LEVEL1 := $(gb_Output_COLOR_RESETANDESCAPE)[37;40m 89cdf0e10cSrcweirgb_Output_COLOR_OUTCLEAN_LEVEL2 := $(gb_Output_COLOR_RESETANDESCAPE)[37;40m 90cdf0e10cSrcweirgb_Output_COLOR_OUTCLEAN_LEVEL3 := $(gb_Output_COLOR_RESETANDESCAPE)[37;40m 91cdf0e10cSrcweirgb_Output_COLOR_OUTCLEAN_LEVEL4 := $(gb_Output_COLOR_RESETANDESCAPE)[37;40m 92cdf0e10cSrcweirgb_Output_COLOR_OUTCLEAN_LEVEL5 := $(gb_Output_COLOR_RESETANDESCAPE)[33;1;41m 93cdf0e10cSrcweirgb_Output_COLOR_OUTCLEAN_LEVEL6 := $(gb_Output_COLOR_RESETANDESCAPE)[37;1;41m 94cdf0e10cSrcweir 95cdf0e10cSrcweirgb_Output_COLOR_INCLEAN_LEVEL1 := $(gb_Output_COLOR_RESETANDESCAPE)[33;40m 96cdf0e10cSrcweirgb_Output_COLOR_INCLEAN_LEVEL2 := $(gb_Output_COLOR_RESETANDESCAPE)[33;1;40m 97cdf0e10cSrcweirgb_Output_COLOR_INCLEAN_LEVEL3 := $(gb_Output_COLOR_RESETANDESCAPE)[31;40m 98cdf0e10cSrcweirgb_Output_COLOR_INCLEAN_LEVEL4 := $(gb_Output_COLOR_RESETANDESCAPE)[31;1;40m 99cdf0e10cSrcweirgb_Output_COLOR_INCLEAN_LEVEL5 := $(gb_Output_COLOR_RESETANDESCAPE)[33;1;41m 100cdf0e10cSrcweirgb_Output_COLOR_INCLEAN_LEVEL6 := $(gb_Output_COLOR_RESETANDESCAPE)[37;1;41m 101cdf0e10cSrcweir 102cdf0e10cSrcweirgb_Output_COLOR_ERROR := $(gb_Output_COLOR_RESETANDESCAPE)[37;1;41m 103cdf0e10cSrcweir 104cdf0e10cSrcweirdefine gb_Output__format_type 105cdf0e10cSrcweir$(subst :, ,$(word 2,$(1) \ 106cdf0e10cSrcweir $(gb_Output_COLOR_OUTBUILD_LEVEL$(3))[:$(gb_Output_COLOR_INBUILD_LEVEL$(3))build:$(subst $(WHITESPACE),:,$(2))$(gb_Output_COLOR_OUTBUILD_LEVEL$(3)):] \ 107cdf0e10cSrcweir $(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) 108cdf0e10cSrcweirendef 109cdf0e10cSrcweir 110cdf0e10cSrcweirdefine gb_Output_info 111cdf0e10cSrcweir$(info $(gb_Output_COLOR_OUTBUILD_LEVEL6)[ $(gb_Output_COLOR_INBUILD_LEVEL6)info $(2)$(gb_Output_COLOR_OUTBUILD_LEVEL6) ]$(gb_Output_COLOR_RESET) $(1)) 112cdf0e10cSrcweirendef 113cdf0e10cSrcweir 114cdf0e10cSrcweirdefine gb_Output_warn 115cdf0e10cSrcweir$(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) !!!) 116cdf0e10cSrcweirendef 117cdf0e10cSrcweir 118cdf0e10cSrcweirdefine gb_Output_error 119cdf0e10cSrcweir$(error $(gb_Output_COLOR_ERROR)$(1)$(gb_Output_COLOR_RESET)) 120cdf0e10cSrcweirendef 121cdf0e10cSrcweir 122cdf0e10cSrcweirendif 123cdf0e10cSrcweirendif 124cdf0e10cSrcweir 125cdf0e10cSrcweir# only enable title output if 126cdf0e10cSrcweir# - gb_TITLES is set 127cdf0e10cSrcweir# - we have a known term 128cdf0e10cSrcweirifneq ($(strip $(gb_TITLES)),) 129cdf0e10cSrcweirifneq ($(filter $(TERM),Eterm aterm gnome kterm rxvt rxvt-unicode screen xterm xterm-color),) 130cdf0e10cSrcweirdefine gb_Output_announce_title 131cdf0e10cSrcweir$(info $(gb_Output_ESCAPE)]2;gbuild: $(1)$(gb_Output_BELL)$(gb_Output_ESCAPE)[A) 132cdf0e10cSrcweirendef 133cdf0e10cSrcweir 134cdf0e10cSrcweir$(call gb_Output_announce_title,...) 135cdf0e10cSrcweir 136cdf0e10cSrcweirendif 137cdf0e10cSrcweirendif 138cdf0e10cSrcweir 139cdf0e10cSrcweir# only enable bell output if 140cdf0e10cSrcweir# - gb_BELL is set 141cdf0e10cSrcweir# - gb_TTY is true (not piping to a file) 142cdf0e10cSrcweirifneq ($(strip $(gb_BELL)),) 143cdf0e10cSrcweirdefine gb_Output_announce_bell 144cdf0e10cSrcweir$(info $(gb_Output_BELL)$(gb_Output_ESCAPE)[A) 145cdf0e10cSrcweirendef 146cdf0e10cSrcweirendif 147cdf0e10cSrcweir 148cdf0e10cSrcweirdefine gb_Output_announce 149cdf0e10cSrcweir$(info $(call gb_Output__format_type,$(2),$(3),$(4)) $(call gb_Output__format_target,$(1))) 150cdf0e10cSrcweirendef 151cdf0e10cSrcweir 152cdf0e10cSrcweir 153cdf0e10cSrcweir# vim: set noet sw=4 ts=4: 154