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 include $(GBUILDDIR
)/platform
/com_GCC_defs.mk
22 gb_MKTEMP
:= mktemp
-t gbuild.XXXXXX
24 ifneq ($(origin AR
),default
)
34 -D_POSIX_PTHREAD_SEMANTICS \
43 -Wdeclaration-after-statement \
47 $(gb_CXXFLAGS_COMMON
) \
50 -Woverloaded-virtual \
54 ifeq ($(gb_ENABLE_DBGUTIL
),$(true
))
60 ifneq ($(strip $(SYSBASE
)),)
61 gb_CXXFLAGS
+= --sysroot
=$(SYSBASE
)
62 gb_CFLAGS
+= --sysroot
=$(SYSBASE
)
63 gb_LinkTarget_LDFLAGS
+= \
64 -Wl
,--sysroot
=$(SYSBASE
)
67 gb_LinkTarget_LDFLAGS
+= \
69 -L
$(SYSBASE
)/usr
/lib \
74 ifeq ($(HAVE_LD_HASH_STYLE
),TRUE
)
75 gb_LinkTarget_LDFLAGS
+= \
76 -Wl
,--hash-style
=$(WITH_LINKER_HASH_STYLE
) \
80 ifneq ($(HAVE_LD_BSYMBOLIC_FUNCTIONS
),)
81 gb_LinkTarget_LDFLAGS
+= \
82 -Wl
,--dynamic-list-cpp-new \
83 -Wl
,--dynamic-list-cpp-typeinfo \
84 -Wl
,-Bsymbolic-functions \
88 # sun ld doesn't understand -O1 optimize flag
91 ifeq ($(gb_SYMBOL
),$(true
))
92 gb_LINKERSTRIPDEBUGFLAGS
:=
94 gb_LINKERSTRIPDEBUGFLAGS
:= -Wl
,-zredlocsym
-Wl
,-znoldynsym
99 define gb_LinkTarget__get_rpath_for_layer
100 $(patsubst $(1):%,%,$(filter $(1):%,$(gb_LinkTarget__RPATHS
)))
103 gb_LinkTarget__RPATHS
:= \
107 SDKBIN
:\dORIGIN
/..
/..
/program \
109 NONE
:\dORIGIN
/..
/Library \
111 gb_LinkTarget_CFLAGS
:= $(gb_CFLAGS
) $(gb_CFLAGS_WERROR
)
112 gb_LinkTarget_CXXFLAGS
:= $(gb_CXXFLAGS
) $(gb_CFLAGS_WERROR
)
114 ifeq ($(gb_SYMBOL
),$(true
))
115 gb_LinkTarget_CXXFLAGS
+= $(GGDB2
)
116 gb_LinkTarget_CFLAGS
+= $(GGDB2
)
119 # note that `cat $(extraobjectlist)` is needed to build with older gcc versions, e.g. 4.1.2 on SLED10
120 # we want to use @$(extraobjectlist) in the long run
121 # link with C compiler if there are no C++ files (pyuno_wrapper depends on this)
122 define gb_LinkTarget__command_dynamiclink
123 $(call gb_Helper_abbreviate_dirs
,\
124 $(if
$(CXXOBJECTS
)$(GENCXXOBJECTS
)$(EXTRAOBJECTLISTS
),$(gb_CXX
),$(gb_CC
)) \
125 $(if
$(filter Library CppunitTest
,$(TARGETTYPE
)),$(gb_Library_TARGETTYPEFLAGS
)) \
127 $(if
$(SOVERSIONSCRIPT
),-Wl
$(COMMA
)-soname
=$(notdir $(1)) \
129 $(subst \d
,$$,$(RPATH
)) \
131 $(foreach object
,$(COBJECTS
),$(call gb_CObject_get_target
,$(object
))) \
132 $(foreach object
,$(CXXOBJECTS
),$(call gb_CxxObject_get_target
,$(object
))) \
133 $(foreach object
,$(ASMOBJECTS
),$(call gb_AsmObject_get_target
,$(object
))) \
134 $(foreach object
,$(GENCOBJECTS
),$(call gb_GenCObject_get_target
,$(object
))) \
135 $(foreach object
,$(GENCXXOBJECTS
),$(call gb_GenCxxObject_get_target
,$(object
))) \
136 $(foreach extraobjectlist
,$(EXTRAOBJECTLISTS
),`cat $(extraobjectlist)`) \
137 -Wl
$(COMMA
)--start-group \
138 $(foreach lib
,$(LINKED_STATIC_LIBS
),\
139 $(call gb_StaticLibrary_get_target
,$(lib
))) \
141 -Wl
$(COMMA
)--end-group \
142 -Wl
$(COMMA
)-zrecord \
143 $(patsubst lib
%.a
,-l
%,$(patsubst lib
%.so
,-l
%,$(patsubst %.
$(gb_Library_UDK_MAJORVER
),%,$(foreach lib
,$(LINKED_LIBS
),$(call gb_Library_get_filename
,$(lib
)))))) \
145 $(if
$(SOVERSIONSCRIPT
),&& ln
-sf ..
/..
/program
/$(notdir $(1)) $(ILIBTARGET
)))
146 $(if
$(filter Library
,$(TARGETTYPE
)), $(call gb_Helper_abbreviate_dirs
,\
147 $(READELF
) -d
$(1) | grep SONAME
> $(WORKDIR
)/LinkTarget
/$(2).exports.tmp
; \
148 $(NM
) --dynamic
--extern-only
--defined-only
--format
=posix
$(1) \
150 >> $(WORKDIR
)/LinkTarget
/$(2).exports.tmp
&& \
151 $(call gb_Helper_replace_if_different_and_touch
,$(WORKDIR
)/LinkTarget
/$(2).exports.tmp
, \
152 $(WORKDIR
)/LinkTarget
/$(2).exports
,$(1))))
155 define gb_LinkTarget__command_staticlink
156 $(call gb_Helper_abbreviate_dirs
,\
159 $(if
$(LD_PLUGIN
),--plugin
$(LD_PLUGIN
)) \
160 $(foreach object
,$(COBJECTS
),$(call gb_CObject_get_target
,$(object
))) \
161 $(foreach object
,$(CXXOBJECTS
),$(call gb_CxxObject_get_target
,$(object
))) \
162 $(foreach object
,$(ASMOBJECTS
),$(call gb_AsmObject_get_target
,$(object
))) \
163 $(foreach object
,$(GENCOBJECTS
),$(call gb_GenCObject_get_target
,$(object
))) \
164 $(foreach object
,$(GENCXXOBJECTS
),$(call gb_GenCxxObject_get_target
,$(object
))) \
165 $(foreach extraobjectlist
,$(EXTRAOBJECTLISTS
),@
$(extraobjectlist
)) \
166 $(if
$(findstring s
,$(MAKEFLAGS
)),2> /dev
/null
))
169 define gb_LinkTarget__command
170 $(call gb_Output_announce
,$(2),$(true
),LNK
,4)
171 $(if
$(filter Library CppunitTest Executable
,$(TARGETTYPE
)),$(call gb_LinkTarget__command_dynamiclink
,$(1),$(2)))
172 $(if
$(filter StaticLibrary
,$(TARGETTYPE
)),$(call gb_LinkTarget__command_staticlink
,$(1)))
179 gb_Library_TARGETTYPEFLAGS
:= -shared
-Wl
,-M
/usr
/lib
/ld/map.noexstk
-mimpure-text
180 gb_Library_UDK_MAJORVER
:= 3
181 gb_Library_SYSPRE
:= lib
182 gb_Library_UNOVERPRE
:= $(gb_Library_SYSPRE
)uno_
183 gb_Library_PLAINEXT
:= .so
184 gb_Library_DLLEXT
:= .so
185 gb_Library_RTEXT
:= gcc3
$(gb_Library_PLAINEXT
)
187 gb_Library_OOOEXT
:= $(gb_Library_DLLPOSTFIX
)$(gb_Library_PLAINEXT
)
188 gb_Library_UNOEXT
:= .uno
$(gb_Library_PLAINEXT
)
195 gb_Library_FILENAMES
:= \
196 $(foreach lib
,$(gb_Library_OOOLIBS
),$(lib
):$(gb_Library_SYSPRE
)$(lib
)$(gb_Library_OOOEXT
)) \
197 $(foreach lib
,$(gb_Library_PLAINLIBS_NONE
),$(lib
):$(gb_Library_SYSPRE
)$(lib
)$(gb_Library_PLAINEXT
)) \
198 $(foreach lib
,$(gb_Library_PLAINLIBS_URE
),$(lib
):$(gb_Library_SYSPRE
)$(lib
)$(gb_Library_PLAINEXT
)) \
199 $(foreach lib
,$(gb_Library_PLAINLIBS_OOO
),$(lib
):$(gb_Library_SYSPRE
)$(lib
)$(gb_Library_PLAINEXT
)) \
200 $(foreach lib
,$(gb_Library_PRIVATELIBS_URE
),$(lib
):$(gb_Library_SYSPRE
)$(lib
)$(gb_Library_OOOEXT
)) \
201 $(foreach lib
,$(gb_Library_RTVERLIBS
),$(lib
):$(gb_Library_SYSPRE
)$(lib
)$(gb_Library_RTEXT
).
$(gb_Library_UDK_MAJORVER
)) \
202 $(foreach lib
,$(gb_Library_UNOVERLIBS
),$(lib
):$(gb_Library_UNOVERPRE
)$(lib
)$(gb_Library_PLAINEXT
).
$(gb_Library_UDK_MAJORVER
)) \
203 $(foreach lib
,$(gb_Library_EXTENSIONLIBS
),$(lib
):$(lib
)$(gb_Library_UNOEXT
)) \
206 gb_Library_LAYER
:= \
207 $(foreach lib
,$(gb_Library_OOOLIBS
),$(lib
):OOO
) \
208 $(foreach lib
,$(gb_Library_PLAINLIBS_URE
),$(lib
):URELIB
) \
209 $(foreach lib
,$(gb_Library_PLAINLIBS_OOO
),$(lib
):OOO
) \
210 $(foreach lib
,$(gb_Library_PLAINLIBS_NONE
),$(lib
):NONE
) \
211 $(foreach lib
,$(gb_Library_PRIVATELIBS_URE
),$(lib
):URELIB
) \
212 $(foreach lib
,$(gb_Library_RTVERLIBS
),$(lib
):URELIB
) \
213 $(foreach lib
,$(gb_Library_UNOVERLIBS
),$(lib
):URELIB
) \
214 $(foreach lib
,$(gb_Library_EXTENSIONLIBS
),$(lib
):OXT
) \
216 define gb_Library__get_rpath
217 $(if
$(1),$(strip -Wl
,-z
,origin '-Wl,-rpath,$(1)' -L
$(INSTDIR
)/program
))
220 define gb_Library_get_rpath
221 $(call gb_Library__get_rpath
,$(call gb_LinkTarget__get_rpath_for_layer
,$(call gb_Library_get_layer
,$(1))))
224 define gb_Library_Library_platform
225 $(call gb_LinkTarget_get_target
,$(2)) : RPATH
:= $(call gb_Library_get_rpath
,$(1))
229 gb_Library__set_soversion_script_platform
= $(gb_Library__set_soversion_script
)
231 gb_Library_get_sdk_link_dir
= $(INSTDIR
)/$(SDKDIRNAME
)/lib
233 gb_Library_get_sdk_link_lib
= $(gb_Library_get_versionlink_target
)
239 gb_Executable_LAYER
:= \
240 $(foreach exe
,$(gb_Executable_UREBIN
),$(exe
):UREBIN
) \
241 $(foreach exe
,$(gb_Executable_SDK
),$(exe
):SDKBIN
) \
242 $(foreach exe
,$(gb_Executable_OOO
),$(exe
):OOO
) \
243 $(foreach exe
,$(gb_Executable_NONE
),$(exe
):NONE
) \
246 define gb_Executable__get_rpath
247 $(strip -Wl
,-z
,origin $(if
$(1),'-Wl$(COMMA)-rpath$(COMMA)$(1)') -L
$(INSTDIR
)/program
)
250 define gb_Executable_get_rpath
251 $(call gb_Executable__get_rpath
,$(call gb_LinkTarget__get_rpath_for_layer
,$(call gb_Executable_get_layer
,$(1))))
254 define gb_Executable_Executable_platform
255 $(call gb_LinkTarget_get_target
,$(2)) : RPATH
:= $(call gb_Executable_get_rpath
,$(1))
262 gb_CppunitTest_CPPTESTPRECOMMAND
:= \
263 $(call gb_Helper_extend_ld_path
,$(WORKDIR
)/UnpackedTarball
/cppunit
/src
/cppunit
/.libs
)
264 gb_CppunitTest_get_filename
= libtest_
$(1).so
265 gb_CppunitTest_get_ilibfilename
= $(gb_CppunitTest_get_filename
)
267 define gb_CppunitTest_CppunitTest_platform
268 $(call gb_LinkTarget_get_target
,$(2)) : RPATH
:= $(call gb_Library__get_rpath
,$(call gb_LinkTarget__get_rpath_for_layer
,NONE
))
272 define gb_CppunitTest_postprocess
273 $(SRCDIR
)/solenv
/bin
/gdb-core-bt.sh
$(1) $(2) $(3)
278 ifneq ($(OOO_TEST_SOFFICE
),)
279 gb_JunitTest_SOFFICEARG
:=$(OOO_TEST_SOFFICE
)
281 ifneq ($(gb_JunitTest_DEBUGRUN
),)
282 gb_JunitTest_SOFFICEARG
:=connect
:pipe
,name
=$(USER
)
284 gb_JunitTest_SOFFICEARG
:=path
:$(INSTROOT
)/$(LIBO_BIN_FOLDER
)/soffice
288 define gb_JunitTest_JunitTest_platform
289 $(call gb_JunitTest_get_target
,$(1)) : DEFS
:= \
290 -Dorg.openoffice.
test.arg.env
=$(gb_Helper_LIBRARY_PATH_VAR
)"$$$${$(gb_Helper_LIBRARY_PATH_VAR)+=$$$$$(gb_Helper_LIBRARY_PATH_VAR)}" \
291 -Dorg.openoffice.
test.arg.user
=$(call gb_Helper_make_url
,$(call gb_JunitTest_get_userdir
,$(1))) \
292 -Dorg.openoffice.
test.arg.workdir
=$(call gb_JunitTest_get_userdir
,$(1)) \
293 -Dorg.openoffice.
test.arg.postprocesscommand
=$(SRCDIR
)/solenv
/bin
/gdb-core-bt.sh \
294 -Dorg.openoffice.
test.arg.soffice
="$(gb_JunitTest_SOFFICEARG)" \
300 gb_PythonTest_PRECOMMAND
:= $(gb_CppunitTest_CPPTESTPRECOMMAND
)
304 define gb_Module_DEBUGRUNCOMMAND
305 OFFICESCRIPT
=`mktemp` && \
306 printf
". $(INSTROOT)/program/ooenv\\n" > $${OFFICESCRIPT} && \
307 printf
"gdb --tui $(INSTROOT)/$(LIBO_BIN_FOLDER)/soffice.bin" >> $${OFFICESCRIPT} && \
308 printf
" -ex \"set args --norestore --nologo '--accept=pipe,name=$(USER);urp;' \"" >> $${OFFICESCRIPT} && \
309 printf
" -ex \"r\"\\n" >> $${OFFICESCRIPT} && \
310 $(SHELL
) $${OFFICESCRIPT} && \
314 # InstallModuleTarget class
316 define gb_InstallModuleTarget_InstallModuleTarget_platform
317 $(call gb_InstallModuleTarget_add_defs
,$(1),\
321 -DSHORTSTDC3
=$(gb_SHORTSTDC3
) \
322 -DSHORTSTDCPP3
=$(gb_SHORTSTDCPP3
) \
328 # InstallScript class
330 gb_InstallScript_EXT
:= .ins
332 # CliAssemblyTarget class
334 gb_CliAssemblyTarget_POLICYEXT
:=
335 gb_CliAssemblyTarget_get_dll
:=
339 gb_Extension_LICENSEFILE_DEFAULT
:= $(INSTROOT
)/LICENSE
341 # UnpackedTarget class
343 gb_UnpackedTarget_TARFILE_LOCATION
:= $(TARFILE_LOCATION
)
345 # UnoApiHeadersTarget class
347 ifeq ($(DISABLE_DYNLOADING
),TRUE
)
348 gb_UnoApiHeadersTarget_select_variant
= $(if
$(filter udkapi
,$(1)),comprehensive
,$(2))
350 gb_UnoApiHeadersTarget_select_variant
= $(2)
353 # UIMenubarTarget class
355 define gb_UIMenubarTarget__command
356 $(call gb_Output_announce
,$(2),$(true
),UIM
,1)
361 gb_UIMenubarTarget_UIMenubarTarget_platform
:=
364 gb_Python_PRECOMMAND
:= $(gb_Helper_set_ld_path
) PYTHONHOME
="$(INSTDIR)/program/python-core-$(PYTHON_VERSION)" PYTHONPATH
="$(INSTDIR)/program/python-core-$(PYTHON_VERSION)/lib:$(INSTDIR)/program/python-core-$(PYTHON_VERSION)/lib/lib-dynload"
365 gb_Python_INSTALLED_EXECUTABLE
:= /bin
/sh
$(INSTROOT
)/program
/python
366 # this is passed to gdb as executable when running tests
367 gb_Python_INSTALLED_EXECUTABLE_GDB
:= $(INSTROOT
)/program
/python.bin
369 include $(GBUILDDIR
)/platform
/com_GCC_class.mk
371 # vim: set noet sw=4: