bump product version to 4.1.6.2
[LibreOffice.git] / solenv / gbuild / platform / com_GCC_defs.mk
blob47f719101193d8fb19335c2afaf9960ff247780d
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/.
10 gb_AWK := awk
11 gb_YACC := bison
13 gb_CLASSPATHSEP := :
15 # use CC/CXX if they are nondefaults
16 ifneq ($(origin CC),default)
17 gb_CC := $(CC)
18 gb_GCCP := $(CC)
19 else
20 gb_CC := gcc
21 gb_GCCP := gcc
22 endif
24 ifneq ($(origin CXX),default)
25 gb_CXX := $(CXX)
26 else
27 gb_CXX := g++
28 endif
30 ifneq ($(origin AR),default)
31 gb_AR := $(AR)
32 else
33 gb_AR := $(shell $(CC) -print-prog-name=ar)
34 endif
36 ifeq ($(strip $(gb_COMPILERDEFAULTOPTFLAGS)),)
37 gb_COMPILERDEFAULTOPTFLAGS := -O2
38 endif
40 gb_CCVER := $(shell $(gb_CC) -dumpversion | $(gb_AWK) -F. -- '{ print $$1*10000+$$2*100+$$3 }')
42 gb_SHORTSTDC3 := 1
43 gb_SHORTSTDCPP3 := 6
45 gb_CPPU_ENV := gcc3
47 gb_AFLAGS := $(AFLAGS)
49 gb_COMPILERDEFS := \
50 -DCPPU_ENV=$(gb_CPPU_ENV) \
52 gb_CFLAGS_COMMON := \
53 -Wall \
54 -Wendif-labels \
55 -Wextra \
56 -Wundef \
57 -Wunused-macros \
58 -fmessage-length=0 \
59 -fno-common \
60 -pipe \
62 gb_CXXFLAGS_COMMON := \
63 -Wall \
64 -Wendif-labels \
65 -Wextra \
66 -Wundef \
67 -Wunused-macros \
68 -fmessage-length=0 \
69 -fno-common \
70 -pipe \
72 ifneq ($(HAVE_THREADSAFE_STATICS),TRUE)
73 gb_CXXFLAGS_COMMON += -fno-threadsafe-statics
74 endif
76 ifeq ($(strip $(gb_GCOV)),YES)
77 gb_CFLAGS_COMMON += -fprofile-arcs -ftest-coverage
78 gb_CXXFLAGS_COMMON += -fprofile-arcs -ftest-coverage
79 gb_LinkTarget_LDFLAGS += -fprofile-arcs -lgcov
80 gb_COMPILERDEFAULTOPTFLAGS := -O0
81 endif
84 ifeq ($(HAVE_GCC_VISIBILITY_FEATURE),TRUE)
85 gb_VISIBILITY_FLAGS := -DHAVE_GCC_VISIBILITY_FEATURE -fvisibility=hidden
86 ifneq ($(HAVE_GCC_VISIBILITY_BROKEN),TRUE)
87 gb_CXXFLAGS_COMMON += -fvisibility-inlines-hidden
88 endif
89 endif
91 ifneq ($(EXTERNAL_WARNINGS_NOT_ERRORS),TRUE)
92 gb_CFLAGS_WERROR := -Werror
93 gb_CXXFLAGS_WERROR := -Werror
94 endif
96 ifneq ($(MERGELIBS),)
97 gb_CFLAGS_COMMON += -DLIBO_MERGELIBS
98 gb_CXXFLAGS_COMMON += -DLIBO_MERGELIBS
99 endif
101 ifeq ($(ENABLE_LTO),TRUE)
102 gb_LTOFLAGS := -flto
103 endif
105 gb_LinkTarget_EXCEPTIONFLAGS := \
106 -DEXCEPTIONS_ON \
107 -fexceptions
109 ifeq ($(gb_ENABLE_DBGUTIL),$(false))
110 # Clang doesn't have this option
111 ifeq ($(HAVE_GCC_FNO_ENFORCE_EH_SPECS),TRUE)
112 gb_LinkTarget_EXCEPTIONFLAGS += \
113 -fno-enforce-eh-specs
114 endif
115 endif
117 gb_LinkTarget_NOEXCEPTIONFLAGS := \
118 -DEXCEPTIONS_OFF \
119 -fno-exceptions \
121 gb_PrecompiledHeader_EXCEPTIONFLAGS := $(gb_LinkTarget_EXCEPTIONFLAGS)
123 gb_NoexPrecompiledHeader_NOEXCEPTIONFLAGS := $(gb_LinkTarget_NOEXCEPTIONFLAGS)
125 # optimization level
126 gb_COMPILEROPTFLAGS := $(gb_COMPILERDEFAULTOPTFLAGS)
127 gb_COMPILERNOOPTFLAGS := -O0
129 # Clang does not know -ggdb2 or some other options
130 ifeq ($(HAVE_GCC_GGDB2),TRUE)
131 GGDB2=-ggdb2
132 else
133 GGDB2=-g2
134 endif
136 ifeq ($(HAVE_GCC_FINLINE_LIMIT),TRUE)
137 FINLINE_LIMIT0=-finline-limit=0
138 endif
140 ifeq ($(HAVE_GCC_FNO_INLINE),TRUE)
141 FNO_INLINE=-fno-inline
142 endif
144 ifeq ($(HAVE_GCC_FNO_DEFAULT_INLINE),TRUE)
145 FNO_DEFAULT_INLINE=-fno-default-inline
146 endif
148 gb_DEBUG_CFLAGS := $(GGDB2) $(FINLINE_LIMIT0) $(FNO_INLINE)
149 gb_DEBUG_CXXFLAGS := $(FNO_DEFAULT_INLINE)
152 gb_LinkTarget_INCLUDE :=\
153 $(subst -I. , ,$(SOLARINC)) \
154 -I$(BUILDDIR)/config_$(gb_Side) \
156 ifeq ($(COM_GCC_IS_CLANG),TRUE)
157 ifeq ($(COMPILER_PLUGIN_TOOL),)
158 gb_COMPILER_PLUGINS := -Xclang -load -Xclang $(BUILDDIR)/compilerplugins/obj/plugin.so -Xclang -add-plugin -Xclang loplugin
159 else
160 gb_COMPILER_PLUGINS := -Xclang -load -Xclang $(BUILDDIR)/compilerplugins/obj/plugin.so -Xclang -plugin -Xclang loplugin -Xclang -plugin-arg-loplugin -Xclang $(COMPILER_PLUGIN_TOOL)
161 ifneq ($(UPDATE_FILES),)
162 gb_COMPILER_PLUGINS += -Xclang -plugin-arg-loplugin -Xclang --scope=$(UPDATE_FILES)
163 endif
164 endif
165 # extra EF variable to make the command line shorter (just like is done with $(SRCDIR) etc.)
166 gb_COMPILER_PLUGINS_SETUP := EF=$(SRCDIR)/include/sal/log-areas.dox && ICECC_EXTRAFILES=$$EF CCACHE_EXTRAFILES=$$EF
167 else
168 gb_COMPILER_PLUGINS :=
169 gb_COMPILER_PLUGINS_SETUP :=
170 endif
172 # Executable class
174 gb_Executable_EXT_for_build :=
176 # Helper class
178 ifeq ($(OS_FOR_BUILD),MACOSX)
179 gb_Helper_LIBRARY_PATH_VAR := DYLD_LIBRARY_PATH
180 else ifeq ($(OS_FOR_BUILD),AIX)
181 gb_Helper_LIBRARY_PATH_VAR := LIBPATH
182 else ifeq ($(OS_FOR_BUILD),WNT)
183 # In theory possible if cross-compiling to some Unix from Windows,
184 # in practice strongly discouraged to even try that
185 gb_Helper_LIBRARY_PATH_VAR := PATH
186 else
187 gb_Helper_LIBRARY_PATH_VAR := LD_LIBRARY_PATH
188 endif
190 gb_Helper_set_ld_path := $(gb_Helper_LIBRARY_PATH_VAR)=$${$(gb_Helper_LIBRARY_PATH_VAR):+$$$(gb_Helper_LIBRARY_PATH_VAR):}"$(OUTDIR_FOR_BUILD)/lib:$(INSTDIR)/program"
192 # $(1): list of directory pathnames to append at the end of the ld path
193 define gb_Helper_extend_ld_path
194 $(gb_Helper_set_ld_path)$(foreach dir,$(1),:$(dir))
195 endef
197 # Convert path to file URL.
198 define gb_Helper_make_url
199 file://$(strip $(1))
200 endef
202 gb_Helper_OUTDIRLIBDIR := $(OUTDIR)/lib
203 gb_Helper_OUTDIR_FOR_BUILDLIBDIR := $(OUTDIR_FOR_BUILD)/lib
205 gb_Helper_get_rcfile = $(1)rc