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 # set tmpdir to some mixed case path, suitable for native tools
21 gb_TMPDIR
:=$(if
$(TMPDIR
),$(shell cygpath
-m
$(TMPDIR
)),$(shell cygpath
-m
/tmp
))
23 # please make generic Windows modifications to windows.mk
24 include $(GBUILDDIR
)/platform
/windows.mk
34 # use CC/CXX if they are nondefaults
35 ifneq ($(origin CC
),default
)
39 ifneq ($(origin CXX
),default
)
43 # _SCL_SECURE_NO_WARNINGS avoids deprecation warnings for STL algorithms
44 # like std::copy, std::transform (when MSVC_USE_DEBUG_RUNTIME is enabled)
47 -DBOOST_ERROR_CODE_HEADER_ONLY \
48 -DBOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE \
49 -DBOOST_SYSTEM_NO_DEPRECATED \
50 -D_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING \
51 -D_SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING \
52 -D_SILENCE_CXX17_RESULT_OF_DEPRECATION_WARNING \
53 -D_CRT_NON_CONFORMING_SWPRINTFS \
54 -D_CRT_NONSTDC_NO_DEPRECATE \
55 -D_CRT_SECURE_NO_DEPRECATE \
56 -D_SCL_SECURE_NO_WARNINGS \
59 -DCPPU_ENV
=$(CPPU_ENV
) \
61 ifeq ($(CPUNAME
),INTEL
)
63 -DBOOST_MEM_FN_ENABLE_CDECL \
68 $(gb_WIN_VERSION_DEFS
) \
72 gb_AFLAGS
:= $(AFLAGS
)
74 # Do we really need to disable this many warnings? It seems to me that
75 # many of these warnings are for constructs that we have been actively
76 # cleaning away from the code, to avoid warnings when building with
77 # gcc or Clang and -Wall -Werror.
79 # C4127: conditional expression is constant
81 # C4201: nonstandard extension used : nameless struct/union
83 # C4244: nonstandard extension used : formal parameter 'identifier'
84 # was previously defined as a type
86 # C4250: 'class1' : inherits 'class2::member' via dominance
88 # C4251: 'identifier' : class 'type' needs to have dll-interface to be
89 # used by clients of class 'type2'
91 # C4267: conversion from 'size_t' to 'type', possible loss of data
93 # C4275: non-DLL-interface classkey 'identifier' used as base for
94 # DLL-interface classkey 'identifier'
96 # C4505: 'function' : unreferenced local function has been removed
98 # C4611: interaction between 'function' and C++ object destruction is
101 # C4702: unreachable code
103 # C4706: assignment within conditional expression
111 $(if
$(MSVC_USE_DEBUG_RUNTIME
),-MDd
,-MD
) \
118 gb_CXXFLAGS_DISABLE_WARNINGS
= -w
120 ifneq ($(COM_IS_CLANG
),TRUE
)
122 # clang-cl doesn't support -Wv:18 for now
136 $(if
$(MSVC_USE_DEBUG_RUNTIME
),-MDd
,-MD
) \
151 ifneq ($(COM_IS_CLANG
),TRUE
)
152 gb_CXXFLAGS
+= -Zc
:inline
153 gb_CXXFLAGS_ZCINLINE_OFF
:= -Zc
:inline-
156 ifeq ($(CPUNAME
),INTEL
)
166 ifeq ($(HAVE_DLLEXPORTINLINES
),TRUE
)
167 gb_CXXFLAGS
+= -Zc
:dllexportInlines-
170 gb_CXXFLAGS_include
:= -FI
171 ifeq ($(COM_IS_CLANG
),TRUE
)
172 gb_CXXFLAGS_no_pch_warnings
:= -Wno-clang-cl-pch
175 ifneq ($(COM_IS_CLANG
),TRUE
)
177 # clang-cl doesn't support -Wv:18 for now
178 # Work around MSVC 2017 C4702 compiler bug with release builds
179 # http://document-foundation-mail-archive.969070.n3.nabble.com/Windows-32-bit-build-failure-unreachable-code-tp4243848.html
180 # http://document-foundation-mail-archive.969070.n3.nabble.com/64-bit-Windows-build-failure-after-MSVC-Update-tp4246816.html
183 $(if
$(filter 0,$(gb_DEBUGLEVEL
)),-wd4702
) \
187 # rc.exe does not support -nologo in 6.1.6723.1 that is in the Windows SDK 6.0A
188 gb_RCFLAGS
+= -nologo
190 # C4005: 'identifier' : macro redefinition
202 gb_CFLAGS_WERROR
= $(if
$(ENABLE_WERROR
),-WX
)
204 # there does not seem to be a way to force C++03 with MSVC, nor with clang-cl against MSVC system
208 gb_LinkTarget_EXCEPTIONFLAGS
:= \
211 gb_PrecompiledHeader_EXCEPTIONFLAGS
:= $(gb_LinkTarget_EXCEPTIONFLAGS
)
213 ifneq ($(gb_ENABLE_PCH
),)
214 ifeq ($(COM_IS_CLANG
),TRUE
)
215 # the same as in com_GCC_defs.mk
216 gb_NO_PCH_TIMESTAMP
:= -Xclang
-fno-pch-timestamp
220 gb_LinkTarget_LDFLAGS
:= \
221 $(if
$(findstring s
,$(filter-out --%,$(MAKEFLAGS
))),-nologo
,) \
222 $(patsubst %,-LIBPATH
:%,$(filter-out .
,$(subst ;, ,$(subst \
,/,$(ILIB
))))) \
224 # Prevent warning spamming
225 # Happens because of the way we link our unit tests with our libraries.
226 # LNK4049: locally defined symbol
227 gb_LinkTarget_LDFLAGS
+= \
228 /ignore
:4217 /ignore
:4049
231 ifeq ($(ENABLE_Z7_DEBUG
),)
232 gb_DEBUGINFO_FLAGS
:= \
237 # ccache does not work with -Zi
238 gb_DEBUGINFO_FLAGS
:= \
243 # See gb_Windows_PE_TARGETTYPEFLAGS_DEBUGINFO
244 gb_LINKER_DEBUGINFO_FLAGS
:=
246 gb_COMPILEROPTFLAGS
:= -O2
-Oy-
247 gb_COMPILERNOOPTFLAGS
:= -Od
248 gb_COMPILERDEBUGOPTFLAGS
:=
250 ifeq ($(gb_FULLDEPS
),$(true
))
251 gb_COMPILERDEPFLAGS
:= -showIncludes
252 define gb_create_deps
253 |
$(GBUILDDIR
)/platform
/filter-showIncludes.awk
-vdepfile
=$(1) -vobjectfile
=$(2) -vsourcefile
=$(3); exit
$${PIPESTATUS
[0]}
256 gb_COMPILERDEPFLAGS
:=
257 define gb_create_deps
258 |
$(GBUILDDIR
)/platform
/filter-sourceName.awk
; exit
$${PIPESTATUS
[0]}
262 gb_LTOFLAGS
:= $(if
$(filter TRUE
,$(ENABLE_LTO
)),-GL
)
264 # When compiling for CLR, disable "warning C4339: use of undefined type detected
265 # in CLR meta-data - use of this type may lead to a runtime exception":
267 $(if
$(COM_IS_CLANG
), \
268 $(patsubst -std
=%,-std
:c
++17 -Zc
:__cplusplus
,$(gb_CXXFLAGS
)), \
270 $(gb_LinkTarget_EXCEPTIONFLAGS
) \
271 -AI
$(INSTDIR
)/$(LIBO_URE_LIB_FOLDER
) \
279 ifeq ($(COM_IS_CLANG
),TRUE
)
284 -Wstrict-prototypes \
290 -Wimplicit-fallthrough \
291 -Wno-missing-braces \
292 -Woverloaded-virtual \
299 ifeq ($(COM_IS_CLANG
),TRUE
)
300 gb_COMPILER_TEST_FLAGS
:= -Xclang
-plugin-arg-loplugin
-Xclang
--unit-test-mode
301 ifeq ($(COMPILER_PLUGIN_TOOL
),)
302 gb_COMPILER_PLUGINS
:= -Xclang
-load
-Xclang
$(BUILDDIR
)/compilerplugins
/clang
/plugin.dll
-Xclang
-add-plugin
-Xclang loplugin
303 ifneq ($(COMPILER_PLUGIN_WARNINGS_ONLY
),)
304 gb_COMPILER_PLUGINS
+= -Xclang
-plugin-arg-loplugin
-Xclang \
305 --warnings-only
='$(COMPILER_PLUGIN_WARNINGS_ONLY)'
308 gb_COMPILER_PLUGINS
:= -Xclang
-load
-Xclang
$(BUILDDIR
)/compilerplugins
/clang
/plugin.dll
-Xclang
-plugin
-Xclang loplugin
$(foreach plugin
,$(COMPILER_PLUGIN_TOOL
), -Xclang
-plugin-arg-loplugin
-Xclang
$(plugin
))
309 ifneq ($(UPDATE_FILES
),)
310 gb_COMPILER_PLUGINS
+= -Xclang
-plugin-arg-loplugin
-Xclang
--scope
=$(UPDATE_FILES
)
313 ifeq ($(COMPILER_PLUGINS_DEBUG
),TRUE
)
314 gb_COMPILER_PLUGINS
+= -Xclang
-plugin-arg-loplugin
-Xclang
--debug
316 gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS
:= \
317 -Xclang
-plugin-arg-loplugin
-Xclang
--warnings-as-errors
319 gb_COMPILER_TEST_FLAGS
:=
320 gb_COMPILER_PLUGINS
:=
321 gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS
:=
326 gb_Helper_set_ld_path
:= PATH
="$(shell cygpath -u $(INSTDIR_FOR_BUILD)/$(LIBO_URE_LIB_FOLDER)):$(shell cygpath -u $(INSTDIR_FOR_BUILD)/$(LIBO_BIN_FOLDER)):$$PATH"
328 define gb_Helper_prepend_ld_path
329 PATH
="$(shell cygpath -u $(INSTDIR_FOR_BUILD)/$(LIBO_URE_LIB_FOLDER)):$(shell cygpath -u $(INSTDIR_FOR_BUILD)/$(LIBO_BIN_FOLDER)):$(1):$$PATH"
332 # $(1): one directory pathname to append to the ld path
333 define gb_Helper_extend_ld_path
334 $(gb_Helper_set_ld_path
)':$(shell cygpath -u $(1))'
337 # common macros to build GPG related libraries
338 # we explicitly have to replace cygwin with mingw32 for the host, but the build must stay cygwin, or cmd.exe processes will be spawned
339 gb_WIN_GPG_WINDRES_target
:= $(if
$(filter INTEL
,$(CPUNAME
)),pe-i386
,pe-x86-64
)
340 gb_WIN_GPG_platform_switches
:= --build
=$(BUILD_PLATFORM
) --host
=$(subst cygwin
,mingw32
,$(HOST_PLATFORM
))
341 gb_WIN_GPG_cross_setup_exports
= export REAL_BUILD_CC
="$(filter-out -%,$(CC_FOR_BUILD))" REAL_BUILD_CC_FLAGS
="$(filter -%,$(CC_FOR_BUILD))" \
342 && export CC_FOR_BUILD
="$(call gb_Executable_get_target_for_build,gcc-wrapper) --wrapper-env-prefix=REAL_BUILD_ $(SOLARINC) -L$(subst ;, -L,$(ILIB_FOR_BUILD))" \
343 && export RC
='windres -O COFF --target=$(gb_WIN_GPG_WINDRES_target) --preprocessor=$(call gb_Executable_get_target_for_build,cpp) --preprocessor-arg=-+ -DRC_INVOKED -DWINAPI_FAMILY=0 $(SOLARINC)'
345 ifneq ($(gb_ENABLE_PCH
),)
346 # Enable use of .sum files for PCHs.
347 gb_COMPILER_SETUP
+= CCACHE_PCH_EXTSUM
=1
350 # vim: set noet sw=4: