bump product version to 7.2.5.1
[LibreOffice.git] / solenv / gbuild / Output.mk
blob4fbefdea57a7f95a3f437ee34400ffc95439f5c4
1 # -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 # This file incorporates work covered by the following license notice:
11 # Licensed to the Apache Software Foundation (ASF) under one or more
12 # contributor license agreements. See the NOTICE file distributed
13 # with this work for additional information regarding copyright
14 # ownership. The ASF licenses this file to you under the Apache
15 # License, Version 2.0 (the "License"); you may not use this file
16 # except in compliance with the License. You may obtain a copy of
17 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 # user notifications and formatting
22 define gb_Output__format_type
23 [$(word 2,$(1) build clean) $(2)]
24 endef
26 define gb_Output__format_target
27 $(1)
28 endef
30 define gb_Output_error
31 $(error $(1))
32 endef
34 define gb_Output_announce_title
35 endef
37 define gb_Output_announce_bell
38 endef
40 define gb_Output_info
41 $(info [info $(2)] $(1))
42 endef
44 define gb_Output_warn
45 $(warning $(NEWLINE)[WARN $(2)] !!!$(NEWLINE)[WARN $(2)] !!! $(1)$(NEWLINE)[WARN $(2)] !!!)
46 endef
48 gb_Output_ESCAPE := $(shell echo|awk 'BEGIN { printf "%c", 27 }' -)
49 gb_Output_BELL := $(shell echo|awk 'BEGIN { printf "%c", 7 }' -)
51 # default to color output, if interactive
52 ifeq ($(origin gb_COLOR),undefined)
53 ifneq ($(MAKE_TERMOUT),)
54 # Cygwin mintty has issues where gb_Output_error is swallowed
55 ifneq ($(OS),WNT)
56 gb_COLOR=$(true)
57 endif
58 endif
59 endif
61 # only enable colorized output if
62 # - gb_COLOR is set
63 # - we have a known term
64 KNOWN_TERM:=Eterm aterm gnome kterm linux putty rxvt rxvt-unicode screen xterm xterm xtermc cygwin
65 KNOWN_TERM+=$(patsubst %,%-color,$(KNOWN_TERM))
66 KNOWN_TERM+=$(patsubst %-color,%-256color,$(KNOWN_TERM))
67 KNOWN_TERM+=$(patsubst %-color,%+256color,$(KNOWN_TERM))
68 KNOWN_TERM+=$(patsubst %,screen.%,$(KNOWN_TERM))
69 ifneq ($(strip $(gb_COLOR)),)
70 ifneq ($(filter $(TERM),$(KNOWN_TERM)),)
72 gb_Output_COLOR_RESET := $(gb_Output_ESCAPE)[0m
73 gb_Output_COLOR_RESETANDESCAPE := $(gb_Output_COLOR_RESET)$(gb_Output_ESCAPE)
75 gb_Output_COLOR_OUTBUILD_LEVEL1 := $(gb_Output_COLOR_RESETANDESCAPE)[37;40m
76 gb_Output_COLOR_OUTBUILD_LEVEL2 := $(gb_Output_COLOR_RESETANDESCAPE)[37;40m
77 gb_Output_COLOR_OUTBUILD_LEVEL3 := $(gb_Output_COLOR_RESETANDESCAPE)[37;40m
78 gb_Output_COLOR_OUTBUILD_LEVEL4 := $(gb_Output_COLOR_RESETANDESCAPE)[37;40m
79 gb_Output_COLOR_OUTBUILD_LEVEL5 := $(gb_Output_COLOR_RESETANDESCAPE)[37;1;46m
80 gb_Output_COLOR_OUTBUILD_LEVEL6 := $(gb_Output_COLOR_RESETANDESCAPE)[37;1;44m
82 gb_Output_COLOR_INBUILD_LEVEL1 := $(gb_Output_COLOR_RESETANDESCAPE)[36;40m
83 gb_Output_COLOR_INBUILD_LEVEL2 := $(gb_Output_COLOR_RESETANDESCAPE)[36;1;40m
84 gb_Output_COLOR_INBUILD_LEVEL3 := $(gb_Output_COLOR_RESETANDESCAPE)[32;40m
85 gb_Output_COLOR_INBUILD_LEVEL4 := $(gb_Output_COLOR_RESETANDESCAPE)[32;1;40m
86 gb_Output_COLOR_INBUILD_LEVEL5 := $(gb_Output_COLOR_RESETANDESCAPE)[37;1;46m
87 gb_Output_COLOR_INBUILD_LEVEL6 := $(gb_Output_COLOR_RESETANDESCAPE)[37;1;44m
89 gb_Output_COLOR_OUTCLEAN_LEVEL1 := $(gb_Output_COLOR_RESETANDESCAPE)[37;40m
90 gb_Output_COLOR_OUTCLEAN_LEVEL2 := $(gb_Output_COLOR_RESETANDESCAPE)[37;40m
91 gb_Output_COLOR_OUTCLEAN_LEVEL3 := $(gb_Output_COLOR_RESETANDESCAPE)[37;40m
92 gb_Output_COLOR_OUTCLEAN_LEVEL4 := $(gb_Output_COLOR_RESETANDESCAPE)[37;40m
93 gb_Output_COLOR_OUTCLEAN_LEVEL5 := $(gb_Output_COLOR_RESETANDESCAPE)[33;1;41m
94 gb_Output_COLOR_OUTCLEAN_LEVEL6 := $(gb_Output_COLOR_RESETANDESCAPE)[37;1;41m
96 gb_Output_COLOR_INCLEAN_LEVEL1 := $(gb_Output_COLOR_RESETANDESCAPE)[33;40m
97 gb_Output_COLOR_INCLEAN_LEVEL2 := $(gb_Output_COLOR_RESETANDESCAPE)[33;1;40m
98 gb_Output_COLOR_INCLEAN_LEVEL3 := $(gb_Output_COLOR_RESETANDESCAPE)[31;40m
99 gb_Output_COLOR_INCLEAN_LEVEL4 := $(gb_Output_COLOR_RESETANDESCAPE)[31;1;40m
100 gb_Output_COLOR_INCLEAN_LEVEL5 := $(gb_Output_COLOR_RESETANDESCAPE)[33;1;41m
101 gb_Output_COLOR_INCLEAN_LEVEL6 := $(gb_Output_COLOR_RESETANDESCAPE)[37;1;41m
103 gb_Output_COLOR_ERROR := $(gb_Output_COLOR_RESETANDESCAPE)[37;1;41m
105 define gb_Output__format_type
106 $(subst :, ,$(word 2,$(1) \
107 $(gb_Output_COLOR_OUTBUILD_LEVEL$(3))[$(gb_Output_COLOR_INBUILD_LEVEL$(3))$(subst $(WHITESPACE),:,$(2))$(gb_Output_COLOR_OUTBUILD_LEVEL$(3))] \
108 $(gb_Output_COLOR_OUTCLEAN_LEVEL$(3))[$(gb_Output_COLOR_INCLEAN_LEVEL$(3))$(subst $(WHITESPACE),:,$(2))$(gb_Output_COLOR_OUTCLEAN_LEVEL$(3))]))$(gb_Output_COLOR_RESET)
109 endef
111 define gb_Output_info
112 $(info $(gb_Output_COLOR_OUTBUILD_LEVEL6)[$(gb_Output_COLOR_INBUILD_LEVEL6)info $(2)$(gb_Output_COLOR_OUTBUILD_LEVEL6)]$(gb_Output_COLOR_RESET) $(1))
113 endef
115 define gb_Output_warn
116 $(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) !!!)
117 endef
119 define gb_Output_error
120 $(error $(gb_Output_COLOR_ERROR)$(1)$(gb_Output_COLOR_RESET))
121 endef
123 endif
124 endif
126 # only enable title output if
127 # - gb_TITLES is set
128 # - we have a known term
129 ifneq ($(strip $(gb_TITLES)),)
130 ifneq ($(filter $(TERM),$(KNOWN_TERM)),)
131 define gb_Output_announce_title
132 $(info $(gb_Output_ESCAPE)]2;gbuild: $(1)$(gb_Output_BELL)$(gb_Output_ESCAPE)[A)
133 endef
135 $(call gb_Output_announce_title,...)
137 endif
138 endif
140 # only enable bell output if
141 # - gb_BELL is set
142 # - gb_TTY is true (not piping to a file)
143 ifneq ($(strip $(gb_BELL)),)
144 define gb_Output_announce_bell
145 $(info $(gb_Output_BELL)$(gb_Output_ESCAPE)[A)
146 endef
147 endif
149 define gb_Output_announce
150 $(info $(call gb_Output__format_type,$(2),$(3),$(4)) $(call gb_Output__format_target,$(1)))
151 endef
154 # vim: set noet sw=4: