Branch libreoffice-5-0-4
[LibreOffice.git] / solenv / gbuild / platform / com_MSC_class.mk
blobc2b6a7c7b8c613e621e5e18e89d20f4bf3484756
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)
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,$(CXXOBJECT_X64)), $(CXX_X64_BINARY), \
43 $(if $(filter %.c,$(3)), $(gb_CC), $(gb_CXX))) \
44 $(DEFS) \
45 $(if $(EXTERNAL_CODE),,$(gb_DEFS_INTERNAL)) \
46 $(gb_LTOFLAGS) \
47 $(2) \
48 $(if $(WARNINGS_NOT_ERRORS),,$(gb_CFLAGS_WERROR)) \
49 -Fd$(PDBFILE) \
50 $(PCHFLAGS) \
51 $(gb_COMPILERDEPFLAGS) \
52 -I$(dir $(3)) \
53 $(INCLUDE) \
54 $(if $(filter YES,$(CXXOBJECT_X64)), -U_X86_ -D_AMD64_,) \
55 -c $(3) \
56 -Fo$(1)) $(call gb_create_deps,$(4),$(1),$(3))
57 endef
59 # PrecompiledHeader class
61 # Note: MSVC has a race condition when dealing with .pdb files, that can result in error C1033 when
62 # the .pdb file already exists and two cl.exe invocations try to modify it at the same time (which
63 # is apparently most likely when generating both .pch files). The no-exceptions variant should be
64 # rarely needed now, but in case this turns out to be a problem in practice, this will need to
65 # be handled somehow (such as order-dependency of one on another).
67 gb_PrecompiledHeader_get_enableflags = -Yu$(1).hxx \
68 -FI$(1).hxx \
69 -Fp$(call gb_PrecompiledHeader_get_target,$(1)) \
70 $(gb_PCHWARNINGS)
72 # MSVC PCH needs extra .obj created during the creation of the PCH file
73 gb_PrecompiledHeader_get_objectfile = $(1).obj
75 define gb_PrecompiledHeader__command
76 $(call gb_Output_announce,$(2),$(true),PCH,1)
77 $(call gb_Helper_abbreviate_dirs,\
78 mkdir -p $(dir $(1)) $(dir $(call gb_PrecompiledHeader_get_dep_target,$(2))) && \
79 unset INCLUDE && \
80 $(gb_CXX) \
81 $(4) $(5) -Fd$(PDBFILE) \
82 $(if $(EXTERNAL_CODE),,$(gb_DEFS_INTERNAL)) \
83 $(gb_LTOFLAGS) \
84 $(gb_COMPILERDEPFLAGS) \
85 -I$(dir $(3)) \
86 $(6) \
87 -c $(3) \
88 -Yc$(notdir $(patsubst %.cxx,%.hxx,$(3))) -Fp$(1) -Fo$(1).obj) $(call gb_create_deps,$(call gb_PrecompiledHeader_get_dep_target_tmp,$(2)),$(1),$(3))
89 endef
91 # AsmObject class
93 gb_AsmObject_get_source = $(1)/$(2).asm
95 define gb_AsmObject__command
96 $(call gb_Output_announce,$(2),$(true),ASM,3)
97 $(call gb_Helper_abbreviate_dirs,\
98 mkdir -p $(dir $(1)) $(dir $(4)) && \
99 "$(ML_EXE)" /c /Cp $(gb_AFLAGS) -D$(COM) /Fo$(1) $(3)) && \
100 echo "$(1) : $(3)" > $(4)
101 endef
104 # LinkTarget class
106 gb_LinkTarget_CFLAGS := $(gb_CFLAGS)
107 gb_LinkTarget_CXXFLAGS := $(gb_CXXFLAGS)
109 gb_LinkTarget_INCLUDE :=\
110 $(subst -I. , ,$(SOLARINC)) \
111 $(foreach inc,$(subst ;, ,$(JDKINC)),-I$(inc)) \
112 -I$(BUILDDIR)/config_$(gb_Side) \
114 # We must name the .pdb like libname.pdb, not libname.\(dll\|exe\|pyd\).pdb,
115 # otherwise WinDbg does not find it.
116 define gb_LinkTarget__get_pdb_filename
117 $(patsubst %.dll,%.pdb,$(patsubst %.exe,%.pdb,$(patsubst %.pyd,%.pdb,$(1))))
118 endef
120 gb_LinkTarget_get_pdbfile_in = \
121 $(WORKDIR)/LinkTarget/$(call gb_LinkTarget__get_workdir_linktargetname,$(1)).objects.pdb
123 gb_LinkTarget_get_pdbfile_out = \
124 $(call gb_LinkTarget__get_pdb_filename,$(WORKDIR)/LinkTarget/$(call gb_LinkTarget__get_workdir_linktargetname,$(1)))
126 gb_LinkTarget_get_ilkfile = \
127 $(WORKDIR)/LinkTarget/$(call gb_LinkTarget__get_workdir_linktargetname,$(1)).ilk
129 gb_LinkTarget_get_manifestfile = \
130 $(WORKDIR)/LinkTarget/$(call gb_LinkTarget__get_workdir_linktargetname,$(1)).manifest
132 gb_LinkTarget_get_linksearchpath_for_layer = \
133 -LIBPATH:$(WORKDIR)/LinkTarget/StaticLibrary \
134 -LIBPATH:$(INSTDIR)/$(SDKDIRNAME)/lib \
135 $(if $(filter OXT,$(1)),\
136 -LIBPATH:$(WORKDIR)/LinkTarget/ExtensionLibrary, \
137 -LIBPATH:$(WORKDIR)/LinkTarget/Library)
139 # avoid fatal error LNK1170 for Library_merged
140 define gb_LinkTarget_MergedResponseFile
141 cat $${RESPONSEFILE} | sed 's/ /\n/g' | grep -v '^$$' > $${RESPONSEFILE}.1 && \
142 mv $${RESPONSEFILE}.1 $${RESPONSEFILE} &&
143 endef
145 ifeq ($(CPUNAME),X86_64)
146 MSC_SUBSYSTEM_VERSION=$(COMMA)5.02
147 else
148 MSC_SUBSYSTEM_VERSION=$(COMMA)5.01
149 endif
151 define gb_LinkTarget__command
152 $(call gb_Output_announce,$(2),$(true),LNK,4)
153 $(call gb_Helper_abbreviate_dirs,\
154 rm -f $(1) && \
155 RESPONSEFILE=$(call var2file,$(shell $(gb_MKTEMP)),100, \
156 $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
157 $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
158 $(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
159 $(foreach object,$(GENCOBJECTS),$(call gb_GenCObject_get_target,$(object))) \
160 $(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_target,$(object))) \
161 $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),$(shell cat $(extraobjectlist))) \
162 $(PCHOBJS) $(NATIVERES)) && \
163 $(if $(filter $(call gb_Library__get_workdir_linktargetname,merged),$(2)),$(call gb_LinkTarget_MergedResponseFile)) \
164 unset INCLUDE && \
165 $(if $(filter YES,$(LIBRARY_X64)), $(LINK_X64_BINARY), $(gb_LINK)) \
166 $(if $(filter Library CppunitTest,$(TARGETTYPE)),$(gb_Library_TARGETTYPEFLAGS)) \
167 $(if $(filter StaticLibrary,$(TARGETTYPE)),-LIB) \
168 $(if $(filter Executable,$(TARGETTYPE)),$(gb_Executable_TARGETTYPEFLAGS)) \
169 $(if $(filter YES,$(LIBRARY_X64)),,$(if $(filter YES,$(TARGETGUI)), -SUBSYSTEM:WINDOWS$(MSC_SUBSYSTEM_VERSION), -SUBSYSTEM:CONSOLE$(MSC_SUBSYSTEM_VERSION))) \
170 $(if $(filter YES,$(LIBRARY_X64)), -MACHINE:X64) \
171 $(if $(filter YES,$(LIBRARY_X64)), \
172 -LIBPATH:$(COMPATH)/lib/amd64 \
173 -LIBPATH:$(WINDOWS_SDK_HOME)/lib/x64 \
174 $(if $(filter 80 81,$(WINDOWS_SDK_VERSION)),-LIBPATH:$(WINDOWS_SDK_HOME)/lib/$(WINDOWS_SDK_LIB_SUBDIR)/um/x64)) \
175 $(T_LDFLAGS) \
176 @$${RESPONSEFILE} \
177 $(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_ilibfilename,$(lib))) \
178 $(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_filename,$(lib))) \
179 $(if $(filter-out StaticLibrary,$(TARGETTYPE)),\
180 $(T_LIBS) user32.lib \
181 -manifestfile:$(WORKDIR)/LinkTarget/$(2).manifest \
182 -pdb:$(call gb_LinkTarget__get_pdb_filename,$(WORKDIR)/LinkTarget/$(2))) \
183 $(if $(ILIBTARGET),-out:$(1) -implib:$(ILIBTARGET),-out:$(1)); RC=$$?; rm $${RESPONSEFILE} \
184 $(if $(filter Library,$(TARGETTYPE)),; if [ ! -f $(ILIBTARGET) ]; then rm -f $(1); exit 42; fi) \
185 $(if $(filter Library,$(TARGETTYPE)),&& if [ -f $(WORKDIR)/LinkTarget/$(2).manifest ]; then mt.exe $(MTFLAGS) -nologo -manifest $(WORKDIR)/LinkTarget/$(2).manifest -outputresource:$(1)\;2 && touch -r $(1) $(WORKDIR)/LinkTarget/$(2).manifest $(ILIBTARGET); fi) \
186 $(if $(filter Executable,$(TARGETTYPE)),&& if [ -f $(WORKDIR)/LinkTarget/$(2).manifest ]; then mt.exe $(MTFLAGS) -nologo -manifest $(WORKDIR)/LinkTarget/$(2).manifest -outputresource:$(1)\;1 && touch -r $(1) $(WORKDIR)/LinkTarget/$(2).manifest; fi) \
187 $(if $(filter YES,$(TARGETGUI)),&& if [ -f $(SRCDIR)/solenv/inc/DeclareDPIAware.manifest ]; then mt.exe $(MTFLAGS) -nologo -manifest $(SRCDIR)/solenv/inc/DeclareDPIAware.manifest -updateresource:$(1)\;1 ; fi) \
188 $(if $(filter Library,$(TARGETTYPE)),&& \
189 echo $(notdir $(1)) > $(WORKDIR)/LinkTarget/$(2).exports.tmp && \
190 $(if $(filter YES,$(LIBRARY_X64)),$(LINK_X64_BINARY),$(gb_LINK)) \
191 -dump -exports $(ILIBTARGET) \
192 >> $(WORKDIR)/LinkTarget/$(2).exports.tmp && \
193 $(call gb_Helper_replace_if_different_and_touch,$(WORKDIR)/LinkTarget/$(2).exports.tmp,$(WORKDIR)/LinkTarget/$(2).exports,$(1))) \
194 ; exit $$RC)
195 endef
197 define gb_MSVCRT_subst
198 $(if $(MSVC_USE_DEBUG_RUNTIME),$(subst msvcrt,msvcrtd,$(subst msvcprt,msvcprtd,$(subst libcmt,libcmtd,$(subst libcpmt,libcpmtd,$(subst msvcmrt,msvcmrtd,$(1)))))),$(1))
199 endef
201 define gb_LinkTarget_use_system_win32_libs
202 $(call gb_LinkTarget_add_libs,$(1),$(foreach lib,$(2),$(call gb_MSVCRT_subst,$(lib)).lib))
203 $(if $(call gb_LinkTarget__is_merged,$(1)),\
204 $(call gb_LinkTarget_add_libs,$(call gb_Library_get_linktarget,merged),$(foreach lib,$(2),$(call gb_MSVCRT_subst,$(lib)).lib)))
205 endef
207 # Flags common for PE executables (EXEs and DLLs)
208 gb_Windows_PE_TARGETTYPEFLAGS := \
209 -release \
210 -opt:noref \
211 -incremental:no \
212 -debug \
213 $(if $(filter NO,$(LIBRARY_X64)), -safeseh) \
214 -nxcompat \
215 -dynamicbase \
216 -manifest
218 ifeq ($(ENABLE_LTO),TRUE)
219 gb_Windows_PE_TARGETTYPEFLAGS += -LTCG
220 endif
222 # Library class
225 gb_Library_DEFS := -D_DLL
226 gb_Library_TARGETTYPEFLAGS := \
227 -DLL \
228 $(gb_Windows_PE_TARGETTYPEFLAGS)
230 gb_Library_get_rpath :=
232 gb_Library_SYSPRE := i
233 gb_Library_PLAINEXT := .lib
235 gb_Library_LAYER := \
236 $(foreach lib,$(gb_Library_OOOLIBS),$(lib):OOO) \
237 $(foreach lib,$(gb_Library_PLAINLIBS_NONE),$(lib):NONE) \
238 $(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):URELIB) \
239 $(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):OOO) \
240 $(foreach lib,$(gb_Library_PRIVATELIBS_URE),$(lib):URELIB) \
241 $(foreach lib,$(gb_Library_RTVERLIBS),$(lib):URELIB) \
242 $(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):URELIB) \
243 $(foreach lib,$(gb_Library_EXTENSIONLIBS),$(lib):OXT) \
244 $(foreach lib,$(gb_Library_PLAINLIBS_SHLXTHDL),$(lib):SHLXTHDL) \
246 gb_Library_ILIBFILENAMES :=\
247 $(foreach lib,$(gb_Library_KNOWNLIBS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \
249 gb_Library_DLLEXT := .dll
250 gb_Library_UDK_MAJORVER := 3
251 gb_Library_RTEXT := MSC$(gb_Library_DLLEXT)
252 gb_Library_OOOEXT := $(gb_Library_DLLPOSTFIX)$(gb_Library_DLLEXT)
253 gb_Library_UNOEXT := .uno$(gb_Library_DLLEXT)
254 gb_Library_UNOVEREXT := $(gb_Library_UDK_MAJORVER)$(gb_Library_DLLEXT)
255 gb_Library_RTVEREXT := $(gb_Library_UDK_MAJORVER)$(gb_Library_RTEXT)
257 gb_Library_FILENAMES :=\
258 $(foreach lib,$(gb_Library_OOOLIBS),$(lib):$(lib)$(gb_Library_OOOEXT)) \
259 $(foreach lib,$(gb_Library_PLAINLIBS_NONE),$(lib):$(lib)$(gb_Library_DLLEXT)) \
260 $(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):$(lib)$(gb_Library_DLLEXT)) \
261 $(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):$(lib)$(gb_Library_DLLEXT)) \
262 $(foreach lib,$(gb_Library_PLAINLIBS_SHLXTHDL),$(lib):$(lib)$(gb_Library_DLLEXT)) \
263 $(foreach lib,$(gb_Library_PRIVATELIBS_URE),$(lib):$(lib)$(gb_Library_OOOEXT)) \
264 $(foreach lib,$(gb_Library_RTVERLIBS),$(lib):$(lib)$(gb_Library_RTVEREXT)) \
265 $(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):$(lib)$(gb_Library_UNOVEREXT)) \
266 $(foreach lib,$(gb_Library_EXTENSIONLIBS),$(lib):$(lib)$(gb_Library_UNOEXT)) \
268 # An assembly is a special kind of library for CLI
269 define gb_Library_Assembly
270 $(call gb_Library_Library,$(1))
271 $(call gb_LinkTarget_get_target,$(call gb_Library_get_linktarget,$(1))) : NATIVERES :=
273 endef
275 define gb_Library_Library_platform
276 $(call gb_LinkTarget_set_ilibtarget,$(2),$(3))
278 $(call gb_LinkTarget_add_auxtargets,$(2),\
279 $(patsubst %.lib,%.exp,$(3)) \
280 $(call gb_LinkTarget_get_manifestfile,$(2)) \
281 $(call gb_LinkTarget_get_pdbfile_in,$(2)) \
282 $(call gb_LinkTarget_get_pdbfile_out,$(2)) \
283 $(call gb_LinkTarget_get_ilkfile,$(2)) \
286 $(call gb_Library_add_default_nativeres,$(1),$(1)/default)
288 $(call gb_LinkTarget_get_target,$(2)) \
289 $(call gb_LinkTarget_get_headers_target,$(2)) : PDBFILE = $(call gb_LinkTarget_get_pdbfile_in,$(2))
291 endef
293 define gb_Library_add_default_nativeres
294 $(call gb_WinResTarget_WinResTarget_init,$(2))
295 $(call gb_WinResTarget_set_rcfile,$(2),include/default)
296 $(call gb_WinResTarget_add_defs,$(2),\
297 -DVERVARIANT="$(LIBO_VERSION_PATCH)" \
298 -DRES_APP_VENDOR="$(OOO_VENDOR)" \
299 -DORG_NAME="$(call gb_Library_get_filename,$(1))"\
300 -DINTERNAL_NAME="$(subst $(gb_Library_DLLEXT),,$(call gb_Library_get_filename,$(1)))" \
301 -DADDITIONAL_VERINFO1="" \
302 -DADDITIONAL_VERINFO2="" \
303 -DADDITIONAL_VERINFO3="" \
305 $(call gb_Library_add_nativeres,$(1),$(2))
306 $(call gb_Library_get_clean_target,$(1)) : $(call gb_WinResTarget_get_clean_target,$(2))
308 endef
310 define gb_LinkTarget_add_nativeres
311 $(call gb_LinkTarget_get_target,$(1)) : $(call gb_WinResTarget_get_target,$(2))
312 $(call gb_LinkTarget_get_target,$(1)) : NATIVERES += $(call gb_WinResTarget_get_target,$(2))
314 endef
316 define gb_LinkTarget_set_nativeres
317 $(call gb_LinkTarget_get_target,$(1)) : $(call gb_WinResTarget_get_target,$(2))
318 $(call gb_LinkTarget_get_target,$(1)) : NATIVERES := $(call gb_WinResTarget_get_target,$(2))
320 endef
322 define gb_Library_get_ilibfilename
323 $(patsubst $(1):%,%,$(filter $(1):%,$(gb_Library_ILIBFILENAMES)))
324 endef
326 gb_Library_get_sdk_link_dir = $(INSTDIR)/$(SDKDIRNAME)/lib
328 gb_Library_get_sdk_link_lib = $(gb_Library_get_ilib_target)
330 # StaticLibrary class
332 gb_StaticLibrary_get_filename = $(1).lib
333 gb_StaticLibrary_PLAINEXT := .lib
335 define gb_StaticLibrary_StaticLibrary_platform
336 $(call gb_LinkTarget_get_target,$(2)) \
337 $(call gb_LinkTarget_get_headers_target,$(2)) : PDBFILE = $(call gb_LinkTarget_get_pdbfile_in,$(2))
339 $(call gb_LinkTarget_add_auxtargets,$(2),\
340 $(call gb_LinkTarget_get_pdbfile_in,$(2)) \
343 endef
345 # Executable class
347 gb_Executable_EXT := .exe
348 gb_Executable_EXT_for_build := .exe
349 gb_Executable_TARGETTYPEFLAGS := $(gb_Windows_PE_TARGETTYPEFLAGS)
351 gb_Executable_get_rpath :=
353 # surprisingly some executables have exports so link.exe creates import lib
354 define gb_Executable_Executable_platform
355 $(call gb_LinkTarget_set_ilibtarget,$(2),$(3))
357 $(call gb_LinkTarget_add_auxtargets,$(2),\
358 $(patsubst %.lib,%.exp,$(3)) \
359 $(call gb_LinkTarget_get_pdbfile_out,$(2)) \
360 $(call gb_LinkTarget_get_pdbfile_in,$(2)) \
361 $(call gb_LinkTarget_get_manifestfile,$(2)) \
364 $(call gb_LinkTarget_get_target,$(2)) \
365 $(call gb_LinkTarget_get_headers_target,$(2)) : PDBFILE := $(call gb_LinkTarget_get_pdbfile_in,$(2))
367 endef
369 # CppunitTest class
371 gb_CppunitTest_DEFS := -D_DLL
372 ifeq ($(GNUMAKE_WIN_NATIVE),TRUE)
373 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)))
374 else
375 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)))
376 endif
377 gb_CppunitTest_get_filename = test_$(1).dll
378 gb_CppunitTest_get_ilibfilename = itest_$(1).lib
380 define gb_CppunitTest_CppunitTest_platform
381 $(call gb_LinkTarget_set_ilibtarget,$(2),$(3))
383 $(call gb_LinkTarget_add_auxtargets,$(2),\
384 $(patsubst %.lib,%.exp,$(3)) \
385 $(3) \
386 $(call gb_LinkTarget_get_manifestfile,$(2)) \
387 $(call gb_LinkTarget_get_pdbfile_out,$(2)) \
388 $(call gb_LinkTarget_get_pdbfile_in,$(2)) \
389 $(call gb_LinkTarget_get_ilkfile,$(2)) \
392 $(call gb_LinkTarget_get_target,$(2)) \
393 $(call gb_LinkTarget_get_headers_target,$(2)) : PDBFILE = $(call gb_LinkTarget_get_pdbfile_in,$(2))
395 endef
397 # JunitTest class
399 ifneq ($(OOO_TEST_SOFFICE),)
400 gb_JunitTest_SOFFICEARG:=$(OOO_TEST_SOFFICE)
401 else
402 ifneq ($(gb_JunitTest_DEBUGRUN),)
403 gb_JunitTest_SOFFICEARG:=connect:pipe,name=$(USER)
404 else
405 gb_JunitTest_SOFFICEARG:=path:$(INSTROOT)/$(LIBO_BIN_FOLDER)/soffice
406 endif
407 endif
410 define gb_JunitTest_JunitTest_platform
411 $(call gb_JunitTest_get_target,$(1)) : DEFS := \
412 -Dorg.openoffice.test.arg.soffice="$(gb_JunitTest_SOFFICEARG)" \
413 -Dorg.openoffice.test.arg.env=PATH="$$$$PATH" \
414 -Dorg.openoffice.test.arg.user=$(call gb_Helper_make_url,$(call gb_JunitTest_get_userdir,$(1)))
415 -Dorg.openoffice.test.arg.workdir=$(call gb_JunitTest_get_userdir,$(1)) \
417 endef
420 define gb_Module_DEBUGRUNCOMMAND
421 printf "\nAttach the debugger to soffice.bin\n\n"
422 unset VCL_HIDE_WINDOWS && \
423 OFFICESCRIPT=`mktemp` && \
424 printf "$(INSTROOT)/$(LIBO_BIN_FOLDER)/soffice.exe" > $${OFFICESCRIPT} && \
425 printf " --norestore --nologo '--accept=pipe,name=$(USER);urp;'\n" >> $${OFFICESCRIPT} && \
426 $(SHELL) $${OFFICESCRIPT} && \
427 rm $${OFFICESCRIPT}
428 endef
433 # PythonTest class
435 gb_PythonTest_PRECOMMAND := $(gb_CppunitTest_CPPTESTPRECOMMAND)
437 # SrsPartTarget class
439 ifeq ($(gb_FULLDEPS),$(true))
440 # FIXME this is used before TargetLocations is read?
441 gb_SrsPartTarget__command_target = $(WORKDIR)/LinkTarget/Executable/makedepend.exe
442 define gb_SrsPartTarget__command_dep
443 $(call gb_Helper_abbreviate_dirs,\
444 $(call gb_Executable_get_target,makedepend) \
445 $(INCLUDE) \
446 $(DEFS) \
447 $(2) \
448 -o .src \
449 -p $(dir $(call gb_SrsPartTarget_get_target,$(1))) \
450 -f $(call gb_SrsPartTarget_get_dep_target,$(1)))
451 endef
452 else
453 gb_SrsPartTarget__command_target =
454 gb_SrsPartTarget__command_dep =
455 endif
457 # WinResTarget class
459 gb_WinResTarget_POSTFIX :=.res
461 define gb_WinResTarget__command
462 $(call gb_Output_announce,$(2),$(true),RC ,1)
463 $(call gb_Helper_abbreviate_dirs,\
464 mkdir -p $(dir $(1)) && \
465 $(gb_RC) \
466 $(DEFS) $(FLAGS) \
467 $(INCLUDE) \
468 -Fo$(1) \
469 $(RCFILE) )
470 endef
472 $(eval $(call gb_Helper_make_dep_targets,\
473 WinResTarget \
476 ifeq ($(gb_FULLDEPS),$(true))
477 # FIXME this is used before TargetLocations is read?
478 gb_WinResTarget__command_target = $(WORKDIR)/LinkTarget/Executable/makedepend.exe
479 define gb_WinResTarget__command_dep
480 $(call gb_Output_announce,RC:$(2),$(true),DEP,1)
481 $(call gb_Helper_abbreviate_dirs,\
482 mkdir -p $(dir $(1)) && \
483 $(call gb_Executable_get_target,makedepend) \
484 $(INCLUDE) \
485 $(DEFS) \
486 $(RCFILE) \
487 -o .res \
488 -p $(dir $(3)) \
489 -f $(1))
490 endef
491 else
492 gb_WinResTarget__command_target =
493 gb_WinResTarget__command_dep =
494 endif
496 # InstallModuleTarget class
498 define gb_InstallModuleTarget_InstallModuleTarget_platform
499 $(call gb_InstallModuleTarget_add_defs,$(1),\
500 $(gb_CPUDEFS) \
501 $(gb_OSDEFS) \
502 -DCOMID=MSC \
505 endef
507 # ExternalProject class
509 # Use the gcc wrappers for a autoconf based project
511 # gb_ExternalProject_register_targets project state_target
512 define gb_ExternalProject_use_autoconf
513 $(call gb_ExternalProject_get_preparation_target,$(1)) : $(call gb_Executable_get_runtime_dependencies,gcc-wrapper) \
514 $(call gb_Executable_get_runtime_dependencies,g++-wrapper)
515 $(call gb_ExternalProject_get_state_target,$(1),$(2)): WRAPPERS := $(gb_AUTOCONF_WRAPPERS)
516 endef
518 # Set INCLUDE and LIB variables and unset MAKEFLAGS when using nmake
520 # gb_ExternalProject_use_nmake project state_target
521 define gb_ExternalProject_use_nmake
522 $(call gb_ExternalProject_get_state_target,$(1),$(2)): NMAKE := $(true)
523 endef
525 # if ccache is enabled, then split it and use lastword as REAL_FOO
526 # /opt/lo/bin/ccache /cygdrive/c/PROGRA~2/MICROS~2.0/VC/bin/cl.exe
528 gb_AUTOCONF_WRAPPERS = \
529 REAL_CC="$(shell cygpath -w $(filter-out -%,$(CC)))" \
530 REAL_CC_FLAGS="$(filter -%,$(CC))" \
531 CC="$(call gb_Executable_get_target,gcc-wrapper)" \
532 REAL_CXX="$(shell cygpath -w $(filter-out -%,$(CXX)))" \
533 REAL_CXX_FLAGS="$(filter -%,$(CXX))" \
534 CXX="$(call gb_Executable_get_target,g++-wrapper)" \
535 LD="$(shell cygpath -w $(COMPATH)/bin/link.exe) -nologo"
537 gb_ExternalProject_INCLUDE := \
538 $(subst -I,,$(subst $(WHITESPACE),;,$(subst -I. , ,$(SOLARINC))))
540 # InstallScript class
542 gb_InstallScript_EXT := .inf
544 # CliAssemblyTarget class
546 gb_CliAssemblyTarget_POLICYEXT := $(gb_Library_DLLEXT)
547 gb_CliAssemblyTarget_get_dll = $(call gb_Library__get_dir_for_layer,NONE)/$(1)$(gb_CliAssemblyTarget_POLICYEXT)
549 # Extension class
551 gb_Extension_LICENSEFILE_DEFAULT := $(INSTROOT)/license.txt
553 # UnpackedTarget class
555 gb_UnpackedTarget_TARFILE_LOCATION := $(shell cygpath -u $(TARFILE_LOCATION))
557 # UnoApiHeadersTarget class
559 ifeq ($(DISABLE_DYNLOADING),TRUE)
560 gb_UnoApiHeadersTarget_select_variant = $(if $(filter udkapi,$(1)),comprehensive,$(2))
561 else
562 gb_UnoApiHeadersTarget_select_variant = $(2)
563 endif
565 # UIConfig class
567 # use responsefile because cui has too many files for command line
568 define gb_UIConfig__command
569 $(call gb_Helper_abbreviate_dirs,\
570 RESPONSEFILE=$(call var2file,$(shell $(gb_MKTEMP)),100,$(if $(UI_IMAGELISTS),$(strip $(UI_IMAGELISTS)),/dev/null)) \
571 && tr " " "\000" < $$RESPONSEFILE | tr -d "\r\n" > $$RESPONSEFILE.0 \
572 && sort -u --files0-from=$$RESPONSEFILE.0 > $@ \
573 && rm $$RESPONSEFILE $$RESPONSEFILE.0 \
576 endef
578 # UIMenubarTarget class
580 define gb_UIMenubarTarget__command
581 $(call gb_Output_announce,$(2),$(true),UIM,1)
582 cp $(3) $(1)
584 endef
586 gb_UIMenubarTarget_UIMenubarTarget_platform :=
588 # Python
589 gb_Python_PRECOMMAND := PATH="$(shell cygpath -w $(INSTDIR)/program)" PYTHONHOME="$(INSTDIR)/program/python-core-$(PYTHON_VERSION)" PYTHONPATH="$(INSTDIR)/program/python-core-$(PYTHON_VERSION)/lib;$(INSTDIR)/program/python-core-$(PYTHON_VERSION)/lib/lib-dynload:$(INSTDIR)/program"
590 gb_Python_INSTALLED_EXECUTABLE := $(INSTROOT)/$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/bin/python.exe
592 gb_ICU_PRECOMMAND := PATH="$(shell cygpath -w $(WORKDIR_FOR_BUILD)/UnpackedTarball/icu/source/lib)"
594 # vim: set noet sw=4: