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 .
24 -D_NATIVE_WCHAR_T_DEFINED \
26 -D_FORCENAMELESSUNION \
36 -Wdeclaration-after-statement \
37 -fno-strict-aliasing \
40 $(gb_CXXFLAGS_COMMON
) \
41 -Wno-ctor-dtor-privacy \
45 -fno-strict-aliasing \
49 gb_CXXFLAGS
+= --sysroot
=$(SYSBASE
)
50 gb_CFLAGS
+= --sysroot
=$(SYSBASE
)
53 # At least sal defines its own __main, which would cause DLLs linking against
54 # sal to pick up sal's __main instead of the one from MinGW's dllcrt2.o:
55 gb_LinkTarget_LDFLAGS
:= \
56 -Wl
,--export-all-symbols \
57 -Wl
,--exclude-symbols
,__main \
58 -Wl
,--enable-stdcall-fixup \
59 -Wl
,--enable-runtime-pseudo-reloc-v2 \
61 ifeq ($(MINGW_GCCLIB_EH
),YES
)
62 gb_LinkTarget_LDFLAGS
+= -shared-libgcc
70 gb_DEBUG_CFLAGS
:= -g
-fno-inline
74 gb_LinkTarget_CFLAGS
:= $(gb_CFLAGS
)
75 gb_LinkTarget_CXXFLAGS
:= $(gb_CXXFLAGS
)
77 ifeq ($(gb_SYMBOL
),$(true
))
78 gb_LinkTarget_CXXFLAGS
+= $(GGDB2
)
79 gb_LinkTarget_CFLAGS
+= $(GGDB2
)
82 gb_LinkTarget_INCLUDE
+=\
83 $(foreach inc
,$(subst ;, ,$(JDKINC
)),-I
$(inc
)) \
85 define gb_LinkTarget__command_dynamiclinkexecutable
86 $(call gb_Helper_abbreviate_dirs
,\
87 $(if
$(CXXOBJECTS
)$(GENCXXOBJECTS
)$(EXTRAOBJECTLISTS
),$(gb_CXX
),$(gb_CC
)) $(strip \
88 $(gb_Executable_TARGETTYPEFLAGS
) \
89 $(if
$(filter YES
,$(TARGETGUI
)), -mwindows
, -mconsole
) \
91 $(foreach object
,$(COBJECTS
),$(call gb_CObject_get_target
,$(object
))) \
92 $(foreach object
,$(CXXOBJECTS
),$(call gb_CxxObject_get_target
,$(object
))) \
93 $(foreach object
,$(GENCOBJECTS
),$(call gb_GenCObject_get_target
,$(object
))) \
94 $(foreach object
,$(GENCXXOBJECTS
),$(call gb_GenCxxObject_get_target
,$(object
))) \
95 $(foreach object
,$(ASMOBJECTS
),$(call gb_AsmObject_get_target
,$(object
))) \
96 $(foreach extraobjectlist
,$(EXTRAOBJECTLISTS
),@
$(extraobjectlist
)) \
98 $(if
$(LINKED_STATIC_LIBS
),-Wl
$(COMMA
)--start-group
$(foreach lib
,$(LINKED_STATIC_LIBS
),$(call gb_StaticLibrary_get_target
,$(lib
))) -Wl
$(COMMA
)--end-group
) \
99 $(patsubst lib
%.a
,-l
%,$(patsubst lib
%.dll.a
,-l
%,$(foreach lib
,$(LINKED_LIBS
),$(call gb_Library_get_ilibfilename
,$(lib
))))) \
101 -Wl
$(COMMA
)-Map
$(COMMA
)$(WORKDIR
)/LinkTarget
/$(2).map \
105 define gb_LinkTarget__command_dynamiclinklibrary
106 $(call gb_Helper_abbreviate_dirs
,\
107 $(if
$(CXXOBJECTS
)$(GENCXXOBJECTS
)$(EXTRAOBJECTLISTS
),$(gb_CXX
),$(gb_CC
)) $(strip \
108 $(gb_Library_TARGETTYPEFLAGS
) \
110 $(foreach object
,$(COBJECTS
),$(call gb_CObject_get_target
,$(object
))) \
111 $(foreach object
,$(CXXOBJECTS
),$(call gb_CxxObject_get_target
,$(object
))) \
112 $(foreach object
,$(GENCOBJECTS
),$(call gb_GenCObject_get_target
,$(object
))) \
113 $(foreach object
,$(GENCXXOBJECTS
),$(call gb_GenCxxObject_get_target
,$(object
))) \
114 $(foreach object
,$(ASMOBJECTS
),$(call gb_AsmObject_get_target
,$(object
))) \
115 $(foreach extraobjectlist
,$(EXTRAOBJECTLISTS
),@
$(extraobjectlist
)) \
117 $(if
$(LINKED_STATIC_LIBS
),-Wl
$(COMMA
)--start-group
$(foreach lib
,$(LINKED_STATIC_LIBS
),$(call gb_StaticLibrary_get_target
,$(lib
))) -Wl
$(COMMA
)--end-group
) \
118 $(patsubst lib
%.a
,-l
%,$(patsubst lib
%.dll.a
,-l
%,$(foreach lib
,$(LINKED_LIBS
),$(call gb_Library_get_ilibfilename
,$(lib
))))) \
120 -Wl
$(COMMA
)-Map
$(COMMA
)$(WORKDIR
)/LinkTarget
/$(2).map \
121 -Wl
$(COMMA
)--out-implib
$(COMMA
)$(ILIBTARGET
) \
123 $(if
$(findstring s
,$(MAKEFLAGS
)),> /dev
/null
)))
126 define gb_LinkTarget__command_staticlinklibrary
127 $(call gb_Helper_abbreviate_dirs
,\
130 $(foreach object
,$(COBJECTS
),$(call gb_CObject_get_target
,$(object
))) \
131 $(foreach object
,$(CXXOBJECTS
),$(call gb_CxxObject_get_target
,$(object
))) \
132 $(foreach object
,$(GENCOBJECTS
),$(call gb_GenCObject_get_target
,$(object
))) \
133 $(foreach object
,$(GENCXXOBJECTS
),$(call gb_GenCxxObject_get_target
,$(object
))) \
134 $(foreach extraobjectlist
,$(EXTRAOBJECTLISTS
),@
$(extraobjectlist
)) \
135 $(if
$(findstring s
,$(MAKEFLAGS
)),> /dev
/null
))
138 define gb_LinkTarget__command
139 $(call gb_Output_announce
,$(2),$(true
),LNK
,4)
140 $(if
$(filter Executable
,$(TARGETTYPE
)),$(call gb_LinkTarget__command_dynamiclinkexecutable
,$(1),$(2)))
141 $(if
$(filter Library CppunitTest
,$(TARGETTYPE
)),$(call gb_LinkTarget__command_dynamiclinklibrary
,$(1),$(2)))
142 $(if
$(filter StaticLibrary
,$(TARGETTYPE
)),$(call gb_LinkTarget__command_staticlinklibrary
,$(1)))
145 define gb_LinkTarget_use_system_win32_libs
146 $(call gb_LinkTarget_add_libs
,$(1),$(foreach lib
,$(2),-l
$(patsubst oldnames
,moldname
,$(lib
))))
147 $(if
$(call gb_LinkTarget__is_merged
,$(1)),\
148 $(call gb_LinkTarget_add_libs
,$(call gb_Library_get_linktarget
,merged
),$(foreach lib
,$(2),-l
$(patsubst oldnames
,moldname
,$(lib
)))))
151 gb_LinkTarget_get_mapfile
= \
152 $(WORKDIR
)/LinkTarget
/$(patsubst %.dll
,%.map
,$(call gb_LinkTarget__get_workdir_linktargetname
,$(1)))
156 gb_Library_DEFS
:= -D_DLL
157 gb_Library_TARGETTYPEFLAGS
:= -shared
158 gb_Library_get_rpath
:=
160 gb_Library_SYSPRE
:= lib
161 gb_Library_UNOVERPRE
:= $(gb_Library_SYSPRE
)uno_
162 gb_Library_UDK_MAJORVER
:= 3
164 gb_Library_PLAINEXT
:= .dll.a
166 gb_Library_RTEXT
:= gcc3
$(gb_Library_PLAINEXT
)
167 gb_Library_RTVEREXT
:= $(gb_Library_UDK_MAJORVER
)$(gb_Library_RTEXT
)
168 gb_Library_OOOEXT
:= $(gb_Library_DLLPOSTFIX
)$(gb_Library_PLAINEXT
)
169 gb_Library_UNOEXT
:= .uno
$(gb_Library_PLAINEXT
)
170 gb_Library_UNOVEREXT
:= $(gb_Library_UDK_MAJORVER
)$(gb_Library_PLAINEXT
)
172 gb_Library_DLLEXT
:= .dll
174 gb_Library_RTDLLEXT
:= gcc3
$(gb_Library_DLLEXT
)
175 gb_Library_RTVERDLLEXT
:= $(gb_Library_UDK_MAJORVER
)$(gb_Library_RTDLLEXT
)
176 gb_Library_OOODLLEXT
:= $(gb_Library_DLLPOSTFIX
)$(gb_Library_DLLEXT
)
177 gb_Library_UNOVERDLLEXT
:= $(gb_Library_UDK_MAJORVER
)$(gb_Library_DLLEXT
)
179 gb_Library_LAYER
:= \
180 $(foreach lib
,$(gb_Library_OOOLIBS
),$(lib
):OOO
) \
181 $(foreach lib
,$(gb_Library_PLAINLIBS_NONE
),$(lib
):NONE
) \
182 $(foreach lib
,$(gb_Library_PLAINLIBS_URE
),$(lib
):URELIB
) \
183 $(foreach lib
,$(gb_Library_PLAINLIBS_OOO
),$(lib
):OOO
) \
184 $(foreach lib
,$(gb_Library_PLAINLIBS_SHLXTHDL
),$(lib
):SHLXTHDL
) \
185 $(foreach lib
,$(gb_Library_PRIVATELIBS_URE
),$(lib
):URELIB
) \
186 $(foreach lib
,$(gb_Library_RTVERLIBS
),$(lib
):URELIB
) \
187 $(foreach lib
,$(gb_Library_UNOVERLIBS
),$(lib
):URELIB
) \
188 $(foreach lib
,$(gb_Library_EXTENSIONLIBS
),$(lib
):OXT
) \
190 gb_Library_ILIBFILENAMES
:=\
191 $(foreach lib
,$(gb_Library_OOOLIBS
),$(lib
):$(gb_Library_SYSPRE
)$(lib
)$(gb_Library_OOOEXT
)) \
192 $(foreach lib
,$(gb_Library_PLAINLIBS_NONE
),$(lib
):$(gb_Library_SYSPRE
)$(lib
)$(gb_Library_PLAINEXT
)) \
193 $(foreach lib
,$(gb_Library_PLAINLIBS_URE
),$(lib
):$(gb_Library_SYSPRE
)$(lib
)$(gb_Library_PLAINEXT
)) \
194 $(foreach lib
,$(gb_Library_PLAINLIBS_OOO
),$(lib
):$(gb_Library_SYSPRE
)$(lib
)$(gb_Library_PLAINEXT
)) \
195 $(foreach lib
,$(gb_Library_PLAINLIBS_SHLXTHDL
),$(lib
):$(gb_Library_SYSPRE
)$(lib
)$(gb_Library_PLAINEXT
)) \
196 $(foreach lib
,$(gb_Library_PRIVATELIBS_URE
),$(lib
):$(gb_Library_SYSPRE
)$(lib
)$(gb_Library_OOOEXT
)) \
197 $(foreach lib
,$(gb_Library_RTVERLIBS
),$(lib
):$(gb_Library_SYSPRE
)$(lib
)$(gb_Library_RTVEREXT
)) \
198 $(foreach lib
,$(gb_Library_UNOVERLIBS
),$(lib
):$(gb_Library_UNOVERPRE
)$(lib
)$(gb_Library_PLAINEXT
)) \
199 $(foreach lib
,$(gb_Library_EXTENSIONLIBS
),$(lib
):$(lib
)$(gb_Library_UNOEXT
)) \
202 gb_Library_FILENAMES
:=\
203 $(foreach lib
,$(gb_Library_OOOLIBS
),$(lib
):$(lib
)$(gb_Library_OOODLLEXT
)) \
204 $(foreach lib
,$(gb_Library_PLAINLIBS_NONE
),$(lib
):$(lib
)$(gb_Library_DLLEXT
)) \
205 $(foreach lib
,$(gb_Library_PLAINLIBS_URE
),$(lib
):$(lib
)$(gb_Library_DLLEXT
)) \
206 $(foreach lib
,$(gb_Library_PLAINLIBS_OOO
),$(lib
):$(lib
)$(gb_Library_DLLEXT
)) \
207 $(foreach lib
,$(gb_Library_PLAINLIBS_SHLXTHDL
),$(lib
):$(lib
)$(gb_Library_DLLEXT
)) \
208 $(foreach lib
,$(gb_Library_PRIVATELIBS_URE
),$(lib
):$(lib
)$(gb_Library_OOODLLEXT
)) \
209 $(foreach lib
,$(gb_Library_RTVERLIBS
),$(lib
):$(lib
)$(gb_Library_RTVERDLLEXT
)) \
210 $(foreach lib
,$(gb_Library_UNOVERLIBS
),$(lib
):$(lib
)$(gb_Library_UNOVERDLLEXT
)) \
211 $(foreach lib
,$(gb_Library_EXTENSIONLIBS
),$(lib
):$(lib
)$(gb_Library_UNOEXT
)) \
213 gb_Library_IARCSYSPRE
:= lib
214 gb_Library_IARCEXT
:= .a
216 gb_Library_ILIBEXT
:= .lib
218 define gb_Library_Library_platform
219 $(call gb_LinkTarget_set_ilibtarget
,$(2),$(3))
221 $(call gb_LinkTarget_add_auxtargets
,$(2), \
223 $(call gb_LinkTarget_get_mapfile
,$(2)) \
226 $(call gb_Library_add_default_nativeres
,$(1),$(1)/default
)
230 define gb_Library_add_default_nativeres
231 $(call gb_WinResTarget_WinResTarget_init
,$(2))
232 $(call gb_WinResTarget_set_rcfile
,$(2),include/default
)
233 $(call gb_WinResTarget_add_defs
,$(2),\
234 -DVERVARIANT
="$(LIBO_VERSION_PATCH)" \
235 -DRES_APP_VENDOR
="$(OOO_VENDOR)" \
236 -DADDITIONAL_VERINFO1
="" \
237 -DADDITIONAL_VERINFO2
="" \
238 -DADDITIONAL_VERINFO3
="" \
240 $(call gb_Library_add_nativeres
,$(1),$(2))
241 $(call gb_Library_get_clean_target
,$(1)) : $(call gb_WinResTarget_get_clean_target
,$(2))
245 define gb_LinkTarget_add_nativeres
246 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_WinResTarget_get_target
,$(2))
247 $(call gb_LinkTarget_get_target
,$(1)) : NATIVERES
+= $(call gb_WinResTarget_get_target
,$(2))
251 define gb_LinkTarget_set_nativeres
252 $(call gb_LinkTarget_get_target
,$(1)) : $(call gb_WinResTarget_get_target
,$(2))
253 $(call gb_LinkTarget_get_target
,$(1)) : NATIVERES
:= $(call gb_WinResTarget_get_target
,$(2))
257 define gb_Library_get_ilibfilename
258 $(patsubst $(1):%,%,$(filter $(1):%,$(gb_Library_ILIBFILENAMES
)))
261 gb_Library_get_sdk_link_dir
= $(INSTDIR
)/$(SDKDIRNAME
)/lib
263 gb_Library_get_sdk_link_lib
= $(gb_Library_get_ilib_target
)
267 gb_Executable_EXT
:= .exe
268 gb_Executable_TARGETTYPEFLAGS
:=
269 gb_Executable_get_rpath
:=
271 define gb_Executable_Executable_platform
277 gb_CppunitTest_CPPTESTPRECOMMAND
:= \
278 $(call gb_Helper_extend_ld_path
,$(WORKDIR
)/UnpackedTarball
/cppunit
/src
/cppunit
/.libs
)
279 gb_CppunitTest_get_filename
= test_
$(1).dll
280 gb_CppunitTest_get_ilibfilename
= itest_
$(1).lib
282 define gb_CppunitTest_CppunitTest_platform
283 $(call gb_LinkTarget_set_ilibtarget
,$(2),$(3))
285 $(call gb_LinkTarget_add_auxtargets
,$(2),\
287 $(call gb_LinkTarget_get_mapfile
,$(2)) \
294 gb_WinResTarget_POSTFIX
:=.o
296 define gb_WinResTarget__command
297 $(call gb_Output_announce
,$(2),$(true
),RC
,3)
298 $(call gb_Helper_abbreviate_dirs
,\
299 mkdir
-p
$(dir $(1)) && \
307 $(eval
$(call gb_Helper_make_dep_targets
,\
311 ifeq ($(gb_FULLDEPS
),$(true
))
312 gb_WinResTarget__command_target
= $(gb_Executable_BINDIR_FOR_BUILD
)/makedepend
313 define gb_WinResTarget__command_dep
314 $(call gb_Output_announce
,RC
:$(2),$(true
),DEP
,1)
315 $(call gb_Helper_abbreviate_dirs
,\
316 mkdir
-p
$(dir $(1)) && \
317 $(gb_Executable_BINDIR_FOR_BUILD
)/makedepend \
326 gb_WinResTarget__command_target
=
327 gb_WinResTarget__command_dep
=
330 # InstallModuleTarget class
332 define gb_InstallModuleTarget_InstallModuleTarget_platform
333 $(call gb_InstallModuleTarget_add_defs
,$(1),\
342 # InstallScript class
344 gb_InstallScript_EXT
:= .inf
346 # CliAssemblyTarget class
348 gb_CliAssemblyTarget_POLICYEXT
:=
349 gb_CliAssemblyTarget_get_dll
:=
353 gb_Extension_LICENSEFILE_DEFAULT
:= $(INSTROOT
)/license.txt
355 # UnpackedTarget class
357 gb_UnpackedTarget_TARFILE_LOCATION
:= $(TARFILE_LOCATION
)
359 # UnoApiHeadersTarget class
361 ifeq ($(DISABLE_DYNLOADING
),TRUE
)
362 gb_UnoApiHeadersTarget_select_variant
= $(if
$(filter udkapi
,$(1)),comprehensive
,$(2))
364 gb_UnoApiHeadersTarget_select_variant
= $(2)
367 # UIMenubarTarget class
369 define gb_UIMenubarTarget__command
370 $(call gb_Output_announce
,$(2),$(true
),UIM
,1)
375 gb_UIMenubarTarget_UIMenubarTarget_platform
:=
378 gb_PYTHON_PRECOMMAND
:= $$(error FIXME
)
380 # vim: set noet sw=4: