1 # -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
2 #*************************************************************************
4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 # Copyright 2000, 2010 Oracle and/or its affiliates.
8 # OpenOffice.org - a multi-platform office productivity suite
10 # This file is part of OpenOffice.org.
12 # OpenOffice.org is free software: you can redistribute it and/or modify
13 # it under the terms of the GNU Lesser General Public License version 3
14 # only, as published by the Free Software Foundation.
16 # OpenOffice.org is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU Lesser General Public License version 3 for more details
20 # (a copy is included in the LICENSE file that accompanied this code).
22 # You should have received a copy of the GNU Lesser General Public License
23 # version 3 along with OpenOffice.org. If not, see
24 # <http://www.openoffice.org/license.html>
25 # for a copy of the LGPLv3 License.
27 #*************************************************************************
29 # user notifications and formatting
31 define gb_Output__format_type
32 [ $(word 2,$(1) build
clean) $(2) ]
35 define gb_Output__format_target
39 define gb_Output_error
43 define gb_Output_announce_title
46 define gb_Output_announce_bell
50 $(info [ info $(2) ] $(1))
54 $(warning
$(NEWLINE
)[ WARN
$(2) ] !!!$(NEWLINE
)[ WARN
$(2) ] !!! $(1)$(NEWLINE
)[ WARN
$(2) ] !!!)
57 gb_Output_ESCAPE
:= $(shell echo|awk
'BEGIN { printf "%c", 27 }' -)
58 gb_Output_BELL
:= $(shell echo|awk
'BEGIN { printf "%c", 7 }' -)
60 # only enable colorized output if
62 # - we have a known term
63 KNOWN_TERM
:=Eterm aterm gnome kterm linux putty rxvt rxvt-unicode screen xterm xterm xtermc
64 KNOWN_TERM
+=$(patsubst %,%-color
,$(KNOWN_TERM
))
65 KNOWN_TERM
+=$(patsubst %-color
,%-256color
,$(KNOWN_TERM
))
66 KNOWN_TERM
+=$(patsubst %-color
,%+256color
,$(KNOWN_TERM
))
67 ifneq ($(strip $(gb_COLOR
)),)
68 ifneq ($(filter $(TERM
),$(KNOWN_TERM
)),)
70 gb_Output_COLOR_RESET
:= $(gb_Output_ESCAPE
)[0m
71 gb_Output_COLOR_RESETANDESCAPE
:= $(gb_Output_COLOR_RESET
)$(gb_Output_ESCAPE
)
73 gb_Output_COLOR_OUTBUILD_LEVEL1
:= $(gb_Output_COLOR_RESETANDESCAPE
)[37;40m
74 gb_Output_COLOR_OUTBUILD_LEVEL2
:= $(gb_Output_COLOR_RESETANDESCAPE
)[37;40m
75 gb_Output_COLOR_OUTBUILD_LEVEL3
:= $(gb_Output_COLOR_RESETANDESCAPE
)[37;40m
76 gb_Output_COLOR_OUTBUILD_LEVEL4
:= $(gb_Output_COLOR_RESETANDESCAPE
)[37;40m
77 gb_Output_COLOR_OUTBUILD_LEVEL5
:= $(gb_Output_COLOR_RESETANDESCAPE
)[37;1;46m
78 gb_Output_COLOR_OUTBUILD_LEVEL6
:= $(gb_Output_COLOR_RESETANDESCAPE
)[37;1;44m
80 gb_Output_COLOR_INBUILD_LEVEL1
:= $(gb_Output_COLOR_RESETANDESCAPE
)[36;40m
81 gb_Output_COLOR_INBUILD_LEVEL2
:= $(gb_Output_COLOR_RESETANDESCAPE
)[36;1;40m
82 gb_Output_COLOR_INBUILD_LEVEL3
:= $(gb_Output_COLOR_RESETANDESCAPE
)[32;40m
83 gb_Output_COLOR_INBUILD_LEVEL4
:= $(gb_Output_COLOR_RESETANDESCAPE
)[32;1;40m
84 gb_Output_COLOR_INBUILD_LEVEL5
:= $(gb_Output_COLOR_RESETANDESCAPE
)[37;1;46m
85 gb_Output_COLOR_INBUILD_LEVEL6
:= $(gb_Output_COLOR_RESETANDESCAPE
)[37;1;44m
87 gb_Output_COLOR_OUTCLEAN_LEVEL1
:= $(gb_Output_COLOR_RESETANDESCAPE
)[37;40m
88 gb_Output_COLOR_OUTCLEAN_LEVEL2
:= $(gb_Output_COLOR_RESETANDESCAPE
)[37;40m
89 gb_Output_COLOR_OUTCLEAN_LEVEL3
:= $(gb_Output_COLOR_RESETANDESCAPE
)[37;40m
90 gb_Output_COLOR_OUTCLEAN_LEVEL4
:= $(gb_Output_COLOR_RESETANDESCAPE
)[37;40m
91 gb_Output_COLOR_OUTCLEAN_LEVEL5
:= $(gb_Output_COLOR_RESETANDESCAPE
)[33;1;41m
92 gb_Output_COLOR_OUTCLEAN_LEVEL6
:= $(gb_Output_COLOR_RESETANDESCAPE
)[37;1;41m
94 gb_Output_COLOR_INCLEAN_LEVEL1
:= $(gb_Output_COLOR_RESETANDESCAPE
)[33;40m
95 gb_Output_COLOR_INCLEAN_LEVEL2
:= $(gb_Output_COLOR_RESETANDESCAPE
)[33;1;40m
96 gb_Output_COLOR_INCLEAN_LEVEL3
:= $(gb_Output_COLOR_RESETANDESCAPE
)[31;40m
97 gb_Output_COLOR_INCLEAN_LEVEL4
:= $(gb_Output_COLOR_RESETANDESCAPE
)[31;1;40m
98 gb_Output_COLOR_INCLEAN_LEVEL5
:= $(gb_Output_COLOR_RESETANDESCAPE
)[33;1;41m
99 gb_Output_COLOR_INCLEAN_LEVEL6
:= $(gb_Output_COLOR_RESETANDESCAPE
)[37;1;41m
101 gb_Output_COLOR_ERROR
:= $(gb_Output_COLOR_RESETANDESCAPE
)[37;1;41m
103 define gb_Output__format_type
104 $(subst :, ,$(word 2,$(1) \
105 $(gb_Output_COLOR_OUTBUILD_LEVEL
$(3))[:$(gb_Output_COLOR_INBUILD_LEVEL
$(3))$(subst $(WHITESPACE
),:,$(2))$(gb_Output_COLOR_OUTBUILD_LEVEL
$(3)):] \
106 $(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 define gb_Output_info
110 $(info $(gb_Output_COLOR_OUTBUILD_LEVEL6
)[ $(gb_Output_COLOR_INBUILD_LEVEL6
)info $(2)$(gb_Output_COLOR_OUTBUILD_LEVEL6
) ]$(gb_Output_COLOR_RESET
) $(1))
113 define gb_Output_warn
114 $(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 define gb_Output_error
118 $(error
$(gb_Output_COLOR_ERROR
)$(1)$(gb_Output_COLOR_RESET
))
124 # only enable title output if
126 # - we have a known term
127 ifneq ($(strip $(gb_TITLES
)),)
128 ifneq ($(filter $(TERM
),$(KNOWN_TERM
)),)
129 define gb_Output_announce_title
130 $(info $(gb_Output_ESCAPE
)]2;gbuild
: $(1)$(gb_Output_BELL
)$(gb_Output_ESCAPE
)[A
)
133 $(call gb_Output_announce_title
,...
)
138 # only enable bell output if
140 # - gb_TTY is true (not piping to a file)
141 ifneq ($(strip $(gb_BELL
)),)
142 define gb_Output_announce_bell
143 $(info $(gb_Output_BELL
)$(gb_Output_ESCAPE
)[A
)
147 define gb_Output_announce
148 $(info $(call gb_Output__format_type
,$(2),$(3),$(4)) $(call gb_Output__format_target
,$(1)))
152 # vim: set noet sw=4: