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 \
51 -D_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING \
52 -D_SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING \
53 -D_SILENCE_CXX17_RESULT_OF_DEPRECATION_WARNING \
54 -D_CRT_NON_CONFORMING_SWPRINTFS \
55 -D_CRT_NONSTDC_NO_DEPRECATE \
56 -D_CRT_SECURE_NO_DEPRECATE \
57 -D_SCL_SECURE_NO_WARNINGS \
60 -DCPPU_ENV
=$(gb_CPPU_ENV
) \
62 ifeq ($(CPUNAME
),INTEL
)
64 -DBOOST_MEM_FN_ENABLE_CDECL \
69 $(gb_WIN_VERSION_DEFS
) \
73 gb_AFLAGS
:= $(AFLAGS
)
75 # Do we really need to disable this many warnings? It seems to me that
76 # many of these warnings are for constructs that we have been actively
77 # cleaning away from the code, to avoid warnings when building with
78 # gcc or Clang and -Wall -Werror.
80 # C4091: 'typedef ': ignored on left of '' when no variable is declared
82 # C4100: 'identifier' : unreferenced formal parameter
84 # C4127: conditional expression is constant
86 # C4189: 'identifier' : local variable is initialized but not referenced
88 # C4200: nonstandard extension used : zero-sized array in struct/union
90 # C4201: nonstandard extension used : nameless struct/union
92 # C4244: nonstandard extension used : formal parameter 'identifier'
93 # was previously defined as a type
95 # C4250: 'class1' : inherits 'class2::member' via dominance
97 # C4251: 'identifier' : class 'type' needs to have dll-interface to be
98 # used by clients of class 'type2'
100 # C4267: conversion from 'size_t' to 'type', possible loss of data
102 # C4275: non-DLL-interface classkey 'identifier' used as base for
103 # DLL-interface classkey 'identifier'
105 # C4290: C++ exception specification ignored except to indicate a
106 # function is not __declspec(nothrow)
108 # C4351: new behavior: elements of array 'array' will be default
110 # (an issue with MSVC 2013 that appears to be gone with MSVC 2015)
112 # C4373: '%$S': virtual function overrides '%$pS', previous versions
113 # of the compiler did not override when parameters only differed by
114 # const/volatile qualifiers.
115 # [translation: ancient compilers that don't actually support C++ do
118 # C4505: 'function' : unreferenced local function has been removed
120 # C4510: 'class' : default constructor could not be generated
122 # C4512: 'class' : assignment operator could not be generated
123 # (an issue with MSVC 2013 that appears to be gone with MSVC 2015)
125 # C4610: 'class' can never be instantiated - user defined constructor required
127 # C4611: interaction between 'function' and C++ object destruction is
130 # C4702: unreachable code
132 # C4706: assignment within conditional expression
134 # C4800: 'type' : forcing value to bool 'true' or 'false' (performance
143 $(if
$(MSVC_USE_DEBUG_RUNTIME
),-MDd
,-MD
) \
147 $(if
$(filter 0,$(gb_DEBUGLEVEL
)),-wd4100
) \
149 $(if
$(filter 0,$(gb_DEBUGLEVEL
)),-wd4189
) \
159 gb_CXXFLAGS_DISABLE_WARNINGS
= -w
161 ifneq ($(COM_IS_CLANG
),TRUE
)
163 # clang-cl doesn't support -Wv:18 for now
177 $(if
$(MSVC_USE_DEBUG_RUNTIME
),-MDd
,-MD
) \
181 $(if
$(filter 0,$(gb_DEBUGLEVEL
)),-wd4100
) \
183 $(if
$(filter 0,$(gb_DEBUGLEVEL
)),-wd4189
) \
201 ifeq ($(CPUNAME
),INTEL
)
211 ifneq ($(COM_IS_CLANG
),TRUE
)
213 # clang-cl doesn't support -Wv:18 for now
214 # Work around MSVC 2017 C4702 compiler bug with release builds
215 # http://document-foundation-mail-archive.969070.n3.nabble.com/Windows-32-bit-build-failure-unreachable-code-tp4243848.html
216 # http://document-foundation-mail-archive.969070.n3.nabble.com/64-bit-Windows-build-failure-after-MSVC-Update-tp4246816.html
219 $(if
$(filter 0,$(gb_DEBUGLEVEL
)),-wd4702
) \
223 # rc.exe does not support -nologo in 6.1.6723.1 that is in the Windows SDK 6.0A
224 gb_RCFLAGS
+= -nologo
226 # C4005: 'identifier' : macro redefinition
238 gb_CFLAGS_WERROR
= $(if
$(ENABLE_WERROR
),-WX
)
240 # there does not seem to be a way to force C++03 with MSVC
243 gb_LinkTarget_EXCEPTIONFLAGS
:= \
247 gb_PrecompiledHeader_EXCEPTIONFLAGS
:= $(gb_LinkTarget_EXCEPTIONFLAGS
)
249 gb_LinkTarget_LDFLAGS
:= \
250 $(if
$(findstring s
,$(filter-out --%,$(MAKEFLAGS
))),-nologo
,) \
251 $(patsubst %,-LIBPATH
:%,$(filter-out .
,$(subst ;, ,$(subst \
,/,$(ILIB
))))) \
253 # Prevent warning spamming
254 # Happens because of the way we link our unit tests with our libraries.
255 # LNK4049: locally defined symbol
256 gb_LinkTarget_LDFLAGS
+= \
257 /ignore
:4217 /ignore
:4049
260 gb_DEBUGINFO_FLAGS
:= \
264 # See gb_Windows_PE_TARGETTYPEFLAGS_DEBUGINFO
265 gb_LINKER_DEBUGINFO_FLAGS
:=
267 gb_COMPILEROPTFLAGS
:= -O2
-Oy-
268 gb_COMPILERNOOPTFLAGS
:= -Od
270 ifeq ($(gb_FULLDEPS
),$(true
))
271 gb_COMPILERDEPFLAGS
:= -showIncludes
272 define gb_create_deps
273 | LC_ALL
=C
$(GBUILDDIR
)/platform
/filter-showIncludes.awk
-vdepfile
=$(1) -vobjectfile
=$(2) -vsourcefile
=$(3); exit
$${PIPESTATUS
[0]}
276 gb_COMPILERDEPFLAGS
:=
277 define gb_create_deps
278 | LC_ALL
=C
$(GBUILDDIR
)/platform
/filter-sourceName.awk
; exit
$${PIPESTATUS
[0]}
282 gb_LTOFLAGS
:= $(if
$(filter TRUE
,$(ENABLE_LTO
)),-GL
)
284 # When compiling for CLR, disable "warning C4339: use of undefined type detected
285 # in CLR meta-data - use of this type may lead to a runtime exception":
287 $(if
$(COM_IS_CLANG
), \
288 $(patsubst -std
=%,-std
:c
++17 -Zc
:__cplusplus
,$(gb_CXXFLAGS
)), \
290 $(gb_LinkTarget_EXCEPTIONFLAGS
) \
291 -AI
$(INSTDIR
)/$(LIBO_URE_LIB_FOLDER
) \
298 ifeq ($(COM_IS_CLANG
),TRUE
)
301 -Wdeclaration-after-statement \
304 -Wstrict-prototypes \
310 -Wimplicit-fallthrough \
311 -Wno-missing-braces \
313 -Woverloaded-virtual \
320 ifeq ($(COM_IS_CLANG
),TRUE
)
321 gb_COMPILER_TEST_FLAGS
:= -Xclang
-plugin-arg-loplugin
-Xclang
--unit-test-mode
322 ifeq ($(COMPILER_PLUGIN_TOOL
),)
323 gb_COMPILER_PLUGINS
:= -Xclang
-load
-Xclang
$(BUILDDIR
)/compilerplugins
/clang
/plugin.dll
-Xclang
-add-plugin
-Xclang loplugin
324 ifneq ($(COMPILER_PLUGIN_WARNINGS_ONLY
),)
325 gb_COMPILER_PLUGINS
+= -Xclang
-plugin-arg-loplugin
-Xclang \
326 --warnings-only
='$(COMPILER_PLUGIN_WARNINGS_ONLY)'
329 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
))
330 ifneq ($(UPDATE_FILES
),)
331 gb_COMPILER_PLUGINS
+= -Xclang
-plugin-arg-loplugin
-Xclang
--scope
=$(UPDATE_FILES
)
334 ifeq ($(COMPILER_PLUGINS_DEBUG
),TRUE
)
335 gb_COMPILER_PLUGINS
+= -Xclang
-plugin-arg-loplugin
-Xclang
--debug
337 gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS
:= \
338 -Xclang
-plugin-arg-loplugin
-Xclang
--warnings-as-errors
340 gb_COMPILER_TEST_FLAGS
:=
341 gb_COMPILER_PLUGINS
:=
342 gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS
:=
347 ifeq ($(GNUMAKE_WIN_NATIVE
),TRUE
)
348 gb_Helper_set_ld_path
:= PATH
="$(shell cygpath -w $(INSTDIR)/$(LIBO_URE_LIB_FOLDER));$(shell cygpath -w $(INSTDIR)/$(LIBO_BIN_FOLDER));$$PATH"
350 define gb_Helper_prepend_ld_path
351 PATH
="$(shell cygpath -w $(INSTDIR)/$(LIBO_URE_LIB_FOLDER));$(shell cygpath -w $(INSTDIR)/$(LIBO_BIN_FOLDER));$(1);$$PATH"
354 # $(1): one directory pathname to append to the ld path
355 define gb_Helper_extend_ld_path
356 $(gb_Helper_set_ld_path
)';$(shell cygpath -w $(1))'
360 gb_Helper_set_ld_path
:= PATH
="$(shell cygpath -u $(INSTDIR)/$(LIBO_URE_LIB_FOLDER)):$(shell cygpath -u $(INSTDIR)/$(LIBO_BIN_FOLDER)):$$PATH"
362 define gb_Helper_prepend_ld_path
363 PATH
="$(shell cygpath -u $(INSTDIR)/$(LIBO_URE_LIB_FOLDER)):$(shell cygpath -u $(INSTDIR)/$(LIBO_BIN_FOLDER)):$(1):$$PATH"
366 # $(1): one directory pathname to append to the ld path
367 define gb_Helper_extend_ld_path
368 $(gb_Helper_set_ld_path
):$(shell cygpath
-u
$(1))
373 # vim: set noet sw=4: