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 # use CC/CXX if they are nondefaults
16 ifneq ($(origin CC
),default
)
24 ifneq ($(origin CXX
),default
)
30 ifneq ($(origin AR
),default
)
33 gb_AR
:= $(shell $(CC
) -print-prog-name
=ar)
36 ifeq ($(strip $(gb_COMPILERDEFAULTOPTFLAGS
)),)
37 gb_COMPILERDEFAULTOPTFLAGS
:= -O2
40 gb_CCVER
:= $(shell $(gb_CC
) -dumpversion |
$(gb_AWK
) -F.
-- '{ print $$1*10000+$$2*100+$$3 }')
47 gb_AFLAGS
:= $(AFLAGS
)
50 -DCPPU_ENV
=$(gb_CPPU_ENV
) \
62 gb_CXXFLAGS_COMMON
:= \
72 ifneq ($(HAVE_THREADSAFE_STATICS
),TRUE
)
73 gb_CXXFLAGS_COMMON
+= -fno-threadsafe-statics
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
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
91 ifneq ($(EXTERNAL_WARNINGS_NOT_ERRORS
),TRUE
)
92 gb_CFLAGS_WERROR
:= -Werror
93 gb_CXXFLAGS_WERROR
:= -Werror
97 gb_CFLAGS_COMMON
+= -DLIBO_MERGELIBS
98 gb_CXXFLAGS_COMMON
+= -DLIBO_MERGELIBS
101 ifeq ($(ENABLE_LTO
),TRUE
)
105 gb_LinkTarget_EXCEPTIONFLAGS
:= \
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
117 gb_LinkTarget_NOEXCEPTIONFLAGS
:= \
121 gb_PrecompiledHeader_EXCEPTIONFLAGS
:= $(gb_LinkTarget_EXCEPTIONFLAGS
)
123 gb_NoexPrecompiledHeader_NOEXCEPTIONFLAGS
:= $(gb_LinkTarget_NOEXCEPTIONFLAGS
)
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
)
136 ifeq ($(HAVE_GCC_FINLINE_LIMIT
),TRUE
)
137 FINLINE_LIMIT0
=-finline-limit
=0
140 ifeq ($(HAVE_GCC_FNO_INLINE
),TRUE
)
141 FNO_INLINE
=-fno-inline
144 ifeq ($(HAVE_GCC_FNO_DEFAULT_INLINE
),TRUE
)
145 FNO_DEFAULT_INLINE
=-fno-default-inline
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
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
)
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
168 gb_COMPILER_PLUGINS
:=
169 gb_COMPILER_PLUGINS_SETUP
:=
174 gb_Executable_EXT_for_build
:=
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
187 gb_Helper_LIBRARY_PATH_VAR
:= LD_LIBRARY_PATH
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))
197 # Convert path to file URL.
198 define gb_Helper_make_url
202 gb_Helper_OUTDIRLIBDIR
:= $(OUTDIR
)/lib
203 gb_Helper_OUTDIR_FOR_BUILDLIBDIR
:= $(OUTDIR_FOR_BUILD
)/lib
205 gb_Helper_get_rcfile
= $(1)rc