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
)
28 # do not define SOLARIS - use #ifdef __sun instead
36 -D_POSIX_PTHREAD_SEMANTICS \
49 $(gb_CXXFLAGS_COMMON
) \
52 -Woverloaded-virtual \
55 ifneq ($(strip $(SYSBASE
)),)
56 gb_CXXFLAGS
+= --sysroot
=$(SYSBASE
)
57 gb_CFLAGS
+= --sysroot
=$(SYSBASE
)
58 gb_LinkTarget_LDFLAGS
+= \
59 -Wl
,--sysroot
=$(SYSBASE
)
62 gb_LinkTarget_LDFLAGS
+= \
64 -L
$(SYSBASE
)/usr
/lib \
69 ifeq ($(HAVE_LD_HASH_STYLE
),TRUE
)
70 gb_LinkTarget_LDFLAGS
+= \
71 -Wl
,--hash-style
=$(WITH_LINKER_HASH_STYLE
) \
75 ifneq ($(HAVE_LD_BSYMBOLIC_FUNCTIONS
),)
76 gb_LinkTarget_LDFLAGS
+= -Wl
,-Bsymbolic-functions
79 # sun ld doesn't understand -O1 optimize flag
81 gb_LINKERSTRIPDEBUGFLAGS
:= -Wl
,-zredlocsym
-Wl
,-znoldynsym
85 define gb_LinkTarget__get_rpath_for_layer
86 $(patsubst $(1):%,%,$(filter $(1):%,$(gb_LinkTarget__RPATHS
)))
89 gb_LinkTarget__RPATHS
:= \
93 SDKBIN
:\dORIGIN
/..
/..
/program \
95 NONE
:\dORIGIN
/..
/Library \
97 gb_LinkTarget_CFLAGS
:= $(gb_CFLAGS
) $(gb_CFLAGS_WERROR
)
98 gb_LinkTarget_CXXFLAGS
:= $(gb_CXXFLAGS
) $(gb_CFLAGS_WERROR
)
100 # note that `cat $(extraobjectlist)` is needed to build with older gcc versions, e.g. 4.1.2 on SLED10
101 # we want to use @$(extraobjectlist) in the long run
102 # link with C compiler if there are no C++ files (pyuno_wrapper depends on this)
103 define gb_LinkTarget__command_dynamiclink
104 $(call gb_Helper_abbreviate_dirs
,\
105 $(if
$(CXXOBJECTS
)$(GENCXXOBJECTS
)$(EXTRAOBJECTLISTS
),$(gb_CXX
),$(gb_CC
)) \
106 $(if
$(filter Library CppunitTest
,$(TARGETTYPE
)),$(gb_Library_TARGETTYPEFLAGS
)) \
108 $(if
$(SOVERSIONSCRIPT
),-Wl
$(COMMA
)-soname
=$(notdir $(1)) \
110 $(subst \d
,$$,$(RPATH
)) \
111 $(T_USE_LD
) $(T_LDFLAGS
) \
112 $(foreach object
,$(COBJECTS
),$(call gb_CObject_get_target
,$(object
))) \
113 $(foreach object
,$(CXXOBJECTS
),$(call gb_CxxObject_get_target
,$(object
))) \
114 $(foreach object
,$(ASMOBJECTS
),$(call gb_AsmObject_get_target
,$(object
))) \
115 $(foreach object
,$(GENCOBJECTS
),$(call gb_GenCObject_get_target
,$(object
))) \
116 $(foreach object
,$(GENCXXOBJECTS
),$(call gb_GenCxxObject_get_target
,$(object
))) \
117 $(foreach object
,$(GENNASMOBJECTS
),$(call gb_GenNasmObject_get_target
,$(object
))) \
118 $(foreach extraobjectlist
,$(EXTRAOBJECTLISTS
),`cat $(extraobjectlist)`) \
119 -Wl
$(COMMA
)--start-group \
120 $(foreach lib
,$(LINKED_STATIC_LIBS
),\
121 $(call gb_StaticLibrary_get_target
,$(lib
))) \
123 -Wl
$(COMMA
)--end-group \
124 -Wl
$(COMMA
)-zrecord \
125 $(patsubst lib
%.a
,-l
%,$(patsubst lib
%.so
,-l
%,$(patsubst %.
$(gb_Library_UDK_MAJORVER
),%,$(foreach lib
,$(LINKED_LIBS
),$(call gb_Library_get_filename
,$(lib
)))))) \
127 $(if
$(SOVERSIONSCRIPT
),&& ln
-sf ..
/..
/program
/$(notdir $(1)) $(ILIBTARGET
)))
128 $(if
$(filter Library
,$(TARGETTYPE
)), $(call gb_Helper_abbreviate_dirs
,\
129 $(READELF
) -d
$(1) | grep SONAME
> $(WORKDIR
)/LinkTarget
/$(2).exports.tmp
; \
130 $(NM
) --dynamic
--extern-only
--defined-only
--format
=posix
$(1) \
132 >> $(WORKDIR
)/LinkTarget
/$(2).exports.tmp
&& \
133 $(call gb_Helper_replace_if_different_and_touch
,$(WORKDIR
)/LinkTarget
/$(2).exports.tmp
, \
134 $(WORKDIR
)/LinkTarget
/$(2).exports
,$(1))))
137 define gb_LinkTarget__command_staticlink
138 $(call gb_Helper_abbreviate_dirs
,\
140 $(gb_AR
) $(gb_LTOPLUGINFLAGS
) -rsu
$(1) \
141 $(foreach object
,$(COBJECTS
),$(call gb_CObject_get_target
,$(object
))) \
142 $(foreach object
,$(CXXOBJECTS
),$(call gb_CxxObject_get_target
,$(object
))) \
143 $(foreach object
,$(ASMOBJECTS
),$(call gb_AsmObject_get_target
,$(object
))) \
144 $(foreach object
,$(GENCOBJECTS
),$(call gb_GenCObject_get_target
,$(object
))) \
145 $(foreach object
,$(GENCXXOBJECTS
),$(call gb_GenCxxObject_get_target
,$(object
))) \
146 $(foreach object
,$(GENNASMOBJECTS
),$(call gb_GenNasmObject_get_target
,$(object
))) \
147 $(foreach extraobjectlist
,$(EXTRAOBJECTLISTS
),@
$(extraobjectlist
)) \
148 $(if
$(findstring s
,$(MAKEFLAGS
)),2> /dev
/null
))
151 define gb_LinkTarget__command
152 $(call gb_Output_announce
,$(2),$(true
),LNK
,4)
153 $(call gb_Trace_StartRange
,$(2),LNK
)
154 $(if
$(filter Library CppunitTest Executable
,$(TARGETTYPE
)),$(call gb_LinkTarget__command_dynamiclink
,$(1),$(2)))
155 $(if
$(filter StaticLibrary
,$(TARGETTYPE
)),$(call gb_LinkTarget__command_staticlink
,$(1)))
156 $(call gb_Trace_EndRange
,$(2),LNK
)
163 gb_Library_TARGETTYPEFLAGS
:= -shared
-Wl
,-M
/usr
/lib
/ld/map.noexstk
-mimpure-text
164 gb_Library_UDK_MAJORVER
:= 3
165 gb_Library_SYSPRE
:= lib
166 gb_Library_UNOVERPRE
:= $(gb_Library_SYSPRE
)uno_
167 gb_Library_PLAINEXT
:= .so
168 gb_Library_DLLEXT
:= .so
169 gb_Library_RTEXT
:= gcc3
$(gb_Library_PLAINEXT
)
171 gb_Library_OOOEXT
:= $(gb_Library_DLLPOSTFIX
)$(gb_Library_PLAINEXT
)
172 gb_Library_UNOEXT
:= .uno
$(gb_Library_PLAINEXT
)
179 gb_Library_FILENAMES
:= \
180 $(foreach lib
,$(gb_Library_OOOLIBS
),$(lib
):$(gb_Library_SYSPRE
)$(lib
)$(gb_Library_OOOEXT
)) \
181 $(foreach lib
,$(gb_Library_PLAINLIBS_NONE
),$(lib
):$(gb_Library_SYSPRE
)$(lib
)$(gb_Library_PLAINEXT
)) \
182 $(foreach lib
,$(gb_Library_PLAINLIBS_URE
),$(lib
):$(gb_Library_SYSPRE
)$(lib
)$(gb_Library_PLAINEXT
)) \
183 $(foreach lib
,$(gb_Library_PLAINLIBS_OOO
),$(lib
):$(gb_Library_SYSPRE
)$(lib
)$(gb_Library_PLAINEXT
)) \
184 $(foreach lib
,$(gb_Library_PLAINLIBS_OXT
),$(lib
):$(gb_Library_SYSPRE
)$(lib
)$(gb_Library_PLAINEXT
)) \
185 $(foreach lib
,$(gb_Library_PRIVATELIBS_URE
),$(lib
):$(gb_Library_SYSPRE
)$(lib
)$(gb_Library_OOOEXT
)) \
186 $(foreach lib
,$(gb_Library_RTVERLIBS
),$(lib
):$(gb_Library_SYSPRE
)$(lib
)$(gb_Library_RTEXT
).
$(gb_Library_UDK_MAJORVER
)) \
187 $(foreach lib
,$(gb_Library_UNOVERLIBS
),$(lib
):$(gb_Library_UNOVERPRE
)$(lib
)$(gb_Library_PLAINEXT
).
$(gb_Library_UDK_MAJORVER
)) \
188 $(foreach lib
,$(gb_Library_EXTENSIONLIBS
),$(lib
):$(lib
)$(gb_Library_UNOEXT
)) \
191 gb_Library_LAYER
:= \
192 $(foreach lib
,$(gb_Library_OOOLIBS
),$(lib
):OOO
) \
193 $(foreach lib
,$(gb_Library_PLAINLIBS_URE
),$(lib
):URELIB
) \
194 $(foreach lib
,$(gb_Library_PLAINLIBS_OOO
),$(lib
):OOO
) \
195 $(foreach lib
,$(gb_Library_PLAINLIBS_OXT
),$(lib
):OXT
) \
196 $(foreach lib
,$(gb_Library_PLAINLIBS_NONE
),$(lib
):NONE
) \
197 $(foreach lib
,$(gb_Library_PRIVATELIBS_URE
),$(lib
):URELIB
) \
198 $(foreach lib
,$(gb_Library_RTVERLIBS
),$(lib
):URELIB
) \
199 $(foreach lib
,$(gb_Library_UNOVERLIBS
),$(lib
):URELIB
) \
200 $(foreach lib
,$(gb_Library_EXTENSIONLIBS
),$(lib
):OXT
) \
202 define gb_Library__get_rpath
203 $(if
$(1),$(strip -Wl
,-z
,origin '-Wl,-rpath,$(1)' -L
$(INSTDIR
)/program
))
206 define gb_Library_get_rpath
207 $(call gb_Library__get_rpath
,$(call gb_LinkTarget__get_rpath_for_layer
,$(call gb_Library_get_layer
,$(1))))
210 define gb_Library_Library_platform
211 $(call gb_LinkTarget_get_target
,$(2)) : RPATH
:= $(call gb_Library_get_rpath
,$(1))
215 gb_Library__set_soversion_script_platform
= $(gb_Library__set_soversion_script
)
217 gb_Library_get_sdk_link_dir
= $(INSTDIR
)/$(SDKDIRNAME
)/lib
219 gb_Library_get_sdk_link_lib
= $(gb_Library_get_versionlink_target
)
225 gb_Executable_LAYER
:= \
226 $(foreach exe
,$(gb_Executable_UREBIN
),$(exe
):UREBIN
) \
227 $(foreach exe
,$(gb_Executable_SDK
),$(exe
):SDKBIN
) \
228 $(foreach exe
,$(gb_Executable_OOO
),$(exe
):OOO
) \
229 $(foreach exe
,$(gb_Executable_NONE
),$(exe
):NONE
) \
232 define gb_Executable__get_rpath
233 $(strip -Wl
,-z
,origin $(if
$(1),'-Wl$(COMMA)-rpath$(COMMA)$(1)') -L
$(INSTDIR
)/program
)
236 define gb_Executable_get_rpath
237 $(call gb_Executable__get_rpath
,$(call gb_LinkTarget__get_rpath_for_layer
,$(call gb_Executable_get_layer
,$(1))))
240 define gb_Executable_Executable_platform
241 $(call gb_LinkTarget_get_target
,$(2)) : RPATH
:= $(call gb_Executable_get_rpath
,$(1))
248 gb_CppunitTest_CPPTESTPRECOMMAND
:= \
249 $(call gb_Helper_extend_ld_path
,$(WORKDIR
)/UnpackedTarball
/cppunit
/src
/cppunit
/.libs
)
250 gb_CppunitTest_get_filename
= libtest_
$(1).so
251 gb_CppunitTest_get_ilibfilename
= $(gb_CppunitTest_get_filename
)
253 define gb_CppunitTest_CppunitTest_platform
254 $(call gb_LinkTarget_get_target
,$(2)) : RPATH
:= $(call gb_Library__get_rpath
,$(call gb_LinkTarget__get_rpath_for_layer
,NONE
))
258 define gb_CppunitTest_postprocess
259 $(SRCDIR
)/solenv
/bin
/gdb-core-bt.sh
$(1) $(2) $(3)
264 ifneq ($(OOO_TEST_SOFFICE
),)
265 gb_JunitTest_SOFFICEARG
:=$(OOO_TEST_SOFFICE
)
267 ifneq ($(gb_JunitTest_DEBUGRUN
),)
268 gb_JunitTest_SOFFICEARG
:=connect
:pipe
,name
=$(USER
)
270 gb_JunitTest_SOFFICEARG
:=path
:$(INSTROOT
)/$(LIBO_BIN_FOLDER
)/soffice
274 define gb_JunitTest_JunitTest_platform
275 $(call gb_JunitTest_get_target
,$(1)) : DEFS
:= \
276 -Dorg.openoffice.
test.arg.env
=$(gb_Helper_LIBRARY_PATH_VAR
)"$$$${$(gb_Helper_LIBRARY_PATH_VAR)+=$$$$$(gb_Helper_LIBRARY_PATH_VAR)}" \
277 -Dorg.openoffice.
test.arg.user
=$(call gb_Helper_make_url
,$(call gb_JunitTest_get_userdir
,$(1))) \
278 -Dorg.openoffice.
test.arg.workdir
=$(call gb_JunitTest_get_userdir
,$(1)) \
279 -Dorg.openoffice.
test.arg.postprocesscommand
=$(SRCDIR
)/solenv
/bin
/gdb-core-bt.sh \
280 -Dorg.openoffice.
test.arg.soffice
="$(gb_JunitTest_SOFFICEARG)" \
286 gb_PythonTest_PRECOMMAND
:= $(gb_CppunitTest_CPPTESTPRECOMMAND
)
290 define gb_Module_DEBUGRUNCOMMAND
291 OFFICESCRIPT
=`mktemp` && \
292 printf
". $(INSTROOT)/program/ooenv\\n" > $${OFFICESCRIPT} && \
293 printf
"gdb --tui $(INSTROOT)/$(LIBO_BIN_FOLDER)/soffice.bin" >> $${OFFICESCRIPT} && \
294 printf
" -ex \"set args --norestore --nologo '--accept=pipe,name=$(USER);urp;' \"" >> $${OFFICESCRIPT} && \
295 printf
" -ex \"r\"\\n" >> $${OFFICESCRIPT} && \
296 $(SHELL
) $${OFFICESCRIPT} && \
300 # InstallModuleTarget class
302 define gb_InstallModuleTarget_InstallModuleTarget_platform
303 $(call gb_InstallModuleTarget_add_defs
,$(1),\
312 # InstallScript class
314 gb_InstallScript_EXT
:= .ins
316 # CliAssemblyTarget class
318 gb_CliAssemblyTarget_POLICYEXT
:=
319 gb_CliAssemblyTarget_get_dll
:=
323 gb_Extension_LICENSEFILE_DEFAULT
:= $(INSTROOT
)/LICENSE
325 # UnpackedTarget class
327 gb_UnpackedTarget_TARFILE_LOCATION
:= $(TARFILE_LOCATION
)
329 # UnoApiHeadersTarget class
331 ifeq ($(DISABLE_DYNLOADING
),TRUE
)
332 gb_UnoApiHeadersTarget_select_variant
= $(if
$(filter udkapi
,$(1)),comprehensive
,$(2))
334 gb_UnoApiHeadersTarget_select_variant
= $(2)
337 # UIMenubarTarget class
339 define gb_UIMenubarTarget__command
340 $(call gb_Output_announce
,$(2),$(true
),UIM
,1)
341 $(call gb_Trace_StartRange
,$(2),UIM
)
343 $(call gb_Trace_EndRange
,$(2),UIM
)
347 gb_UIMenubarTarget_UIMenubarTarget_platform
:=
350 gb_Python_PRECOMMAND
:= 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"
351 gb_Python_INSTALLED_EXECUTABLE
:= /bin
/sh
$(INSTROOT
)/program
/python
352 # this is passed to gdb as executable when running tests
353 gb_Python_INSTALLED_EXECUTABLE_GDB
:= $(INSTROOT
)/program
/python.bin
355 include $(GBUILDDIR
)/platform
/com_GCC_class.mk
357 # vim: set noet sw=4: