Branch libreoffice-5-0-4
[LibreOffice.git] / solenv / gbuild / platform / solaris.mk
blobd66345eee4d401aa1648a155cf45435183c9c079
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)
25 gb_AR := $(AR)
26 endif
28 gb_OSDEFS := \
29 -D$(OS) \
30 -DSYSV \
31 -DSUN \
32 -DSUN4 \
33 -D_REENTRANT \
34 -D_POSIX_PTHREAD_SEMANTICS \
35 -D_PTHREADS \
36 -DUNIX \
37 -DUNX \
38 $(PTHREAD_CFLAGS) \
40 gb_CFLAGS := \
41 $(gb_CFLAGS_COMMON) \
42 -fPIC \
43 -Wdeclaration-after-statement \
44 -Wshadow \
46 gb_CXXFLAGS := \
47 $(gb_CXXFLAGS_COMMON) \
48 -fPIC \
49 -Wshadow \
50 -Woverloaded-virtual \
51 $(CXXFLAGS_CXX11) \
53 # enable debug STL
54 ifeq ($(gb_ENABLE_DBGUTIL),$(true))
55 gb_COMPILERDEFS += \
56 -D_GLIBCXX_DEBUG \
58 endif
60 ifneq ($(strip $(SYSBASE)),)
61 gb_CXXFLAGS += --sysroot=$(SYSBASE)
62 gb_CFLAGS += --sysroot=$(SYSBASE)
63 gb_LinkTarget_LDFLAGS += \
64 -Wl,--sysroot=$(SYSBASE)
65 endif
67 gb_LinkTarget_LDFLAGS += \
68 -L$(SYSBASE)/lib \
69 -L$(SYSBASE)/usr/lib \
70 -Wl,-B,direct \
71 -Wl,-z,defs \
72 -Wl,-z,combreloc \
74 ifeq ($(HAVE_LD_HASH_STYLE),TRUE)
75 gb_LinkTarget_LDFLAGS += \
76 -Wl,--hash-style=$(WITH_LINKER_HASH_STYLE) \
78 endif
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 \
86 endif
88 # sun ld doesn't understand -O1 optimize flag
89 gb_LINKEROPTFLAGS :=
91 ifeq ($(gb_SYMBOL),$(true))
92 gb_LINKERSTRIPDEBUGFLAGS :=
93 else
94 gb_LINKERSTRIPDEBUGFLAGS := -Wl,-zredlocsym -Wl,-znoldynsym
95 endif
97 # LinkTarget class
99 define gb_LinkTarget__get_rpath_for_layer
100 $(patsubst $(1):%,%,$(filter $(1):%,$(gb_LinkTarget__RPATHS)))
101 endef
103 gb_LinkTarget__RPATHS := \
104 URELIB:\dORIGIN \
105 UREBIN:\dORIGIN \
106 OOO:\dORIGIN \
107 SDKBIN:\dORIGIN/../../program \
108 OXT: \
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)
117 endif
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)) \
126 $(gb_LTOFLAGS) \
127 $(if $(SOVERSIONSCRIPT),-Wl$(COMMA)-soname=$(notdir $(1)) \
129 $(subst \d,$$,$(RPATH)) \
130 $(T_LDFLAGS) \
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))) \
140 $(T_LIBS) \
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)))))) \
144 -o $(1) \
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) \
149 | cut -d' ' -f1-2 \
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))))
153 endef
155 define gb_LinkTarget__command_staticlink
156 $(call gb_Helper_abbreviate_dirs,\
157 rm -f $(1) && \
158 $(gb_AR) -rsu $(1) \
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))
167 endef
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)))
173 endef
176 # Library class
178 gb_Library_DEFS :=
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)
190 gb_STDLIBS := \
191 -lm \
192 -lnsl \
193 -lsocket \
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))
218 endef
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))))
222 endef
224 define gb_Library_Library_platform
225 $(call gb_LinkTarget_get_target,$(2)) : RPATH := $(call gb_Library_get_rpath,$(1))
227 endef
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)
235 # Executable class
237 gb_Executable_EXT :=
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)
248 endef
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))))
252 endef
254 define gb_Executable_Executable_platform
255 $(call gb_LinkTarget_get_target,$(2)) : RPATH := $(call gb_Executable_get_rpath,$(1))
257 endef
260 # CppunitTest class
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))
270 endef
272 define gb_CppunitTest_postprocess
273 $(SRCDIR)/solenv/bin/gdb-core-bt.sh $(1) $(2) $(3)
274 endef
276 # JunitTest class
278 ifneq ($(OOO_TEST_SOFFICE),)
279 gb_JunitTest_SOFFICEARG:=$(OOO_TEST_SOFFICE)
280 else
281 ifneq ($(gb_JunitTest_DEBUGRUN),)
282 gb_JunitTest_SOFFICEARG:=connect:pipe,name=$(USER)
283 else
284 gb_JunitTest_SOFFICEARG:=path:$(INSTROOT)/$(LIBO_BIN_FOLDER)/soffice
285 endif
286 endif
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)" \
296 endef
298 # PythonTest class
300 gb_PythonTest_PRECOMMAND := $(gb_CppunitTest_CPPTESTPRECOMMAND)
302 # Module class
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} && \
311 rm $${OFFICESCRIPT}
312 endef
314 # InstallModuleTarget class
316 define gb_InstallModuleTarget_InstallModuleTarget_platform
317 $(call gb_InstallModuleTarget_add_defs,$(1),\
318 $(gb_CPUDEFS) \
319 $(gb_OSDEFS) \
320 -DCOMID=gcc3 \
321 -DSHORTSTDC3=$(gb_SHORTSTDC3) \
322 -DSHORTSTDCPP3=$(gb_SHORTSTDCPP3) \
323 -D_gcc3 \
326 endef
328 # InstallScript class
330 gb_InstallScript_EXT := .ins
332 # CliAssemblyTarget class
334 gb_CliAssemblyTarget_POLICYEXT :=
335 gb_CliAssemblyTarget_get_dll :=
337 # Extension class
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))
349 else
350 gb_UnoApiHeadersTarget_select_variant = $(2)
351 endif
353 # UIMenubarTarget class
355 define gb_UIMenubarTarget__command
356 $(call gb_Output_announce,$(2),$(true),UIM,1)
357 cp $(3) $(1)
359 endef
361 gb_UIMenubarTarget_UIMenubarTarget_platform :=
363 # Python
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: