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/.
15 gb_README
= README_
$(1)
17 # use CC/CXX if they are nondefaults
18 ifneq ($(origin CC
),default
)
26 ifneq ($(origin CXX
),default
)
32 ifneq ($(origin AR
),default
)
35 gb_AR
:= $(shell $(CC
) -print-prog-name
=ar)
38 ifeq ($(strip $(gb_COMPILEROPTFLAGS
)),)
39 gb_COMPILEROPTFLAGS
:= -O2
47 gb_AFLAGS
:= $(AFLAGS
)
50 -DBOOST_ERROR_CODE_HEADER_ONLY \
51 -DBOOST_SYSTEM_NO_DEPRECATED \
52 -DCPPU_ENV
=$(gb_CPPU_ENV
) \
65 gb_CXXFLAGS_COMMON
:= \
77 gb_CXXFLAGS_Wundef
= -Wno-undef
79 ifneq ($(HAVE_THREADSAFE_STATICS
),TRUE
)
80 gb_CXXFLAGS_COMMON
+= -fno-threadsafe-statics
83 ifeq ($(strip $(gb_GCOV
)),YES
)
84 gb_CFLAGS_COMMON
+= -fprofile-arcs
-ftest-coverage
85 gb_CXXFLAGS_COMMON
+= -fprofile-arcs
-ftest-coverage
86 gb_LinkTarget_LDFLAGS
+= -fprofile-arcs
-lgcov
87 gb_COMPILEROPTFLAGS
:= -O0
91 ifeq ($(HAVE_GCC_VISIBILITY_FEATURE
),TRUE
)
92 gb_VISIBILITY_FLAGS
:= -DHAVE_GCC_VISIBILITY_FEATURE
93 # If CC or CXX already include -fvisibility=hidden, don't duplicate it
94 ifeq (,$(filter -fvisibility
=hidden
,$(CC
)))
95 gb__visibility_hidden
:= -fvisibility
=hidden
96 ifeq ($(COM_GCC_IS_CLANG
),TRUE
)
97 ifneq ($(filter -fsanitize
=%,$(CC
)),)
98 gb__visibility_hidden
:= -fvisibility-ms-compat
101 gb_VISIBILITY_FLAGS
+= $(gb__visibility_hidden
)
103 ifneq ($(HAVE_GCC_VISIBILITY_BROKEN
),TRUE
)
104 gb_VISIBILITY_FLAGS_CXX
:= -fvisibility-inlines-hidden
107 gb_CXXFLAGS_COMMON
+= $(gb_VISIBILITY_FLAGS_CXX
)
109 ifeq ($(HAVE_GCC_STACK_PROTECTOR_STRONG
),TRUE
)
110 gb_CFLAGS_COMMON
+= -fstack-protector-strong
111 gb_CXXFLAGS_COMMON
+= -fstack-protector-strong
112 gb_LinkTarget_LDFLAGS
+= -fstack-protector-strong
115 gb_CFLAGS_WERROR
:= $(if
$(ENABLE_WERROR
),-Werror
)
117 # This is the default in non-C++11 mode
118 ifeq ($(COM_GCC_IS_CLANG
),TRUE
)
119 gb_CXX03FLAGS
:= -std
=gnu
++98 -Werror
=c
++11-extensions
-Wno-c
++11-long-long \
120 -Wno-deprecated-declarations
122 gb_CXX03FLAGS
:= -std
=gnu
++98 -pedantic-errors
-Wno-long-long \
123 -Wno-variadic-macros
-Wno-non-virtual-dtor
-Wno-deprecated-declarations
126 # On Windows MSVC only supports C90 so force gnu89 (especially in clang) to
127 # to catch potential gnu89/C90 incompatibilities locally.
128 gb_CFLAGS_COMMON
+= -std
=gnu89
130 ifeq ($(ENABLE_LTO
),TRUE
)
131 ifeq ($(COM_GCC_IS_CLANG
),TRUE
)
134 gb_LTOFLAGS
:= -flto
=$(PARALLELISM
) -fuse-linker-plugin
-O2
138 gb_LinkTarget_EXCEPTIONFLAGS
:= \
142 ifeq ($(gb_ENABLE_DBGUTIL
),$(false
))
143 # Clang doesn't have this option
144 ifeq ($(HAVE_GCC_FNO_ENFORCE_EH_SPECS
),TRUE
)
145 gb_LinkTarget_EXCEPTIONFLAGS
+= \
146 -fno-enforce-eh-specs
150 gb_PrecompiledHeader_EXCEPTIONFLAGS
:= $(gb_LinkTarget_EXCEPTIONFLAGS
)
153 gb_COMPILERNOOPTFLAGS
:= -O0
-fstrict-aliasing
-fstrict-overflow
155 # Clang does not know -ggdb2 or some other options
156 ifeq ($(HAVE_GCC_GGDB2
),TRUE
)
162 ifeq ($(HAVE_GCC_FINLINE_LIMIT
),TRUE
)
163 FINLINE_LIMIT0
=-finline-limit
=0
166 ifeq ($(HAVE_GCC_FNO_INLINE
),TRUE
)
167 FNO_INLINE
=-fno-inline
170 ifeq ($(HAVE_GCC_FNO_DEFAULT_INLINE
),TRUE
)
171 FNO_DEFAULT_INLINE
=-fno-default-inline
174 gb_DEBUG_CFLAGS
:= $(GGDB2
) $(FINLINE_LIMIT0
) $(FNO_INLINE
)
175 gb_DEBUG_CXXFLAGS
:= $(FNO_DEFAULT_INLINE
)
178 gb_LinkTarget_INCLUDE
:=\
179 $(subst -I.
, ,$(SOLARINC
)) \
180 -I
$(BUILDDIR
)/config_
$(gb_Side
) \
182 ifeq ($(COM_GCC_IS_CLANG
),TRUE
)
183 ifeq ($(COMPILER_PLUGIN_TOOL
),)
184 gb_COMPILER_PLUGINS
:= -Xclang
-load
-Xclang
$(BUILDDIR
)/compilerplugins
/obj
/plugin.so
-Xclang
-add-plugin
-Xclang loplugin
185 ifneq ($(COMPILER_PLUGIN_WARNINGS_ONLY
),)
186 gb_COMPILER_PLUGINS
+= -Xclang
-plugin-arg-loplugin
-Xclang \
187 --warnings-only
='$(COMPILER_PLUGIN_WARNINGS_ONLY)'
190 gb_COMPILER_PLUGINS
:= -Xclang
-load
-Xclang
$(BUILDDIR
)/compilerplugins
/obj
/plugin.so
-Xclang
-plugin
-Xclang loplugin
$(foreach plugin
,$(COMPILER_PLUGIN_TOOL
), -Xclang
-plugin-arg-loplugin
-Xclang
$(plugin
))
191 ifneq ($(UPDATE_FILES
),)
192 gb_COMPILER_PLUGINS
+= -Xclang
-plugin-arg-loplugin
-Xclang
--scope
=$(UPDATE_FILES
)
195 # extra EF variable to make the command line shorter (just like is done with $(SRCDIR) etc.)
196 gb_COMPILER_PLUGINS_SETUP
:= EF
=$(SRCDIR
)/include/sal
/log-areas.dox
&& ICECC_EXTRAFILES
=$$EF CCACHE_EXTRAFILES
=$$EF
198 gb_COMPILER_PLUGINS
:=
199 gb_COMPILER_PLUGINS_SETUP
:=
204 gb_Executable_EXT_for_build
:=
208 ifeq ($(OS_FOR_BUILD
),MACOSX
)
209 gb_Helper_LIBRARY_PATH_VAR
:= DYLD_LIBRARY_PATH
210 else ifeq ($(OS_FOR_BUILD
),AIX
)
211 gb_Helper_LIBRARY_PATH_VAR
:= LIBPATH
212 else ifeq ($(OS_FOR_BUILD
),WNT
)
213 # In theory possible if cross-compiling to some Unix from Windows,
214 # in practice strongly discouraged to even try that
215 gb_Helper_LIBRARY_PATH_VAR
:= PATH
217 gb_Helper_LIBRARY_PATH_VAR
:= LD_LIBRARY_PATH
220 gb_Helper_set_ld_path
:= $(gb_Helper_LIBRARY_PATH_VAR
)=$${$(gb_Helper_LIBRARY_PATH_VAR
):+$$$(gb_Helper_LIBRARY_PATH_VAR
):}"$(INSTROOT_FOR_BUILD)/$(LIBO_URE_LIB_FOLDER_FOR_BUILD):$(INSTROOT_FOR_BUILD)/$(LIBO_LIB_FOLDER_FOR_BUILD)"
222 # $(1): list of : separated directory pathnames to append to the ld path
223 define gb_Helper_extend_ld_path
224 $(gb_Helper_set_ld_path
):$(1)
227 # Convert path to file URL.
228 define gb_Helper_make_url
232 gb_Helper_get_rcfile
= $(1)rc
234 # vim: set noet sw=4: