bump product version to 6.3.0.0.beta1
[LibreOffice.git] / solenv / gbuild / platform / com_MSC_class.mk
blob02f7f44d5143ef4af0494483e87fe95c6146e28d
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
22 file:///$(strip $(1))
23 endef
25 # YaccTarget class
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) )
33 endef
35 # CObject class
37 # $(call gb_CObject__command_pattern,object,flags,source,dep-file,compiler-plugins,symbols)
38 define gb_CObject__command_pattern
39 $(call gb_Helper_abbreviate_dirs,\
40 mkdir -p $(dir $(1)) $(dir $(4)) && \
41 unset INCLUDE && \
42 $(if $(filter YES,$(LIBRARY_X64)), $(CXX_X64_BINARY), \
43 $(if $(filter YES,$(PE_X86)), $(CXX_X86_BINARY), \
44 $(if $(filter %.c,$(3)), $(gb_CC), \
45 $(if $(filter -clr,$(2)), \
46 $(MSVC_CXX) -I$(SRCDIR)/solenv/clang-cl,$(gb_CXX))))) \
47 $(DEFS) \
48 $(gb_LTOFLAGS) \
49 $(if $(WARNINGS_DISABLED),$(call gb_Helper_disable_warnings,$(2)),$(2)) \
50 $(if $(EXTERNAL_CODE), \
51 $(if $(filter -clr,$(2)),,$(if $(COM_IS_CLANG),-Wno-undef)), \
52 $(gb_DEFS_INTERNAL)) \
53 $(if $(WARNINGS_NOT_ERRORS),$(if $(ENABLE_WERROR),$(if $(PLUGIN_WARNINGS_AS_ERRORS),$(gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS))),$(gb_CFLAGS_WERROR)) \
54 $(if $(filter -clr,$(2)),,$(if $(5),$(gb_COMPILER_PLUGINS))) \
55 $(if $(COMPILER_TEST),-fsyntax-only -ferror-limit=0 -Xclang -verify) \
56 -Fd$(PDBFILE) \
57 $(PCHFLAGS) \
58 $(if $(COMPILER_TEST),,$(gb_COMPILERDEPFLAGS)) \
59 $(INCLUDE) \
60 $(if $(filter YES,$(LIBRARY_X64)), -U_X86_ -D_AMD64_,) \
61 $(if $(filter YES,$(PE_X86)), -D_X86_ -U_AMD64_,) \
62 -c $(3) \
63 -Fo$(1)) $(if $(filter $(true),$(6)),/link /DEBUG:FASTLINK) \
64 $(if $(COMPILER_TEST),,$(call gb_create_deps,$(4),$(1),$(3)))
65 endef
67 # PrecompiledHeader class
69 gb_PrecompiledHeader_get_enableflags = -Yu$(1).hxx \
70 -FI$(1).hxx \
71 -Fp$(call gb_PrecompiledHeader_get_target,$(1),$(2)) \
72 $(gb_PCHWARNINGS)
74 gb_PrecompiledHeader_EXT := .pch
76 # MSVC PCH needs extra .obj created during the creation of the PCH file
77 gb_PrecompiledHeader_get_objectfile = $(1).obj
79 define gb_PrecompiledHeader__command
80 $(call gb_Output_announce,$(2),$(true),PCH,1)
81 $(call gb_Helper_abbreviate_dirs,\
82 mkdir -p $(dir $(1)) $(dir $(call gb_PrecompiledHeader_get_dep_target,$(2),$(7))) && \
83 unset INCLUDE && \
84 $(gb_CXX) \
85 $(if $(WARNINGS_DISABLED),$(call gb_Helper_disable_warnings,$(4) $(5)),$(4) $(5)) \
86 -Fd$(PDBFILE) \
87 $(if $(EXTERNAL_CODE),$(if $(COM_IS_CLANG),-Wno-undef),$(gb_DEFS_INTERNAL)) \
88 $(gb_LTOFLAGS) \
89 $(gb_COMPILERDEPFLAGS) \
90 $(6) \
91 -c $(3) \
92 -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))
93 endef
95 # No ccache with MSVC, no need to create a checksum for it.
96 define gb_PrecompiledHeader__sum_command
97 endef
99 # AsmObject class
101 gb_AsmObject_get_source = $(1)/$(2).asm
103 define gb_AsmObject__command
104 $(call gb_Output_announce,$(2),$(true),ASM,3)
105 $(call gb_Helper_abbreviate_dirs,\
106 mkdir -p $(dir $(1)) $(dir $(4)) && \
107 "$(ML_EXE)" /safeseh /c /Cp $(gb_AFLAGS) -D$(COM) /Fo$(1) $(3)) && \
108 echo "$(1) : $(3)" > $(4)
109 endef
112 # LinkTarget class
114 gb_LinkTarget_CFLAGS := $(gb_CFLAGS)
115 gb_LinkTarget_CXXFLAGS := $(gb_CXXFLAGS)
116 gb_LinkTarget_CXXCLRFLAGS := $(gb_CXXCLRFLAGS)
118 gb_LinkTarget_INCLUDE :=\
119 $(SOLARINC) \
120 $(foreach inc,$(subst ;, ,$(JDKINC)),-I$(inc)) \
121 -I$(BUILDDIR)/config_$(gb_Side) \
123 # We must name the .pdb like libname.pdb, not libname.\(dll\|exe\|pyd\).pdb,
124 # otherwise WinDbg does not find it.
125 define gb_LinkTarget__get_pdb_filename
126 $(patsubst %.dll,%.pdb,$(patsubst %.exe,%.pdb,$(patsubst %.pyd,%.pdb,$(1))))
127 endef
129 gb_LinkTarget_get_pdbfile_in = \
130 $(WORKDIR)/LinkTarget/$(call gb_LinkTarget__get_workdir_linktargetname,$(1)).objects.pdb
132 gb_LinkTarget_get_pdbfile_out = \
133 $(call gb_LinkTarget__get_pdb_filename,$(WORKDIR)/LinkTarget/$(call gb_LinkTarget__get_workdir_linktargetname,$(1)))
135 gb_LinkTarget_get_ilkfile = \
136 $(WORKDIR)/LinkTarget/$(call gb_LinkTarget__get_workdir_linktargetname,$(1)).ilk
138 gb_LinkTarget_get_manifestfile = \
139 $(WORKDIR)/LinkTarget/$(call gb_LinkTarget__get_workdir_linktargetname,$(1)).manifest
141 gb_LinkTarget_get_linksearchpath_for_layer = \
142 -LIBPATH:$(WORKDIR)/LinkTarget/StaticLibrary \
143 -LIBPATH:$(INSTDIR)/$(SDKDIRNAME)/lib \
144 $(if $(filter OXT,$(1)),\
145 -LIBPATH:$(WORKDIR)/LinkTarget/ExtensionLibrary, \
146 -LIBPATH:$(WORKDIR)/LinkTarget/Library)
148 # avoid fatal error LNK1170 for Library_merged
149 define gb_LinkTarget_MergedResponseFile
150 cat $${RESPONSEFILE} | sed 's/ /\n/g' | grep -v '^$$' > $${RESPONSEFILE}.1 && \
151 mv $${RESPONSEFILE}.1 $${RESPONSEFILE} &&
152 endef
154 MSC_SUBSYSTEM_VERSION=$(COMMA)6.01
156 # the sort on the libraries is used to filter out duplicates to keep commandline
157 # length in check - otherwise the dupes easily hit the limit when linking mergedlib
158 define gb_LinkTarget__command
159 $(call gb_Output_announce,$(2),$(true),LNK,4)
160 $(call gb_Helper_abbreviate_dirs,\
161 rm -f $(1) && \
162 RESPONSEFILE=$(call var2file,$(shell $(gb_MKTEMP)),100, \
163 $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
164 $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
165 $(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
166 $(foreach object,$(GENCOBJECTS),$(call gb_GenCObject_get_target,$(object))) \
167 $(foreach object,$(CXXCLROBJECTS),$(call gb_CxxClrObject_get_target,$(object))) \
168 $(foreach object,$(GENCXXCLROBJECTS),$(call gb_GenCxxClrObject_get_target,$(object))) \
169 $(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_target,$(object))) \
170 $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),$(shell cat $(extraobjectlist))) \
171 $(PCHOBJS) $(NATIVERES)) && \
172 $(if $(filter $(call gb_Library__get_workdir_linktargetname,merged),$(2)),$(call gb_LinkTarget_MergedResponseFile)) \
173 unset INCLUDE && \
174 $(gb_LINK) \
175 $(if $(filter Library CppunitTest,$(TARGETTYPE)),$(gb_Library_TARGETTYPEFLAGS)) \
176 $(if $(filter StaticLibrary,$(TARGETTYPE)),-LIB) \
177 $(if $(filter Executable,$(TARGETTYPE)),$(gb_Executable_TARGETTYPEFLAGS)) \
178 $(if $(T_SYMBOLS),$(if $(filter Executable Library CppunitTest,$(TARGETTYPE)),$(gb_Windows_PE_TARGETTYPEFLAGS_DEBUGINFO)),) \
179 $(if $(filter YES,$(TARGETGUI)), -SUBSYSTEM:WINDOWS$(MSC_SUBSYSTEM_VERSION), -SUBSYSTEM:CONSOLE$(MSC_SUBSYSTEM_VERSION)) \
180 $(if $(filter YES,$(LIBRARY_X64)), -MACHINE:X64) \
181 $(if $(filter YES,$(PE_X86)), -MACHINE:X86) \
182 $(if $(filter YES,$(LIBRARY_X64)), \
183 -LIBPATH:$(COMPATH)/lib/x64 \
184 -LIBPATH:$(WINDOWS_SDK_HOME)/lib/x64 \
185 -LIBPATH:$(UCRTSDKDIR)lib/$(UCRTVERSION)/ucrt/x64 \
186 $(if $(filter 80 81 10,$(WINDOWS_SDK_VERSION)),-LIBPATH:$(WINDOWS_SDK_HOME)/lib/$(WINDOWS_SDK_LIB_SUBDIR)/um/x64)) \
187 $(if $(filter YES,$(PE_X86)), \
188 -LIBPATH:$(COMPATH)/lib/x86 \
189 -LIBPATH:$(WINDOWS_SDK_HOME)/lib/x86 \
190 -LIBPATH:$(UCRTSDKDIR)lib/$(UCRTVERSION)/ucrt/x86 \
191 $(if $(filter 80 81 10,$(WINDOWS_SDK_VERSION)),-LIBPATH:$(WINDOWS_SDK_HOME)/lib/$(WINDOWS_SDK_LIB_SUBDIR)/um/x86)) \
192 $(T_LDFLAGS) \
193 $(if $(filter Library CppunitTest Executable,$(TARGETTYPE)),/NATVIS:$(SRCDIR)/solenv/vs/LibreOffice.natvis) \
194 @$${RESPONSEFILE} \
195 $(foreach lib,$(sort $(LINKED_LIBS)),$(call gb_Library_get_ilibfilename,$(lib))) \
196 $(foreach lib,$(sort $(LINKED_STATIC_LIBS)),$(call gb_StaticLibrary_get_filename,$(lib))) \
197 $(if $(filter-out StaticLibrary,$(TARGETTYPE)),\
198 $(sort $(T_LIBS)) user32.lib \
199 -manifestfile:$(WORKDIR)/LinkTarget/$(2).manifest \
200 -pdb:$(call gb_LinkTarget__get_pdb_filename,$(WORKDIR)/LinkTarget/$(2))) \
201 $(if $(ILIBTARGET),-out:$(1) -implib:$(ILIBTARGET),-out:$(1)); RC=$$?; rm $${RESPONSEFILE} \
202 $(if $(filter Library,$(TARGETTYPE)),; if [ ! -f $(ILIBTARGET) ]; then rm -f $(1); exit 42; fi) \
203 $(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) \
204 $(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) \
205 $(if $(filter Executable,$(TARGETTYPE)),&& mt.exe $(MTFLAGS) -nologo -manifest $(SRCDIR)/solenv/gbuild/platform/DeclareDPIAware.manifest -updateresource:$(1)\;1 ) \
206 $(if $(filter Library,$(TARGETTYPE)),&& \
207 echo $(notdir $(1)) > $(WORKDIR)/LinkTarget/$(2).exports.tmp && \
208 $(gb_LINK) \
209 -dump -exports $(ILIBTARGET) \
210 >> $(WORKDIR)/LinkTarget/$(2).exports.tmp && \
211 $(call gb_Helper_replace_if_different_and_touch,$(WORKDIR)/LinkTarget/$(2).exports.tmp,$(WORKDIR)/LinkTarget/$(2).exports,$(1))) \
212 ; exit $$RC)
213 endef
215 define gb_MSVCRT_subst
216 $(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))
217 endef
219 define gb_LinkTarget_use_system_win32_libs
220 $(call gb_LinkTarget_add_libs,$(1),$(foreach lib,$(2),$(call gb_MSVCRT_subst,$(lib)).lib))
221 $(if $(call gb_LinkTarget__is_merged,$(1)),\
222 $(call gb_LinkTarget_add_libs,$(call gb_Library_get_linktarget,merged),$(foreach lib,$(2),$(call gb_MSVCRT_subst,$(lib)).lib)))
223 endef
225 # Flags common for PE executables (EXEs and DLLs)
226 gb_Windows_PE_TARGETTYPEFLAGS := \
227 -release \
228 -opt:noref \
229 $(if $(filter NO,$(LIBRARY_X64)), -safeseh) \
230 -nxcompat \
231 -dynamicbase \
232 -manifest
234 # link.exe in -LIB mode doesn't understand -debug, use it only for EXEs and DLLs
235 gb_Windows_PE_TARGETTYPEFLAGS_DEBUGINFO := -debug
237 ifeq ($(ENABLE_LTO),TRUE)
238 gb_Windows_PE_TARGETTYPEFLAGS += -LTCG
239 endif
241 # Library class
244 gb_Library_DEFS := -D_DLL
245 gb_Library_TARGETTYPEFLAGS := \
246 -DLL \
247 $(gb_Windows_PE_TARGETTYPEFLAGS)
249 gb_Library_get_rpath :=
251 gb_Library_SYSPRE := i
252 gb_Library_PLAINEXT := .lib
254 gb_Library_LAYER := \
255 $(foreach lib,$(gb_Library_OOOLIBS),$(lib):OOO) \
256 $(foreach lib,$(gb_Library_PLAINLIBS_NONE),$(lib):NONE) \
257 $(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):URELIB) \
258 $(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):OOO) \
259 $(foreach lib,$(gb_Library_PLAINLIBS_OXT),$(lib):OXT) \
260 $(foreach lib,$(gb_Library_PRIVATELIBS_URE),$(lib):URELIB) \
261 $(foreach lib,$(gb_Library_RTVERLIBS),$(lib):URELIB) \
262 $(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):URELIB) \
263 $(foreach lib,$(gb_Library_EXTENSIONLIBS),$(lib):OXT) \
264 $(foreach lib,$(gb_Library_PLAINLIBS_SHLXTHDL),$(lib):SHLXTHDL) \
266 gb_Library_ILIBFILENAMES :=\
267 $(foreach lib,$(gb_Library_KNOWNLIBS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \
269 gb_Library_DLLEXT := .dll
270 gb_Library_UDK_MAJORVER := 3
271 gb_Library_RTEXT := MSC$(gb_Library_DLLEXT)
272 gb_Library_OOOEXT := $(gb_Library_DLLPOSTFIX)$(gb_Library_DLLEXT)
273 gb_Library_UNOEXT := .uno$(gb_Library_DLLEXT)
274 gb_Library_UNOVEREXT := $(gb_Library_UDK_MAJORVER)$(gb_Library_DLLEXT)
275 gb_Library_RTVEREXT := $(gb_Library_UDK_MAJORVER)$(gb_Library_RTEXT)
277 gb_Library_FILENAMES :=\
278 $(foreach lib,$(gb_Library_OOOLIBS),$(lib):$(lib)$(gb_Library_OOOEXT)) \
279 $(foreach lib,$(gb_Library_PLAINLIBS_NONE),$(lib):$(lib)$(gb_Library_DLLEXT)) \
280 $(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):$(lib)$(gb_Library_DLLEXT)) \
281 $(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):$(lib)$(gb_Library_DLLEXT)) \
282 $(foreach lib,$(gb_Library_PLAINLIBS_OXT),$(lib):$(lib)$(gb_Library_DLLEXT)) \
283 $(foreach lib,$(gb_Library_PLAINLIBS_SHLXTHDL),$(lib):$(lib)$(gb_Library_DLLEXT)) \
284 $(foreach lib,$(gb_Library_PRIVATELIBS_URE),$(lib):$(lib)$(gb_Library_OOOEXT)) \
285 $(foreach lib,$(gb_Library_RTVERLIBS),$(lib):$(lib)$(gb_Library_RTVEREXT)) \
286 $(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):$(lib)$(gb_Library_UNOVEREXT)) \
287 $(foreach lib,$(gb_Library_EXTENSIONLIBS),$(lib):$(lib)$(gb_Library_UNOEXT)) \
289 # An assembly is a special kind of library for CLI
290 define gb_Library_Assembly
291 $(call gb_Library_Library,$(1))
292 $(call gb_LinkTarget_get_target,$(call gb_Library_get_linktarget,$(1))) : NATIVERES :=
294 endef
296 define gb_Library_Library_platform
297 $(call gb_LinkTarget_set_ilibtarget,$(2),$(3))
299 $(call gb_LinkTarget_add_auxtargets,$(2),\
300 $(patsubst %.lib,%.exp,$(3)) \
301 $(call gb_LinkTarget_get_manifestfile,$(2)) \
302 $(call gb_LinkTarget_get_pdbfile_in,$(2)) \
303 $(call gb_LinkTarget_get_pdbfile_out,$(2)) \
304 $(call gb_LinkTarget_get_ilkfile,$(2)) \
307 $(call gb_Library_add_default_nativeres,$(1),$(1)/default)
309 $(call gb_LinkTarget_get_target,$(2)) \
310 $(call gb_LinkTarget_get_headers_target,$(2)) : PDBFILE = $(call gb_LinkTarget_get_pdbfile_in,$(2))
312 endef
314 define gb_Library_add_default_nativeres
315 $(call gb_WinResTarget_WinResTarget_init,$(2))
316 $(call gb_WinResTarget_set_rcfile,$(2),include/default)
317 $(call gb_WinResTarget_add_defs,$(2),\
318 -DVERVARIANT="$(LIBO_VERSION_PATCH)" \
319 -DRES_APP_VENDOR="$(OOO_VENDOR)" \
320 -DORG_NAME="$(call gb_Library_get_filename,$(1))"\
321 -DINTERNAL_NAME="$(subst $(gb_Library_DLLEXT),,$(call gb_Library_get_filename,$(1)))" \
322 -DADDITIONAL_VERINFO1="" \
323 -DADDITIONAL_VERINFO2="" \
324 -DADDITIONAL_VERINFO3="" \
326 $(call gb_Library_add_nativeres,$(1),$(2))
327 $(call gb_Library_get_clean_target,$(1)) : $(call gb_WinResTarget_get_clean_target,$(2))
329 endef
331 define gb_LinkTarget_add_nativeres
332 $(call gb_LinkTarget_get_target,$(1)) : $(call gb_WinResTarget_get_target,$(2))
333 $(call gb_LinkTarget_get_target,$(1)) : NATIVERES += $(call gb_WinResTarget_get_target,$(2))
335 endef
337 define gb_LinkTarget_set_nativeres
338 $(call gb_LinkTarget_get_target,$(1)) : $(call gb_WinResTarget_get_target,$(2))
339 $(call gb_LinkTarget_get_target,$(1)) : NATIVERES := $(call gb_WinResTarget_get_target,$(2))
341 endef
343 define gb_Library_get_ilibfilename
344 $(patsubst $(1):%,%,$(filter $(1):%,$(gb_Library_ILIBFILENAMES)))
345 endef
347 gb_Library_get_sdk_link_dir = $(INSTDIR)/$(SDKDIRNAME)/lib
349 gb_Library_get_sdk_link_lib = $(gb_Library_get_ilib_target)
351 # StaticLibrary class
353 gb_StaticLibrary_get_filename = $(1).lib
354 gb_StaticLibrary_PLAINEXT := .lib
356 define gb_StaticLibrary_StaticLibrary_platform
357 $(call gb_LinkTarget_get_target,$(2)) \
358 $(call gb_LinkTarget_get_headers_target,$(2)) : PDBFILE = $(call gb_LinkTarget_get_pdbfile_in,$(2))
360 $(call gb_LinkTarget_add_auxtargets,$(2),\
361 $(call gb_LinkTarget_get_pdbfile_in,$(2)) \
364 endef
366 # Executable class
368 gb_Executable_EXT := .exe
369 gb_Executable_EXT_for_build := .exe
370 gb_Executable_TARGETTYPEFLAGS := $(gb_Windows_PE_TARGETTYPEFLAGS)
372 gb_Executable_get_rpath :=
374 # surprisingly some executables have exports so link.exe creates import lib
375 define gb_Executable_Executable_platform
376 $(call gb_LinkTarget_set_ilibtarget,$(2),$(3))
378 $(call gb_LinkTarget_add_auxtargets,$(2),\
379 $(patsubst %.lib,%.exp,$(3)) \
380 $(call gb_LinkTarget_get_pdbfile_out,$(2)) \
381 $(call gb_LinkTarget_get_pdbfile_in,$(2)) \
382 $(call gb_LinkTarget_get_manifestfile,$(2)) \
385 $(call gb_LinkTarget_get_target,$(2)) \
386 $(call gb_LinkTarget_get_headers_target,$(2)) : PDBFILE := $(call gb_LinkTarget_get_pdbfile_in,$(2))
388 endef
390 # CppunitTest class
392 gb_CppunitTest_UNITTESTFAILED := $(GBUILDDIR)/platform/unittest-failed-WNT.sh
393 gb_CppunitTest_PYTHONDEPS := $(call gb_Package_get_target,python3)
394 gb_CppunitTest_DEFS := -D_DLL
395 ifeq ($(GNUMAKE_WIN_NATIVE),TRUE)
396 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)))
397 else
398 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)))
399 endif
400 gb_CppunitTest_get_filename = test_$(1).dll
401 gb_CppunitTest_get_ilibfilename = itest_$(1).lib
403 define gb_CppunitTest_CppunitTest_platform
404 $(call gb_LinkTarget_set_ilibtarget,$(2),$(3))
406 $(call gb_LinkTarget_add_auxtargets,$(2),\
407 $(patsubst %.lib,%.exp,$(3)) \
408 $(3) \
409 $(call gb_LinkTarget_get_manifestfile,$(2)) \
410 $(call gb_LinkTarget_get_pdbfile_out,$(2)) \
411 $(call gb_LinkTarget_get_pdbfile_in,$(2)) \
412 $(call gb_LinkTarget_get_ilkfile,$(2)) \
415 $(call gb_LinkTarget_get_target,$(2)) \
416 $(call gb_LinkTarget_get_headers_target,$(2)) : PDBFILE = $(call gb_LinkTarget_get_pdbfile_in,$(2))
418 endef
420 # JunitTest class
422 ifneq ($(OOO_TEST_SOFFICE),)
423 gb_JunitTest_SOFFICEARG:=$(OOO_TEST_SOFFICE)
424 else
425 ifneq ($(gb_JunitTest_DEBUGRUN),)
426 gb_JunitTest_SOFFICEARG:=connect:pipe,name=$(USER)
427 else
428 gb_JunitTest_SOFFICEARG:=path:$(INSTROOT)/$(LIBO_BIN_FOLDER)/soffice
429 endif
430 endif
433 define gb_JunitTest_JunitTest_platform
434 $(call gb_JunitTest_get_target,$(1)) : DEFS := \
435 -Dorg.openoffice.test.arg.soffice="$(gb_JunitTest_SOFFICEARG)" \
436 -Dorg.openoffice.test.arg.env=PATH="$$$$PATH" \
437 -Dorg.openoffice.test.arg.user=$(call gb_Helper_make_url,$(call gb_JunitTest_get_userdir,$(1)))
438 -Dorg.openoffice.test.arg.workdir=$(call gb_JunitTest_get_userdir,$(1)) \
440 endef
443 define gb_Module_DEBUGRUNCOMMAND
444 printf "\nAttach the debugger to soffice.bin\n\n"
445 OFFICESCRIPT=`mktemp` && \
446 printf "$(INSTROOT)/$(LIBO_BIN_FOLDER)/soffice.exe" > $${OFFICESCRIPT} && \
447 printf " --norestore --nologo '--accept=pipe,name=$(USER);urp;'\n" >> $${OFFICESCRIPT} && \
448 $(SHELL) $${OFFICESCRIPT} && \
449 rm $${OFFICESCRIPT}
450 endef
455 # PythonTest class
457 gb_PythonTest_PRECOMMAND := $(gb_CppunitTest_CPPTESTPRECOMMAND)
458 gb_PythonTest_DEPS = $(call gb_Package_get_target,python3) $(call gb_Executable_get_target,python)
460 ifeq ($(strip $(CPPUNITTRACE)),TRUE)
461 gb_CppunitTest_GDBTRACE := '$(DEVENV)' /debugexe
462 endif
464 # WinResTarget class
466 gb_WinResTarget_POSTFIX :=.res
468 define gb_WinResTarget__command
469 $(call gb_Output_announce,$(2),$(true),RC ,1)
470 $(call gb_Helper_abbreviate_dirs,\
471 mkdir -p $(dir $(1)) && \
472 $(gb_RC) \
473 $(DEFS) $(FLAGS) \
474 $(INCLUDE) \
475 -Fo$(1) \
476 $(RCFILE) )
477 endef
479 $(eval $(call gb_Helper_make_dep_targets,\
480 WinResTarget \
483 ifeq ($(gb_FULLDEPS),$(true))
484 # FIXME this is used before TargetLocations is read?
485 gb_WinResTarget__command_target = $(WORKDIR)/LinkTarget/Executable/makedepend.exe
486 define gb_WinResTarget__command_dep
487 $(call gb_Output_announce,RC:$(2),$(true),DEP,1)
488 $(call gb_Helper_abbreviate_dirs,\
489 mkdir -p $(dir $(1)) && \
490 $(call gb_Executable_get_target,makedepend) \
491 $(INCLUDE) \
492 $(DEFS) \
493 $(RCFILE) \
494 -o .res \
495 -p $(dir $(3)) \
496 -f $(1))
497 endef
498 else
499 gb_WinResTarget__command_target =
500 gb_WinResTarget__command_dep =
501 endif
503 # InstallModuleTarget class
505 define gb_InstallModuleTarget_InstallModuleTarget_platform
506 $(call gb_InstallModuleTarget_add_defs,$(1),\
507 $(gb_CPUDEFS) \
508 $(gb_OSDEFS) \
509 -DCOMID=MSC \
512 endef
514 # ExternalProject class
516 # Use the gcc wrappers for a autoconf based project
518 # gb_ExternalProject_register_targets project state_target
519 define gb_ExternalProject_use_autoconf
520 $(call gb_ExternalProject_get_preparation_target,$(1)) : $(call gb_Executable_get_runtime_dependencies,gcc-wrapper) \
521 $(call gb_Executable_get_runtime_dependencies,g++-wrapper)
522 $(call gb_ExternalProject_get_state_target,$(1),$(2)): WRAPPERS := $(gb_AUTOCONF_WRAPPERS)
523 endef
525 # Set INCLUDE and LIB variables and unset MAKE/MAKEFLAGS when using nmake
527 # gb_ExternalProject_use_nmake project state_target
528 define gb_ExternalProject_use_nmake
529 $(call gb_ExternalProject_get_state_target,$(1),$(2)): NMAKE := $(gb_NMAKE_VARS)
530 endef
532 # if ccache is enabled, then split it and use lastword as REAL_FOO
533 # /opt/lo/bin/ccache /cygdrive/c/PROGRA~2/MICROS~2.0/VC/bin/cl.exe
535 gb_AUTOCONF_WRAPPERS = \
536 REAL_CC="$(shell cygpath -w $(filter-out -%,$(CC)))" \
537 REAL_CC_FLAGS="$(filter -%,$(CC))" \
538 CC="$(call gb_Executable_get_target,gcc-wrapper)" \
539 REAL_CXX="$(shell cygpath -w $(filter-out -%,$(CXX)))" \
540 REAL_CXX_FLAGS="$(filter -%,$(CXX))" \
541 CXX="$(call gb_Executable_get_target,g++-wrapper)" \
542 LD="$(shell cygpath -w $(COMPATH)/bin/link.exe) -nologo"
544 gb_ExternalProject_INCLUDE := \
545 $(subst -I,,$(subst $(WHITESPACE),;,$(SOLARINC)))
547 gb_NMAKE_VARS = \
548 CC="$(shell cygpath -w $(filter-out -%,$(CC))) $(filter -%,$(CC))" \
549 INCLUDE="$(gb_ExternalProject_INCLUDE)" \
550 LIB="$(ILIB)" \
551 MAKEFLAGS= \
552 MAKE=
554 # InstallScript class
556 gb_InstallScript_EXT := .inf
558 # CliAssemblyTarget class
560 gb_CliAssemblyTarget_POLICYEXT := $(gb_Library_DLLEXT)
561 gb_CliAssemblyTarget_get_dll = $(call gb_Library__get_dir_for_layer,NONE)/$(1)$(gb_CliAssemblyTarget_POLICYEXT)
563 # Extension class
565 gb_Extension_LICENSEFILE_DEFAULT := $(INSTROOT)/license.txt
567 # UnpackedTarget class
569 gb_UnpackedTarget_TARFILE_LOCATION := $(shell cygpath -u $(TARFILE_LOCATION))
571 # UnoApiHeadersTarget class
573 ifeq ($(DISABLE_DYNLOADING),TRUE)
574 gb_UnoApiHeadersTarget_select_variant = $(if $(filter udkapi,$(1)),comprehensive,$(2))
575 else
576 gb_UnoApiHeadersTarget_select_variant = $(2)
577 endif
579 # UIConfig class
581 # use responsefile because cui has too many files for command line
582 define gb_UIConfig__command
583 $(call gb_Helper_abbreviate_dirs,\
584 RESPONSEFILE=$(call var2file,$(shell $(gb_MKTEMP)),100,$(if $(UI_IMAGELISTS),$(strip $(UI_IMAGELISTS)),/dev/null)) \
585 && tr " " "\000" < $$RESPONSEFILE | tr -d "\r\n" > $$RESPONSEFILE.0 \
586 && $(SORT) -u --files0-from=$$RESPONSEFILE.0 > $@ \
587 && rm $$RESPONSEFILE $$RESPONSEFILE.0 \
590 endef
592 # use file list file because swriter has too many files for command line
593 define gb_UIConfig__gla11y_command
594 $(call gb_ExternalExecutale__check_registration,python)
595 $(call gb_Helper_abbreviate_dirs,\
596 FILES=$(call var2file,$(shell $(gb_MKTEMP)),100,$(UIFILES)) && \
597 $(gb_UIConfig_LXML_PATH) $(gb_Helper_set_ld_path) \
598 $(call gb_ExternalExecutable_get_command,python) \
599 $(gb_UIConfig_gla11y_SCRIPT) $(gb_UIConfig_gla11y_PARAMETERS) -o $@ -L $$FILES
602 endef
604 # UIMenubarTarget class
606 define gb_UIMenubarTarget__command
607 $(call gb_Output_announce,$(2),$(true),UIM,1)
608 cp $(3) $(1)
610 endef
612 gb_UIMenubarTarget_UIMenubarTarget_platform :=
614 # Python
615 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"
616 gb_Python_INSTALLED_EXECUTABLE := $(INSTROOT)/$(LIBO_BIN_FOLDER)/python.exe
618 gb_ICU_PRECOMMAND := PATH="$(shell cygpath -w $(WORKDIR_FOR_BUILD)/UnpackedTarball/icu/source/lib)"
620 # vim: set noet sw=4: