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 # Convert path to file URL.
21 define gb_Helper_make_url
27 define gb_YaccTarget__command
28 $(call gb_Output_announce
,$(2),$(true
),YAC
,3)
29 $(call gb_Helper_abbreviate_dirs
,\
30 mkdir
-p
$(dir $(3)) && \
31 $(gb_YACC
) $(T_YACCFLAGS
) --defines
=$(4) -o
$(5) $(1) && touch
$(3) )
37 # $(call gb_CObject__compiler,flags,source)
38 define gb_CObject__compiler
39 $(if
$(filter YES
,$(LIBRARY_X64
)), $(CXX_X64_BINARY
), \
40 $(if
$(filter YES
,$(PE_X86
)), $(CXX_X86_BINARY
), \
41 $(if
$(filter %.c
,$(2)), $(gb_CC
), \
42 $(if
$(filter -clr
,$(1)), \
43 $(MSVC_CXX
) -I
$(SRCDIR
)/solenv
/clang-cl
,$(gb_CXX
)))))
46 # Avoid annoying warning D9025 about overriding command-line arguments.
47 gb_Helper_remove_overriden_flags
= \
48 $(lastword
$(filter -W4
-w
,$(1))) \
49 $(filter-out -W4
-w
-arch
:SSE
-arch
:SSE2
-arch
:AVX
-arch
:AVX2
-Od
-O2
,$(1)) \
50 $(lastword
$(filter -Od
-O2
,$(1))) \
51 $(lastword
$(filter -arch
:SSE
-arch
:SSE2
-arch
:AVX
-arch
:AVX2
,$(1)))
53 # $(call gb_CObject__command_pattern,object,flags,source,dep-file,compiler-plugins,symbols)
54 define gb_CObject__command_pattern
55 $(call gb_Helper_abbreviate_dirs
,\
56 mkdir
-p
$(dir $(1)) $(dir $(4)) && \
58 $(filter-out -arch
:SSE
,$(call gb_CObject__compiler
,$(2),$(3))) \
61 $(call gb_Helper_remove_overriden_flags
,$(filter -arch
:SSE
,$(call gb_CObject__compiler
,$(2),$(3))) \
62 $(2) $(if
$(WARNINGS_DISABLED
),$(gb_CXXFLAGS_DISABLE_WARNINGS
))) \
63 $(if
$(EXTERNAL_CODE
), \
64 $(if
$(filter -clr
,$(2)),,$(if
$(COM_IS_CLANG
),-Wno-undef
)), \
65 $(gb_DEFS_INTERNAL
)) \
66 $(if
$(WARNINGS_NOT_ERRORS
),$(if
$(ENABLE_WERROR
),$(if
$(PLUGIN_WARNINGS_AS_ERRORS
),$(gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS
))),$(gb_CFLAGS_WERROR
)) \
67 $(if
$(filter -clr
,$(2)),,$(if
$(5),$(gb_COMPILER_PLUGINS
))) \
68 $(if
$(COMPILER_TEST
),-fsyntax-only
-ferror-limit
=0 -Xclang
-verify
) \
71 $(if
$(COMPILER_TEST
),,$(gb_COMPILERDEPFLAGS
)) \
73 $(if
$(filter YES
,$(LIBRARY_X64
)), -U_X86_
-D_AMD64_
,) \
74 $(if
$(filter YES
,$(PE_X86
)), -D_X86_
-U_AMD64_
,) \
76 -Fo
$(1)) $(if
$(filter $(true
),$(6)),/link
/DEBUG
:FASTLINK
) \
77 $(if
$(COMPILER_TEST
),,$(call gb_create_deps
,$(4),$(1),$(3)))
80 # PrecompiledHeader class
82 gb_PrecompiledHeader_get_enableflags
= -Yu
$(1).hxx \
84 -Fp
$(call gb_PrecompiledHeader_get_target
,$(1),$(2)) \
87 gb_PrecompiledHeader_EXT
:= .pch
89 # MSVC PCH needs extra .obj created during the creation of the PCH file
90 gb_PrecompiledHeader_get_objectfile
= $(1).obj
92 define gb_PrecompiledHeader__command
93 $(call gb_Output_announce
,$(2),$(true
),PCH
,1)
94 $(call gb_Helper_abbreviate_dirs
,\
95 mkdir
-p
$(dir $(1)) $(dir $(call gb_PrecompiledHeader_get_dep_target
,$(2),$(7))) && \
97 $(filter-out -arch
:SSE
,$(call gb_CObject__compiler
,$(4) $(5),$(3))) \
98 $(call gb_Helper_remove_overriden_flags
,$(filter -arch
:SSE
,$(call gb_CObject__compiler
,$(4) $(5),$(3))) \
99 $(4) $(5) $(if
$(WARNINGS_DISABLED
),$(gb_CXXFLAGS_DISABLE_WARNINGS
))) \
101 $(if
$(EXTERNAL_CODE
),$(if
$(COM_IS_CLANG
),-Wno-undef
),$(gb_DEFS_INTERNAL
)) \
103 $(gb_COMPILERDEPFLAGS
) \
106 -Yc
$(notdir $(patsubst %.
cxx,%.hxx
,$(3))) -Fp
$(1) -Fo
$(1).obj
) $(call gb_create_deps
,$(call gb_PrecompiledHeader_get_dep_target_tmp
,$(2),$(7)),$(1),$(3))
109 # No ccache with MSVC, no need to create a checksum for it.
110 define gb_PrecompiledHeader__sum_command
113 # When building a PCH, MSVC also creates a .pdb file with debug info. So for reuse
114 # add the .pdb to the PCH's files and then use the .pdb also for linktargets that reuse the PCH.
115 # call gb_PrecompiledHeader__create_reuse_files,linktarget,pchtarget,linktargetmakefilename
116 define gb_PrecompiledHeader__create_reuse_files
117 rm -f
$(call gb_PrecompiledHeader_get_target
,$(2),$(3)).pdb
; \
118 if
test -f
$(call gb_LinkTarget_get_pdbfile_in
,$(1)); then \
119 cp
$(call gb_LinkTarget_get_pdbfile_in
,$(1)) $(call gb_PrecompiledHeader_get_target
,$(2),$(3)).pdb
; \
123 # call gb_PrecompiledHeader__copy_reuse_files,linktarget,pchtarget,linktargetmakefilename
124 define gb_PrecompiledHeader__copy_reuse_files
125 rm -f
$(call gb_LinkTarget_get_pdbfile_in
,$(1)); \
126 if
test -f
$(call gb_PrecompiledHeader_get_target
,$(2),$(3)).pdb
; then \
127 cp
$(call gb_PrecompiledHeader_get_target
,$(2),$(3)).pdb
$(call gb_LinkTarget_get_pdbfile_in
,$(1)); \
133 gb_AsmObject_get_source
= $(1)/$(2).asm
135 define gb_AsmObject__command
136 $(call gb_Output_announce
,$(2),$(true
),ASM
,3)
137 $(call gb_Helper_abbreviate_dirs
,\
138 mkdir
-p
$(dir $(1)) $(dir $(4)) && \
139 "$(ML_EXE)" /safeseh
/c
/Cp
$(gb_AFLAGS
) -D
$(COM
) /Fo
$(1) $(3)) && \
140 echo
"$(1) : $(3)" > $(4)
146 gb_LinkTarget_CFLAGS
:= $(gb_CFLAGS
)
147 gb_LinkTarget_CXXFLAGS
:= $(gb_CXXFLAGS
)
148 gb_LinkTarget_CXXCLRFLAGS
:= $(gb_CXXCLRFLAGS
)
150 gb_LinkTarget_INCLUDE
:=\
152 $(foreach inc
,$(subst ;, ,$(JDKINC
)),-I
$(inc
)) \
153 -I
$(BUILDDIR
)/config_
$(gb_Side
) \
155 # We must name the .pdb like libname.pdb, not libname.\(dll\|exe\|pyd\).pdb,
156 # otherwise WinDbg does not find it.
157 define gb_LinkTarget__get_pdb_filename
158 $(patsubst %.dll
,%.pdb
,$(patsubst %.exe
,%.pdb
,$(patsubst %.bin
,%.bin.pdb
,$(patsubst %.pyd
,%.pdb
,$(1)))))
161 gb_LinkTarget_get_pdbfile_in
= \
162 $(WORKDIR
)/LinkTarget
/$(call gb_LinkTarget__get_workdir_linktargetname
,$(1)).objects.pdb
164 gb_LinkTarget_get_pdbfile_out
= \
165 $(call gb_LinkTarget__get_pdb_filename
,$(WORKDIR
)/LinkTarget
/$(call gb_LinkTarget__get_workdir_linktargetname
,$(1)))
167 gb_LinkTarget_get_ilkfile
= \
168 $(WORKDIR
)/LinkTarget
/$(call gb_LinkTarget__get_workdir_linktargetname
,$(1)).ilk
170 gb_LinkTarget_get_manifestfile
= \
171 $(WORKDIR
)/LinkTarget
/$(call gb_LinkTarget__get_workdir_linktargetname
,$(1)).manifest
173 gb_LinkTarget_get_linksearchpath_for_layer
= \
174 -LIBPATH
:$(WORKDIR
)/LinkTarget
/StaticLibrary \
175 -LIBPATH
:$(INSTDIR
)/$(SDKDIRNAME
)/lib \
176 $(if
$(filter OXT
,$(1)),\
177 -LIBPATH
:$(WORKDIR
)/LinkTarget
/ExtensionLibrary
, \
178 -LIBPATH
:$(WORKDIR
)/LinkTarget
/Library
)
180 # avoid fatal error LNK1170 for Library_merged
181 define gb_LinkTarget_MergedResponseFile
182 cat
$${RESPONSEFILE} | sed
's/ /\n/g' | grep
-v
'^$$' > $${RESPONSEFILE}.1 && \
183 mv
$${RESPONSEFILE}.1 $${RESPONSEFILE} &&
186 MSC_SUBSYSTEM_VERSION
=$(COMMA
)6.01
188 # the sort on the libraries is used to filter out duplicates to keep commandline
189 # length in check - otherwise the dupes easily hit the limit when linking mergedlib
190 define gb_LinkTarget__command
191 $(call gb_Output_announce
,$(2),$(true
),LNK
,4)
192 $(call gb_Helper_abbreviate_dirs
,\
194 RESPONSEFILE
=$(call var2file
,$(shell $(gb_MKTEMP
)),100, \
195 $(foreach object
,$(CXXOBJECTS
),$(call gb_CxxObject_get_target
,$(object
))) \
196 $(foreach object
,$(GENCXXOBJECTS
),$(call gb_GenCxxObject_get_target
,$(object
))) \
197 $(foreach object
,$(COBJECTS
),$(call gb_CObject_get_target
,$(object
))) \
198 $(foreach object
,$(GENCOBJECTS
),$(call gb_GenCObject_get_target
,$(object
))) \
199 $(foreach object
,$(CXXCLROBJECTS
),$(call gb_CxxClrObject_get_target
,$(object
))) \
200 $(foreach object
,$(GENCXXCLROBJECTS
),$(call gb_GenCxxClrObject_get_target
,$(object
))) \
201 $(foreach object
,$(ASMOBJECTS
),$(call gb_AsmObject_get_target
,$(object
))) \
202 $(foreach extraobjectlist
,$(EXTRAOBJECTLISTS
),$(shell cat
$(extraobjectlist
))) \
203 $(PCHOBJS
) $(NATIVERES
)) && \
204 $(if
$(filter $(call gb_Library__get_workdir_linktargetname
,merged
),$(2)),$(call gb_LinkTarget_MergedResponseFile
)) \
207 $(if
$(filter Library CppunitTest
,$(TARGETTYPE
)),$(gb_Library_TARGETTYPEFLAGS
)) \
208 $(if
$(filter StaticLibrary
,$(TARGETTYPE
)),-LIB
) \
209 $(if
$(filter Executable
,$(TARGETTYPE
)),$(gb_Executable_TARGETTYPEFLAGS
)) \
210 $(if
$(T_SYMBOLS
),$(if
$(filter Executable Library CppunitTest
,$(TARGETTYPE
)),$(gb_Windows_PE_TARGETTYPEFLAGS_DEBUGINFO
)),) \
211 $(if
$(filter YES
,$(TARGETGUI
)), -SUBSYSTEM
:WINDOWS
$(MSC_SUBSYSTEM_VERSION
), -SUBSYSTEM
:CONSOLE
$(MSC_SUBSYSTEM_VERSION
)) \
212 $(if
$(filter YES
,$(LIBRARY_X64
)), -MACHINE
:X64
) \
213 $(if
$(filter YES
,$(PE_X86
)), -MACHINE
:X86
) \
214 $(if
$(filter YES
,$(LIBRARY_X64
)), \
215 -LIBPATH
:$(COMPATH
)/lib
/x64 \
216 -LIBPATH
:$(WINDOWS_SDK_HOME
)/lib
/x64 \
217 -LIBPATH
:$(UCRTSDKDIR
)lib
/$(UCRTVERSION
)/ucrt
/x64 \
218 $(if
$(filter 80 81 10,$(WINDOWS_SDK_VERSION
)),-LIBPATH
:$(WINDOWS_SDK_HOME
)/lib
/$(WINDOWS_SDK_LIB_SUBDIR
)/um
/x64
)) \
219 $(if
$(filter YES
,$(PE_X86
)), \
220 -LIBPATH
:$(COMPATH
)/lib
/x86 \
221 -LIBPATH
:$(WINDOWS_SDK_HOME
)/lib
/x86 \
222 -LIBPATH
:$(UCRTSDKDIR
)lib
/$(UCRTVERSION
)/ucrt
/x86 \
223 $(if
$(filter 80 81 10,$(WINDOWS_SDK_VERSION
)),-LIBPATH
:$(WINDOWS_SDK_HOME
)/lib
/$(WINDOWS_SDK_LIB_SUBDIR
)/um
/x86
)) \
225 $(if
$(filter Library CppunitTest Executable
,$(TARGETTYPE
)),/NATVIS
:$(SRCDIR
)/solenv
/vs
/LibreOffice.natvis
) \
227 $(foreach lib
,$(sort $(LINKED_LIBS
)),$(call gb_Library_get_ilibfilename
,$(lib
))) \
228 $(foreach lib
,$(sort $(LINKED_STATIC_LIBS
)),$(call gb_StaticLibrary_get_filename
,$(lib
))) \
229 $(if
$(filter-out StaticLibrary
,$(TARGETTYPE
)),\
230 $(sort $(T_LIBS
)) user32.lib \
231 -manifestfile
:$(WORKDIR
)/LinkTarget
/$(2).manifest \
232 -pdb
:$(call gb_LinkTarget__get_pdb_filename
,$(WORKDIR
)/LinkTarget
/$(2))) \
233 $(if
$(ILIBTARGET
),-out
:$(1) -implib
:$(ILIBTARGET
),-out
:$(1)) \
234 | LC_ALL
=C
$(GBUILDDIR
)/platform
/filter-creatingLibrary.awk
; RC
=$${PIPESTATUS
[0]}; rm $${RESPONSEFILE} \
235 $(if
$(filter Library
,$(TARGETTYPE
)),; if
[ ! -f
$(ILIBTARGET
) ]; then
rm -f
$(1); exit
42; fi
) \
236 $(if
$(filter Library
,$(TARGETTYPE
)),&& if
[ -f
$(WORKDIR
)/LinkTarget
/$(2).manifest
]; then mt.exe
$(MTFLAGS
) -nologo
-manifest
$(WORKDIR
)/LinkTarget
/$(2).manifest
$(SRCDIR
)/solenv
/gbuild
/platform
/win_compatibility.manifest
-outputresource
:$(1)\
;2 && touch
-r
$(1) $(WORKDIR
)/LinkTarget
/$(2).manifest
$(ILIBTARGET
); fi
) \
237 $(if
$(filter Executable
,$(TARGETTYPE
)),&& if
[ -f
$(WORKDIR
)/LinkTarget
/$(2).manifest
]; then mt.exe
$(MTFLAGS
) -nologo
-manifest
$(WORKDIR
)/LinkTarget
/$(2).manifest
$(SRCDIR
)/solenv
/gbuild
/platform
/win_compatibility.manifest
-outputresource
:$(1)\
;1 && touch
-r
$(1) $(WORKDIR
)/LinkTarget
/$(2).manifest
; fi
) \
238 $(if
$(filter Executable
,$(TARGETTYPE
)),&& mt.exe
$(MTFLAGS
) -nologo
-manifest
$(SRCDIR
)/solenv
/gbuild
/platform
/DeclareDPIAware.manifest
-updateresource
:$(1)\
;1 ) \
239 $(if
$(filter Library
,$(TARGETTYPE
)),&& \
240 echo
$(notdir $(1)) > $(WORKDIR
)/LinkTarget
/$(2).exports.tmp
&& \
242 -dump
-exports
$(ILIBTARGET
) \
243 >> $(WORKDIR
)/LinkTarget
/$(2).exports.tmp
&& \
244 $(call gb_Helper_replace_if_different_and_touch
,$(WORKDIR
)/LinkTarget
/$(2).exports.tmp
,$(WORKDIR
)/LinkTarget
/$(2).exports
,$(1))) \
248 define gb_MSVCRT_subst
249 $(if
$(MSVC_USE_DEBUG_RUNTIME
),$(subst msvcrt
,msvcrtd
,$(subst msvcprt
,msvcprtd
,$(subst libcmt
,libcmtd
,$(subst libvcruntime
,libvcruntimed
,$(subst libucrt
,libucrtd
,$(subst libcpmt
,libcpmtd
,$(subst msvcmrt
,msvcmrtd
,$(1)))))))),$(1))
252 define gb_LinkTarget_use_system_win32_libs
253 $(call gb_LinkTarget_add_libs
,$(1),$(foreach lib
,$(2),$(call gb_MSVCRT_subst
,$(lib
)).lib
))
254 $(if
$(call gb_LinkTarget__is_merged
,$(1)),\
255 $(call gb_LinkTarget_add_libs
,$(call gb_Library_get_linktarget
,merged
),$(foreach lib
,$(2),$(call gb_MSVCRT_subst
,$(lib
)).lib
)))
258 # Flags common for PE executables (EXEs and DLLs)
259 gb_Windows_PE_TARGETTYPEFLAGS
:= \
262 $(if
$(filter NO
,$(LIBRARY_X64
)), -safeseh
) \
267 # link.exe in -LIB mode doesn't understand -debug, use it only for EXEs and DLLs
268 gb_Windows_PE_TARGETTYPEFLAGS_DEBUGINFO
:= -debug
270 ifeq ($(ENABLE_LTO
),TRUE
)
271 gb_Windows_PE_TARGETTYPEFLAGS
+= -LTCG
277 gb_Library_DEFS
:= -D_DLL
278 gb_Library_TARGETTYPEFLAGS
:= \
280 $(gb_Windows_PE_TARGETTYPEFLAGS
)
282 gb_Library_get_rpath
:=
284 gb_Library_SYSPRE
:= i
285 gb_Library_PLAINEXT
:= .lib
287 gb_Library_LAYER
:= \
288 $(foreach lib
,$(gb_Library_OOOLIBS
),$(lib
):OOO
) \
289 $(foreach lib
,$(gb_Library_PLAINLIBS_NONE
),$(lib
):NONE
) \
290 $(foreach lib
,$(gb_Library_PLAINLIBS_URE
),$(lib
):URELIB
) \
291 $(foreach lib
,$(gb_Library_PLAINLIBS_OOO
),$(lib
):OOO
) \
292 $(foreach lib
,$(gb_Library_PLAINLIBS_OXT
),$(lib
):OXT
) \
293 $(foreach lib
,$(gb_Library_PRIVATELIBS_URE
),$(lib
):URELIB
) \
294 $(foreach lib
,$(gb_Library_RTVERLIBS
),$(lib
):URELIB
) \
295 $(foreach lib
,$(gb_Library_UNOVERLIBS
),$(lib
):URELIB
) \
296 $(foreach lib
,$(gb_Library_EXTENSIONLIBS
),$(lib
):OXT
) \
297 $(foreach lib
,$(gb_Library_PLAINLIBS_SHLXTHDL
),$(lib
):SHLXTHDL
) \
299 gb_Library_ILIBFILENAMES
:=\
300 $(foreach lib
,$(gb_Library_KNOWNLIBS
),$(lib
):$(gb_Library_SYSPRE
)$(lib
)$(gb_Library_PLAINEXT
)) \
302 gb_Library_DLLEXT
:= .dll
303 gb_Library_UDK_MAJORVER
:= 3
304 gb_Library_RTEXT
:= MSC
$(gb_Library_DLLEXT
)
305 gb_Library_OOOEXT
:= $(gb_Library_DLLPOSTFIX
)$(gb_Library_DLLEXT
)
306 gb_Library_UNOEXT
:= .uno
$(gb_Library_DLLEXT
)
307 gb_Library_UNOVEREXT
:= $(gb_Library_UDK_MAJORVER
)$(gb_Library_DLLEXT
)
308 gb_Library_RTVEREXT
:= $(gb_Library_UDK_MAJORVER
)$(gb_Library_RTEXT
)
310 gb_Library_FILENAMES
:=\
311 $(foreach lib
,$(gb_Library_OOOLIBS
),$(lib
):$(lib
)$(gb_Library_OOOEXT
)) \
312 $(foreach lib
,$(gb_Library_PLAINLIBS_NONE
),$(lib
):$(lib
)$(gb_Library_DLLEXT
)) \
313 $(foreach lib
,$(gb_Library_PLAINLIBS_URE
),$(lib
):$(lib
)$(gb_Library_DLLEXT
)) \
314 $(foreach lib
,$(gb_Library_PLAINLIBS_OOO
),$(lib
):$(lib
)$(gb_Library_DLLEXT
)) \
315 $(foreach lib
,$(gb_Library_PLAINLIBS_OXT
),$(lib
):$(lib
)$(gb_Library_DLLEXT
)) \
316 $(foreach lib
,$(gb_Library_PLAINLIBS_SHLXTHDL
),$(lib
):$(lib
)$(gb_Library_DLLEXT
)) \
317 $(foreach lib
,$(gb_Library_PRIVATELIBS_URE
),$(lib
):$(lib
)$(gb_Library_OOOEXT
)) \
318 $(foreach lib
,$(gb_Library_RTVERLIBS
),$(lib
):$(lib
)$(gb_Library_RTVEREXT
)) \
319 $(foreach lib
,$(gb_Library_UNOVERLIBS
),$(lib
):$(lib
)$(gb_Library_UNOVEREXT
)) \
320 $(foreach lib
,$(gb_Library_EXTENSIONLIBS
),$(lib
):$(lib
)$(gb_Library_UNOEXT
)) \
322 # An assembly is a special kind of library for CLI
323 define gb_Library_Assembly
324 $(call gb_Library_Library
,$(1))
325 $(call gb_LinkTarget_get_target
,$(call gb_Library_get_linktarget
,$(1))) : NATIVERES
:=
329 define gb_Library_Library_platform
330 $(call gb_LinkTarget_set_ilibtarget
,$(2),$(3))
332 $(call gb_LinkTarget_add_auxtargets
,$(2),\
333 $(patsubst %.lib
,%.exp
,$(3)) \
334 $(call gb_LinkTarget_get_manifestfile
,$(2)) \
335 $(call gb_LinkTarget_get_pdbfile_in
,$(2)) \
336 $(call gb_LinkTarget_get_pdbfile_out
,$(2)) \
337 $(call gb_LinkTarget_get_ilkfile
,$(2)) \
340 $(call gb_Library_add_default_nativeres
,$(1),$(1)/default
)
342 $(call gb_LinkTarget_get_target
,$(2)) \
343 $(call gb_LinkTarget_get_headers_target
,$(2)) : PDBFILE
= $(call gb_LinkTarget_get_pdbfile_in
,$(2))
347 define gb_Library_add_default_nativeres
348 $(call gb_WinResTarget_WinResTarget_init
,$(2))
349 $(call gb_WinResTarget_set_rcfile
,$(2),include/default
)
350 $(call gb_WinResTarget_add_defs
,$(2),\
351 -DVERVARIANT
="$(LIBO_VERSION_PATCH)" \
352 -DRES_APP_VENDOR
="$(OOO_VENDOR)" \
353 -DORG_NAME
="$(call gb_Library_get_filename,$(1))"\
354 -DINTERNAL_NAME
="$(subst $(gb_Library_DLLEXT),,$(call gb_Library_get_filename,$(1)))" \
355 -DADDITIONAL_VERINFO1
="" \
356 -DADDITIONAL_VERINFO2
="" \
357 -DADDITIONAL_VERINFO3
="" \
359 $(call gb_Library_add_nativeres
,$(1),$(2))
360 $(call gb_Library_get_clean_target
,$(1)) : $(call gb_WinResTarget_get_clean_target
,$(2))
364 define gb_Executable_add_default_nativeres
365 $(call gb_WinResTarget_WinResTarget_init
,$(1)/default
)
366 $(call gb_WinResTarget_set_rcfile
,$(1)/default
,include/default
)
367 $(call gb_WinResTarget_add_defs
,$(1)/default
,\
368 -DVERVARIANT
="$(LIBO_VERSION_PATCH)" \
369 -DRES_APP_VENDOR
="$(OOO_VENDOR)" \
370 -DORG_NAME
="$(call gb_Executable_get_filename,$(1))"\
371 -DINTERNAL_NAME
="$(subst $(gb_Executable_EXT),,$(call gb_Executable_get_filename,$(1)))" \
372 -DADDITIONAL_VERINFO1
="$(if $(2),VALUE \"FileDescription\"$(COMMA) \"$(2)\\0\")" \
373 -DADDITIONAL_VERINFO2
="" \
374 -DADDITIONAL_VERINFO3
="" \
376 $(call gb_Executable_add_nativeres
,$(1),$(1)/default
)
377 $(call gb_Executable_get_clean_target
,$(1)) : $(call gb_WinResTarget_get_clean_target
,$(1)/default
)
381 define gb_LinkTarget_add_nativeres
382 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_WinResTarget_get_target
,$(2))
383 $(call gb_LinkTarget_get_target
,$(1)) : NATIVERES
+= $(call gb_WinResTarget_get_target
,$(2))
387 define gb_LinkTarget_set_nativeres
388 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_WinResTarget_get_target
,$(2))
389 $(call gb_LinkTarget_get_target
,$(1)) : NATIVERES
:= $(call gb_WinResTarget_get_target
,$(2))
393 define gb_Library_get_ilibfilename
394 $(patsubst $(1):%,%,$(filter $(1):%,$(gb_Library_ILIBFILENAMES
)))
397 gb_Library_get_sdk_link_dir
= $(INSTDIR
)/$(SDKDIRNAME
)/lib
399 gb_Library_get_sdk_link_lib
= $(gb_Library_get_ilib_target
)
401 # StaticLibrary class
403 gb_StaticLibrary_get_filename
= $(1).lib
404 gb_StaticLibrary_PLAINEXT
:= .lib
406 define gb_StaticLibrary_StaticLibrary_platform
407 $(call gb_LinkTarget_get_target
,$(2)) \
408 $(call gb_LinkTarget_get_headers_target
,$(2)) : PDBFILE
= $(call gb_LinkTarget_get_pdbfile_in
,$(2))
410 $(call gb_LinkTarget_add_auxtargets
,$(2),\
411 $(call gb_LinkTarget_get_pdbfile_in
,$(2)) \
418 gb_Executable_EXT
:= .exe
419 gb_Executable_EXT_for_build
:= .exe
420 gb_Executable_TARGETTYPEFLAGS
:= $(gb_Windows_PE_TARGETTYPEFLAGS
)
422 gb_Executable_get_rpath
:=
424 # surprisingly some executables have exports so link.exe creates import lib
425 define gb_Executable_Executable_platform
426 $(call gb_LinkTarget_set_ilibtarget
,$(2),$(3))
428 $(call gb_LinkTarget_add_auxtargets
,$(2),\
429 $(patsubst %.lib
,%.exp
,$(3)) \
430 $(call gb_LinkTarget_get_pdbfile_out
,$(2)) \
431 $(call gb_LinkTarget_get_pdbfile_in
,$(2)) \
432 $(call gb_LinkTarget_get_manifestfile
,$(2)) \
435 $(call gb_LinkTarget_get_target
,$(2)) \
436 $(call gb_LinkTarget_get_headers_target
,$(2)) : PDBFILE
:= $(call gb_LinkTarget_get_pdbfile_in
,$(2))
442 gb_CppunitTest_UNITTESTFAILED
:= $(GBUILDDIR
)/platform
/unittest-failed-WNT.sh
443 gb_CppunitTest_PYTHONDEPS
:= $(call gb_Package_get_target
,python3
)
444 gb_CppunitTest_DEFS
:= -D_DLL
445 ifeq ($(GNUMAKE_WIN_NATIVE
),TRUE
)
446 gb_CppunitTest_CPPTESTPRECOMMAND
:= $(call gb_Helper_prepend_ld_path
,$(shell cygpath
-w
$(gb_Library_DLLDIR
));$(shell cygpath
-w
$(WORKDIR
)/UnpackedTarball
/cppunit
/src
/cppunit
/$(if
$(MSVC_USE_DEBUG_RUNTIME
),DebugDll
,ReleaseDll
)))
448 gb_CppunitTest_CPPTESTPRECOMMAND
:= $(call gb_Helper_prepend_ld_path
,$(shell cygpath
-u
$(gb_Library_DLLDIR
)):$(shell cygpath
-u
$(WORKDIR
)/UnpackedTarball
/cppunit
/src
/cppunit
/$(if
$(MSVC_USE_DEBUG_RUNTIME
),DebugDll
,ReleaseDll
)))
450 gb_CppunitTest_get_filename
= test_
$(1).dll
451 gb_CppunitTest_get_ilibfilename
= itest_
$(1).lib
453 define gb_CppunitTest_CppunitTest_platform
454 $(call gb_LinkTarget_set_ilibtarget
,$(2),$(3))
456 $(call gb_LinkTarget_add_auxtargets
,$(2),\
457 $(patsubst %.lib
,%.exp
,$(3)) \
459 $(call gb_LinkTarget_get_manifestfile
,$(2)) \
460 $(call gb_LinkTarget_get_pdbfile_out
,$(2)) \
461 $(call gb_LinkTarget_get_pdbfile_in
,$(2)) \
462 $(call gb_LinkTarget_get_ilkfile
,$(2)) \
465 $(call gb_LinkTarget_get_target
,$(2)) \
466 $(call gb_LinkTarget_get_headers_target
,$(2)) : PDBFILE
= $(call gb_LinkTarget_get_pdbfile_in
,$(2))
472 ifneq ($(OOO_TEST_SOFFICE
),)
473 gb_JunitTest_SOFFICEARG
:=$(OOO_TEST_SOFFICE
)
475 ifneq ($(gb_JunitTest_DEBUGRUN
),)
476 gb_JunitTest_SOFFICEARG
:=connect
:pipe
,name
=$(USER
)
478 gb_JunitTest_SOFFICEARG
:=path
:$(INSTROOT
)/$(LIBO_BIN_FOLDER
)/soffice
483 define gb_JunitTest_JunitTest_platform
484 $(call gb_JunitTest_get_target
,$(1)) : DEFS
:= \
485 -Dorg.openoffice.
test.arg.soffice
="$(gb_JunitTest_SOFFICEARG)" \
486 -Dorg.openoffice.
test.arg.env
=PATH
="$$$$PATH" \
487 -Dorg.openoffice.
test.arg.user
=$(call gb_Helper_make_url
,$(call gb_JunitTest_get_userdir
,$(1)))
488 -Dorg.openoffice.
test.arg.workdir
=$(call gb_JunitTest_get_userdir
,$(1)) \
493 define gb_Module_DEBUGRUNCOMMAND
494 printf
"\nAttach the debugger to soffice.bin\n\n"
495 OFFICESCRIPT
=`mktemp` && \
496 printf
"$(INSTROOT)/$(LIBO_BIN_FOLDER)/soffice.exe" > $${OFFICESCRIPT} && \
497 printf
" --norestore --nologo '--accept=pipe,name=$(USER);urp;'\n" >> $${OFFICESCRIPT} && \
498 $(SHELL
) $${OFFICESCRIPT} && \
507 gb_PythonTest_PRECOMMAND
:= $(gb_CppunitTest_CPPTESTPRECOMMAND
)
508 gb_PythonTest_DEPS
= $(call gb_Package_get_target
,python3
) $(call gb_Executable_get_target
,python
)
510 ifeq ($(strip $(CPPUNITTRACE
)),TRUE
)
511 gb_CppunitTest_GDBTRACE
:= '$(DEVENV)' /debugexe
516 gb_WinResTarget_POSTFIX
:=.res
518 define gb_WinResTarget__command
519 $(call gb_Output_announce
,$(2),$(true
),RC
,1)
520 $(call gb_Helper_abbreviate_dirs
,\
521 mkdir
-p
$(dir $(1)) && \
529 $(eval
$(call gb_Helper_make_dep_targets
,\
533 ifeq ($(gb_FULLDEPS
),$(true
))
534 # FIXME this is used before TargetLocations is read?
535 gb_WinResTarget__command_target
= $(WORKDIR
)/LinkTarget
/Executable
/makedepend.exe
536 define gb_WinResTarget__command_dep
537 $(call gb_Output_announce
,RC
:$(2),$(true
),DEP
,1)
538 $(call gb_Helper_abbreviate_dirs
,\
539 mkdir
-p
$(dir $(1)) && \
540 $(call gb_Executable_get_target
,makedepend
) \
549 gb_WinResTarget__command_target
=
550 gb_WinResTarget__command_dep
=
553 # InstallModuleTarget class
555 define gb_InstallModuleTarget_InstallModuleTarget_platform
556 $(call gb_InstallModuleTarget_add_defs
,$(1),\
564 # ExternalProject class
566 # Use the gcc wrappers for an autoconf based project
568 # gb_ExternalProject_register_targets project state_target
569 define gb_ExternalProject_use_autoconf
570 $(call gb_ExternalProject_get_preparation_target
,$(1)) : $(call gb_Executable_get_runtime_dependencies
,gcc-wrapper
) \
571 $(call gb_Executable_get_runtime_dependencies
,g
++-wrapper
)
572 $(call gb_ExternalProject_get_state_target
,$(1),$(2)): WRAPPERS
:= $(gb_AUTOCONF_WRAPPERS
)
575 # Set INCLUDE and LIB variables and unset MAKE/MAKEFLAGS when using nmake
577 # gb_ExternalProject_use_nmake project state_target
578 define gb_ExternalProject_use_nmake
579 $(call gb_ExternalProject_get_state_target
,$(1),$(2)): NMAKE
:= $(gb_NMAKE_VARS
)
582 # if ccache is enabled, then split it and use lastword as REAL_FOO
583 # /opt/lo/bin/ccache /cygdrive/c/PROGRA~2/MICROS~2.0/VC/bin/cl.exe
585 gb_AUTOCONF_WRAPPERS
= \
586 REAL_CC
="$(shell cygpath -w $(filter-out -%,$(CC)))" \
587 REAL_CC_FLAGS
="$(filter -%,$(CC))" \
588 CC
="$(call gb_Executable_get_target,gcc-wrapper)" \
589 REAL_CXX
="$(shell cygpath -w $(filter-out -%,$(CXX)))" \
590 REAL_CXX_FLAGS
="$(filter -%,$(CXX))" \
591 CXX
="$(call gb_Executable_get_target,g++-wrapper)" \
592 LD
="$(shell cygpath -w $(COMPATH)/bin/link.exe) -nologo"
594 gb_ExternalProject_INCLUDE
:= \
595 $(subst -I
,,$(subst $(WHITESPACE
),;,$(SOLARINC
)))
598 CC
="$(shell cygpath -w $(filter-out -%,$(CC))) $(filter -%,$(CC))" \
599 INCLUDE
="$(gb_ExternalProject_INCLUDE)" \
604 # InstallScript class
606 gb_InstallScript_EXT
:= .inf
608 # CliAssemblyTarget class
610 gb_CliAssemblyTarget_POLICYEXT
:= $(gb_Library_DLLEXT
)
611 gb_CliAssemblyTarget_get_dll
= $(call gb_Library__get_dir_for_layer
,NONE
)/$(1)$(gb_CliAssemblyTarget_POLICYEXT
)
615 gb_Extension_LICENSEFILE_DEFAULT
:= $(INSTROOT
)/license.txt
617 # UnpackedTarget class
619 gb_UnpackedTarget_TARFILE_LOCATION
:= $(shell cygpath
-u
$(TARFILE_LOCATION
))
621 # UnoApiHeadersTarget class
623 ifeq ($(DISABLE_DYNLOADING
),TRUE
)
624 gb_UnoApiHeadersTarget_select_variant
= $(if
$(filter udkapi
,$(1)),comprehensive
,$(2))
626 gb_UnoApiHeadersTarget_select_variant
= $(2)
631 # use responsefile because cui has too many files for command line
632 define gb_UIConfig__command
633 $(call gb_Helper_abbreviate_dirs
,\
634 RESPONSEFILE
=$(call var2file
,$(shell $(gb_MKTEMP
)),100,$(if
$(UI_IMAGELISTS
),$(strip $(UI_IMAGELISTS
)),/dev
/null
)) \
635 && tr
" " "\000" < $$RESPONSEFILE | tr
-d
"\r\n" > $$RESPONSEFILE.0 \
636 && $(SORT
) -u
--files0-from
=$$RESPONSEFILE.0 > $@ \
637 && rm $$RESPONSEFILE $$RESPONSEFILE.0 \
642 # use file list file because swriter has too many files for command line
643 define gb_UIConfig__gla11y_command
644 $(call gb_ExternalExecutale__check_registration
,python
)
645 $(call gb_Helper_abbreviate_dirs
,\
646 FILES
=$(call var2file
,$(shell $(gb_MKTEMP
)),100,$(UIFILES
)) && \
647 $(gb_UIConfig_LXML_PATH
) $(if
$(SYSTEM_LIBXML
)$(SYSTEM_LIBXSLT
),,$(gb_Helper_set_ld_path
)) \
648 $(call gb_ExternalExecutable_get_command
,python
) \
649 $(gb_UIConfig_gla11y_SCRIPT
) $(gb_UIConfig_gla11y_PARAMETERS
) -o
$@
-L
$$FILES
654 # UIMenubarTarget class
656 define gb_UIMenubarTarget__command
657 $(call gb_Output_announce
,$(2),$(true
),UIM
,1)
662 gb_UIMenubarTarget_UIMenubarTarget_platform
:=
665 gb_Python_PRECOMMAND
:= PATH
="$(shell cygpath -w $(INSTDIR)/program)" PYTHONHOME
="$(INSTDIR)/program/python-core-$(PYTHON_VERSION)" PYTHONPATH
="$${PYPATH:+$$PYPATH:}$(INSTDIR)/program/python-core-$(PYTHON_VERSION)/lib;$(INSTDIR)/program/python-core-$(PYTHON_VERSION)/lib/lib-dynload:$(INSTDIR)/program"
666 gb_Python_INSTALLED_EXECUTABLE
:= $(INSTROOT
)/$(LIBO_BIN_FOLDER
)/python.exe
668 gb_ICU_PRECOMMAND
:= PATH
="$(shell cygpath -w $(WORKDIR_FOR_BUILD)/UnpackedTarball/icu/source/lib)"
670 # vim: set noet sw=4: