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