tdf#144694 In direct SQL dialog, activate options 'Run SQL command
[LibreOffice.git] / solenv / gbuild / platform / solaris.mk
blob3d3d58e2b55fe3dd33a3fc96c7bf531a0ab79d0c
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 # do not define SOLARIS - use #ifdef __sun instead
29 # -D$(OS) \
31 gb_OSDEFS := \
32 -DSYSV \
33 -DSUN \
34 -DSUN4 \
35 -D_REENTRANT \
36 -D_POSIX_PTHREAD_SEMANTICS \
37 -D_PTHREADS \
38 -DUNIX \
39 -DUNX \
40 $(PTHREAD_CFLAGS) \
41 $(LFS_CFLAGS) \
43 gb_CFLAGS := \
44 $(gb_CFLAGS_COMMON) \
45 -fPIC \
46 -Wshadow \
48 gb_CXXFLAGS := \
49 $(gb_CXXFLAGS_COMMON) \
50 -fPIC \
51 -Wshadow \
52 -Woverloaded-virtual \
53 $(CXXFLAGS_CXX11) \
55 ifneq ($(strip $(SYSBASE)),)
56 gb_CXXFLAGS += --sysroot=$(SYSBASE)
57 gb_CFLAGS += --sysroot=$(SYSBASE)
58 gb_LinkTarget_LDFLAGS += \
59 -Wl,--sysroot=$(SYSBASE)
60 endif
62 gb_LinkTarget_LDFLAGS += \
63 -L$(SYSBASE)/lib \
64 -L$(SYSBASE)/usr/lib \
65 -Wl,-B,direct \
66 -Wl,-z,defs \
67 -Wl,-z,combreloc \
69 ifeq ($(HAVE_LD_HASH_STYLE),TRUE)
70 gb_LinkTarget_LDFLAGS += \
71 -Wl,--hash-style=$(WITH_LINKER_HASH_STYLE) \
73 endif
75 ifneq ($(HAVE_LD_BSYMBOLIC_FUNCTIONS),)
76 gb_LinkTarget_LDFLAGS += -Wl,-Bsymbolic-functions
77 endif
79 # sun ld doesn't understand -O1 optimize flag
80 gb_LINKEROPTFLAGS :=
81 gb_LINKERSTRIPDEBUGFLAGS := -Wl,-zredlocsym -Wl,-znoldynsym
83 # LinkTarget class
85 define gb_LinkTarget__get_rpath_for_layer
86 $(patsubst $(1):%,%,$(filter $(1):%,$(gb_LinkTarget__RPATHS)))
87 endef
89 gb_LinkTarget__RPATHS := \
90 URELIB:\dORIGIN \
91 UREBIN:\dORIGIN \
92 OOO:\dORIGIN \
93 SDKBIN:\dORIGIN/../../program \
94 OXT: \
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)) \
107 $(T_LTOFLAGS) \
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,$(GENASMOBJECTS),$(call gb_GenAsmObject_get_target,$(object))) \
118 $(foreach object,$(GENNASMOBJECTS),$(call gb_GenNasmObject_get_target,$(object))) \
119 $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),`cat $(extraobjectlist)`) \
120 -Wl$(COMMA)--start-group \
121 $(foreach lib,$(LINKED_STATIC_LIBS),\
122 $(call gb_StaticLibrary_get_target,$(lib))) \
123 $(T_LIBS) \
124 -Wl$(COMMA)--end-group \
125 -Wl$(COMMA)-zrecord \
126 $(patsubst lib%.a,-l%,$(patsubst lib%.so,-l%,$(patsubst %.$(gb_Library_UDK_MAJORVER),%,$(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_filename,$(lib)))))) \
127 -o $(1) \
128 $(if $(SOVERSIONSCRIPT),&& ln -sf ../../program/$(notdir $(1)) $(ILIBTARGET)))
129 $(if $(filter Library,$(TARGETTYPE)), $(call gb_Helper_abbreviate_dirs,\
130 $(READELF) -d $(1) | grep SONAME > $(WORKDIR)/LinkTarget/$(2).exports.tmp; \
131 $(NM) --dynamic --extern-only --defined-only --format=posix $(1) \
132 | cut -d' ' -f1-2 \
133 >> $(WORKDIR)/LinkTarget/$(2).exports.tmp && \
134 $(call gb_Helper_replace_if_different_and_touch,$(WORKDIR)/LinkTarget/$(2).exports.tmp, \
135 $(WORKDIR)/LinkTarget/$(2).exports,$(1))))
136 endef
138 define gb_LinkTarget__command_staticlink
139 $(call gb_Helper_abbreviate_dirs,\
140 rm -f $(1) && \
141 $(gb_AR) $(gb_LTOPLUGINFLAGS) -rsu $(1) \
142 $(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
143 $(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
144 $(foreach object,$(ASMOBJECTS),$(call gb_AsmObject_get_target,$(object))) \
145 $(foreach object,$(GENCOBJECTS),$(call gb_GenCObject_get_target,$(object))) \
146 $(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
147 $(foreach object,$(GENASMOBJECTS),$(call gb_GenAsmObject_get_target,$(object))) \
148 $(foreach object,$(GENNASMOBJECTS),$(call gb_GenNasmObject_get_target,$(object))) \
149 $(foreach extraobjectlist,$(EXTRAOBJECTLISTS),@$(extraobjectlist)) \
150 $(if $(findstring s,$(MAKEFLAGS)),2> /dev/null))
151 endef
153 define gb_LinkTarget__command
154 $(call gb_Output_announce,$(2),$(true),LNK,4)
155 $(call gb_Trace_StartRange,$(2),LNK)
156 $(if $(filter Library CppunitTest Executable,$(TARGETTYPE)),$(call gb_LinkTarget__command_dynamiclink,$(1),$(2)))
157 $(if $(filter StaticLibrary,$(TARGETTYPE)),$(call gb_LinkTarget__command_staticlink,$(1)))
158 $(call gb_Trace_EndRange,$(2),LNK)
159 endef
162 # Library class
164 gb_Library_DEFS :=
165 gb_Library_TARGETTYPEFLAGS := -shared -Wl,-M/usr/lib/ld/map.noexstk -mimpure-text
166 gb_Library_UDK_MAJORVER := 3
167 gb_Library_SYSPRE := lib
168 gb_Library_UNOVERPRE := $(gb_Library_SYSPRE)uno_
169 gb_Library_PLAINEXT := .so
170 gb_Library_DLLEXT := .so
171 gb_Library_RTEXT := gcc3$(gb_Library_PLAINEXT)
173 gb_Library_OOOEXT := $(gb_Library_DLLPOSTFIX)$(gb_Library_PLAINEXT)
174 gb_Library_UNOEXT := .uno$(gb_Library_PLAINEXT)
176 gb_STDLIBS := \
177 -lm \
178 -lnsl \
179 -lsocket \
181 gb_Library_FILENAMES := \
182 $(foreach lib,$(gb_Library_OOOLIBS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_OOOEXT)) \
183 $(foreach lib,$(gb_Library_PLAINLIBS_NONE),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \
184 $(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \
185 $(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \
186 $(foreach lib,$(gb_Library_PLAINLIBS_OXT),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \
187 $(foreach lib,$(gb_Library_PRIVATELIBS_URE),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_OOOEXT)) \
188 $(foreach lib,$(gb_Library_RTVERLIBS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_RTEXT).$(gb_Library_UDK_MAJORVER)) \
189 $(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):$(gb_Library_UNOVERPRE)$(lib)$(gb_Library_PLAINEXT).$(gb_Library_UDK_MAJORVER)) \
190 $(foreach lib,$(gb_Library_EXTENSIONLIBS),$(lib):$(lib)$(gb_Library_UNOEXT)) \
193 gb_Library_LAYER := \
194 $(foreach lib,$(gb_Library_OOOLIBS),$(lib):OOO) \
195 $(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):URELIB) \
196 $(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):OOO) \
197 $(foreach lib,$(gb_Library_PLAINLIBS_OXT),$(lib):OXT) \
198 $(foreach lib,$(gb_Library_PLAINLIBS_NONE),$(lib):NONE) \
199 $(foreach lib,$(gb_Library_PRIVATELIBS_URE),$(lib):URELIB) \
200 $(foreach lib,$(gb_Library_RTVERLIBS),$(lib):URELIB) \
201 $(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):URELIB) \
202 $(foreach lib,$(gb_Library_EXTENSIONLIBS),$(lib):OXT) \
204 define gb_Library__get_rpath
205 $(if $(1),$(strip -Wl,-z,origin '-Wl,-rpath,$(1)' -L$(INSTDIR)/program))
206 endef
208 define gb_Library_get_rpath
209 $(call gb_Library__get_rpath,$(call gb_LinkTarget__get_rpath_for_layer,$(call gb_Library_get_layer,$(1))))
210 endef
212 define gb_Library_Library_platform
213 $(call gb_LinkTarget_get_target,$(2)) : RPATH := $(call gb_Library_get_rpath,$(1))
215 endef
217 gb_Library__set_soversion_script_platform = $(gb_Library__set_soversion_script)
219 gb_Library_get_sdk_link_dir = $(INSTDIR)/$(SDKDIRNAME)/lib
221 gb_Library_get_sdk_link_lib = $(gb_Library_get_versionlink_target)
223 # Executable class
225 gb_Executable_EXT :=
227 gb_Executable_LAYER := \
228 $(foreach exe,$(gb_Executable_UREBIN),$(exe):UREBIN) \
229 $(foreach exe,$(gb_Executable_SDK),$(exe):SDKBIN) \
230 $(foreach exe,$(gb_Executable_OOO),$(exe):OOO) \
231 $(foreach exe,$(gb_Executable_NONE),$(exe):NONE) \
234 define gb_Executable__get_rpath
235 $(strip -Wl,-z,origin $(if $(1),'-Wl$(COMMA)-rpath$(COMMA)$(1)') -L$(INSTDIR)/program)
236 endef
238 define gb_Executable_get_rpath
239 $(call gb_Executable__get_rpath,$(call gb_LinkTarget__get_rpath_for_layer,$(call gb_Executable_get_layer,$(1))))
240 endef
242 define gb_Executable_Executable_platform
243 $(call gb_LinkTarget_get_target,$(2)) : RPATH := $(call gb_Executable_get_rpath,$(1))
245 endef
248 # CppunitTest class
250 gb_CppunitTest_CPPTESTPRECOMMAND := \
251 $(call gb_Helper_extend_ld_path,$(WORKDIR)/UnpackedTarball/cppunit/src/cppunit/.libs)
252 gb_CppunitTest_get_filename = libtest_$(1).so
253 gb_CppunitTest_get_ilibfilename = $(gb_CppunitTest_get_filename)
255 define gb_CppunitTest_CppunitTest_platform
256 $(call gb_LinkTarget_get_target,$(2)) : RPATH := $(call gb_Library__get_rpath,$(call gb_LinkTarget__get_rpath_for_layer,NONE))
258 endef
260 define gb_CppunitTest_postprocess
261 $(SRCDIR)/solenv/bin/gdb-core-bt.sh $(1) $(2) $(3)
262 endef
264 # JunitTest class
266 ifneq ($(OOO_TEST_SOFFICE),)
267 gb_JunitTest_SOFFICEARG:=$(OOO_TEST_SOFFICE)
268 else
269 ifneq ($(gb_JunitTest_DEBUGRUN),)
270 gb_JunitTest_SOFFICEARG:=connect:pipe,name=$(USER)
271 else
272 gb_JunitTest_SOFFICEARG:=path:$(INSTROOT)/$(LIBO_BIN_FOLDER)/soffice
273 endif
274 endif
276 define gb_JunitTest_JunitTest_platform
277 $(call gb_JunitTest_get_target,$(1)) : DEFS := \
278 -Dorg.openoffice.test.arg.env=$(gb_Helper_LIBRARY_PATH_VAR)"$$$${$(gb_Helper_LIBRARY_PATH_VAR)+=$$$$$(gb_Helper_LIBRARY_PATH_VAR)}" \
279 -Dorg.openoffice.test.arg.user=$(call gb_Helper_make_url,$(call gb_JunitTest_get_userdir,$(1))) \
280 -Dorg.openoffice.test.arg.workdir=$(call gb_JunitTest_get_userdir,$(1)) \
281 -Dorg.openoffice.test.arg.postprocesscommand=$(SRCDIR)/solenv/bin/gdb-core-bt.sh \
282 -Dorg.openoffice.test.arg.soffice="$(gb_JunitTest_SOFFICEARG)" \
284 endef
286 # PythonTest class
288 gb_PythonTest_PRECOMMAND := $(gb_CppunitTest_CPPTESTPRECOMMAND)
290 # Module class
292 define gb_Module_DEBUGRUNCOMMAND
293 OFFICESCRIPT=`mktemp` && \
294 printf ". $(INSTROOT)/program/ooenv\\n" > $${OFFICESCRIPT} && \
295 printf "gdb --tui $(INSTROOT)/$(LIBO_BIN_FOLDER)/soffice.bin" >> $${OFFICESCRIPT} && \
296 printf " -ex \"set args --norestore --nologo '--accept=pipe,name=$(USER);urp;' \"" >> $${OFFICESCRIPT} && \
297 printf " -ex \"r\"\\n" >> $${OFFICESCRIPT} && \
298 $(SHELL) $${OFFICESCRIPT} && \
299 rm $${OFFICESCRIPT}
300 endef
302 # InstallModuleTarget class
304 define gb_InstallModuleTarget_InstallModuleTarget_platform
305 $(call gb_InstallModuleTarget_add_defs,$(1),\
306 $(gb_CPUDEFS) \
307 $(gb_OSDEFS) \
308 -DCOMID=gcc3 \
309 -D_gcc3 \
312 endef
314 # InstallScript class
316 gb_InstallScript_EXT := .ins
318 # CliAssemblyTarget class
320 gb_CliAssemblyTarget_POLICYEXT :=
321 gb_CliAssemblyTarget_get_dll :=
323 # Extension class
325 gb_Extension_LICENSEFILE_DEFAULT := $(INSTROOT)/LICENSE
327 # UnpackedTarget class
329 gb_UnpackedTarget_TARFILE_LOCATION := $(TARFILE_LOCATION)
331 # UIMenubarTarget class
333 define gb_UIMenubarTarget__command
334 $(call gb_Output_announce,$(2),$(true),UIM,1)
335 $(call gb_Trace_StartRange,$(2),UIM)
336 cp $(3) $(1)
337 $(call gb_Trace_EndRange,$(2),UIM)
339 endef
341 gb_UIMenubarTarget_UIMenubarTarget_platform :=
343 # Python
344 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"
345 gb_Python_INSTALLED_EXECUTABLE := /bin/sh $(INSTROOT)/program/python
346 # this is passed to gdb as executable when running tests
347 gb_Python_INSTALLED_EXECUTABLE_GDB := $(INSTROOT)/program/python.bin
349 include $(GBUILDDIR)/platform/com_GCC_class.mk
351 # vim: set noet sw=4: