xref: /trunk/main/solenv/gbuild/platform/solaris.mk (revision 828da808)
1#*************************************************************************
2#
3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4#
5# Copyright 2000, 2011 Oracle and/or its affiliates.
6#
7# OpenOffice.org - a multi-platform office productivity suite
8#
9# This file is part of OpenOffice.org.
10#
11# OpenOffice.org is free software: you can redistribute it and/or modify
12# it under the terms of the GNU Lesser General Public License version 3
13# only, as published by the Free Software Foundation.
14#
15# OpenOffice.org is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18# GNU Lesser General Public License version 3 for more details
19# (a copy is included in the LICENSE file that accompanied this code).
20#
21# You should have received a copy of the GNU Lesser General Public License
22# version 3 along with OpenOffice.org.  If not, see
23# <http://www.openoffice.org/license.html>
24# for a copy of the LGPLv3 License.
25#
26#*************************************************************************
27
28GUI := UNX
29COM := C52
30
31gb_MKTEMP := mktemp -t gbuild.XXXXXX
32
33gb_CC := cc
34gb_CXX := CC
35gb_GCCP := cc
36gb_AR := ar
37gb_AWK := /usr/xpg4/bin/awk
38gb_CLASSPATHSEP := :
39
40# use CC/CXX if they are nondefaults
41ifneq ($(origin CC),default)
42gb_CC := $(CC)
43gb_GCCP := $(CC)
44endif
45ifneq ($(origin CXX),default)
46gb_CXX := $(CXX)
47endif
48
49gb_OSDEFS := \
50	-D$(OS) \
51	-D$(GUI) \
52	-DSYSV \
53	-DSUN \
54	-DSUN4 \
55	-D_REENTRANT \
56	-D_POSIX_PTHREAD_SEMANTICS \
57	-D_PTHREADS \
58	-DUNIX \
59
60gb_COMPILERDEFS := \
61	-D$(COM) \
62	-DCPPU_ENV=sunpro5 \
63
64gb_CPUDEFS := -D$(CPUNAME)
65ifeq ($(CPUNAME),SPARC)
66gb_CPUDEFS += -D__sparcv8plus
67endif
68
69gb_CFLAGS := \
70	-temp=/tmp \
71	-KPIC \
72	-mt \
73	-xldscope=hidden \
74	-xCC \
75	-xc99=none \
76
77gb_CXXFLAGS := \
78	-temp=/tmp \
79	-KPIC \
80	-mt \
81	-xldscope=hidden \
82	-features=no%altspell \
83	-library=no%Cstd \
84	+w2 \
85	-erroff=doubunder,identexpected,inllargeuse,inllargeint,notemsource,reftotemp,truncwarn,wnoretvalue,anonnotype \
86
87ifneq ($(EXTERNAL_WARNINGS_NOT_ERRORS),TRUE)
88gb_CFLAGS_WERROR := -errwarn=%all
89gb_CXXFLAGS_WERROR := -xwe
90endif
91
92gb_LinkTarget_EXCEPTIONFLAGS := \
93	-DEXCEPTIONS_ON \
94
95gb_LinkTarget_NOEXCEPTIONFLAGS := \
96	-DEXCEPTIONS_OFF \
97	-noex \
98
99gb_LinkTarget_LDFLAGS := \
100	$(subst -L../lib , ,$(SOLARLIB)) \
101	-temp=/tmp \
102	-w \
103	-mt \
104	-Bdirect \
105	-z defs \
106	-z combreloc \
107	-norunpath \
108	-PIC \
109	-library=no%Cstd \
110
111ifeq ($(gb_DEBUGLEVEL),2)
112gb_COMPILEROPTFLAGS :=
113else
114ifeq ($(CPUNAME),INTEL)
115gb_COMPILEROPTFLAGS := -xarch=generic -xO3
116else # ifeq ($(CPUNAME),SPARC)
117#  -m32 -xarch=sparc        restrict target to 32 bit sparc
118#  -xO3                     optimization level 3
119#  -xspace                  don't do optimizations which do increase binary size
120#  -xprefetch=yes           do prefetching (helps on UltraSparc III)
121gb_COMPILEROPTFLAGS := -m32 -xarch=sparc -xO3 -xspace -xprefetch=yes
122endif
123endif
124
125gb_COMPILERNOOPTFLAGS :=
126
127# Helper class
128
129gb_Helper_abbreviate_dirs_native = $(gb_Helper_abbreviate_dirs)
130
131# convert parametters filesystem root to native notation
132# does some real work only on windows, make sure not to
133# break the dummy implementations on unx*
134define gb_Helper_convert_native
135$(1)
136endef
137
138
139# CObject class
140
141define gb_CObject__command
142$(call gb_Output_announce,$(2),$(true),C  ,3)
143$(call gb_Helper_abbreviate_dirs,\
144	mkdir -p $(dir $(1)) && \
145	rm -f $(call gb_CObject_get_dep_target,$(2)) && \
146	mkdir -p $(dir $(call gb_CObject_get_dep_target,$(2))) && \
147	$(gb_CC) \
148		-c $(3) \
149		-o $(1) \
150		-xMMD \
151		-xMF $(call gb_CObject_get_dep_target,$(2)) \
152		$(DEFS) $(CFLAGS) \
153		-I$(dir $(3)) \
154		$(INCLUDE))
155endef
156
157
158# CxxObject class
159
160define gb_CxxObject__command
161$(call gb_Output_announce,$(2),$(true),CXX,3)
162$(call gb_Helper_abbreviate_dirs,\
163	mkdir -p $(dir $(1)) && \
164	mkdir -p $(dir $(call gb_CxxObject_get_dep_target,$(2))) && \
165	$(gb_CXX) \
166		$(DEFS) $(CXXFLAGS) \
167		-c $(3) \
168		-o $(1) \
169		-xMMD \
170		-xMF $(call gb_CxxObject_get_dep_target,$(2)) \
171		-I$(dir $(3)) \
172		$(INCLUDE_STL) $(INCLUDE))
173endef
174
175
176# LinkTarget class
177
178define gb_LinkTarget__get_rpath_for_layer
179$(patsubst $(1):%,%,$(filter $(1):%,$(gb_LinkTarget__RPATHS)))
180endef
181
182gb_LinkTarget__RPATHS := \
183	URELIB:\dORIGIN \
184	UREBIN:\dORIGIN/../lib:\dORIGIN \
185	OOO:\dORIGIN:\dORIGIN/../ure-link/lib \
186	BRAND:\dORIGIN:\dORIGIN/../basis-link/program:\dORIGIN/../basis-link/ure-link/lib \
187	SDKBIN:\dORIGIN/../../ure-link/lib \
188	NONEBIN:\dORIGIN/../lib:\dORIGIN \
189
190gb_LinkTarget_CFLAGS := $(gb_CFLAGS) $(gb_CFLAGS_WERROR) $(gb_COMPILEROPTFLAGS)
191gb_LinkTarget_CXXFLAGS := $(gb_CXXFLAGS) $(gb_CXXFLAGS_WERROR)
192
193ifeq ($(gb_DEBUGLEVEL),2)
194gb_LinkTarget_CXXFLAGS += -g
195gb_LinkTarget_CFLAGS += -g
196endif
197
198gb_LinkTarget_INCLUDE := $(filter-out %/stl, $(subst -I. , ,$(SOLARINC)))
199gb_LinkTarget_INCLUDE_STL := $(filter %/stl, $(subst -I. , ,$(SOLARINC)))
200
201define gb_LinkTarget__command_dynamiclink
202$(call gb_Helper_abbreviate_dirs,\
203	mkdir -p $(dir $(1)) && \
204	$(gb_CXX) \
205		$(if $(filter Library CppunitTest,$(TARGETTYPE)),$(gb_Library_TARGETTYPEFLAGS)) \
206		$(subst \d,$$,$(RPATH)) $(LDFLAGS) \
207		$(patsubst lib%.so,-l%,$(foreach lib,$(LINKED_LIBS),$(call gb_Library_get_filename,$(lib)))) \
208		$(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
209		$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
210		$(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
211		$(foreach lib,$(LINKED_STATIC_LIBS),$(call gb_StaticLibrary_get_target,$(lib))) \
212		-o $(1))
213endef
214
215define gb_LinkTarget__command_staticlink
216$(call gb_Helper_abbreviate_dirs,\
217	mkdir -p $(dir $(1)) && \
218	$(gb_AR) -rsu $(1) \
219		$(foreach object,$(COBJECTS),$(call gb_CObject_get_target,$(object))) \
220		$(foreach object,$(CXXOBJECTS),$(call gb_CxxObject_get_target,$(object))) \
221		$(foreach object,$(GENCXXOBJECTS),$(call gb_GenCxxObject_get_target,$(object))) \
222		2> /dev/null)
223endef
224
225define gb_LinkTarget__command
226$(call gb_Output_announce,$(2),$(true),LNK,4)
227$(if $(filter Library CppunitTest Executable,$(TARGETTYPE)),$(call gb_LinkTarget__command_dynamiclink,$(1)))
228$(if $(filter StaticLibrary,$(TARGETTYPE)),$(call gb_LinkTarget__command_staticlink,$(1)))
229endef
230
231# Library class
232
233gb_Library_DEFS :=
234gb_Library_TARGETTYPEFLAGS := -Bdynamic -z text -G
235gb_Library_SYSPRE := lib
236gb_Library_UNOVERPRE := $(gb_Library_SYSPRE)uno_
237gb_Library_PLAINEXT := .so
238gb_Library_RTEXT := C52$(gb_Library_PLAINEXT)
239ifeq ($(gb_PRODUCT),$(true))
240gb_Library_STLEXT := port_sunpro$(gb_Library_PLAINEXT)
241else
242gb_Library_STLEXT := port_sunpro_debug$(gb_Library_PLAINEXT)
243endif
244
245ifeq ($(CPUNAME),INTEL)
246gb_Library_OOOEXT := $(gb_Library_PLAINEXT)
247gb_Library_UNOEXT := .uno$(gb_Library_PLAINEXT)
248else # ifeq ($(CPUNAME),SPARC)
249gb_Library_OOOEXT := $(gb_Library_PLAINEXT)
250gb_Library_UNOEXT := .uno$(gb_Library_PLAINEXT)
251endif
252
253gb_STDLIBS := \
254	Crun \
255	m \
256	c \
257
258gb_Library_PLAINLIBS_NONE += \
259	$(gb_STDLIBS) \
260	dl \
261    freetype \
262	jpeg \
263	pthread \
264	X11 \
265    Xext \
266    SM \
267    ICE \
268	z \
269	cppunit
270
271gb_Library_FILENAMES := \
272	$(foreach lib,$(gb_Library_OOOLIBS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_OOOEXT)) \
273	$(foreach lib,$(gb_Library_PLAINLIBS_NONE),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \
274	$(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \
275	$(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \
276	$(foreach lib,$(gb_Library_RTLIBS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_RTEXT)) \
277	$(foreach lib,$(gb_Library_RTVERLIBS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_RTEXT)) \
278	$(foreach lib,$(gb_Library_STLLIBS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_STLEXT)) \
279	$(foreach lib,$(gb_Library_UNOLIBS_URE),$(lib):$(lib)$(gb_Library_UNOEXT)) \
280	$(foreach lib,$(gb_Library_UNOLIBS_OOO),$(lib):$(lib)$(gb_Library_UNOEXT)) \
281	$(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):$(gb_Library_UNOVERPRE)$(lib)$(gb_Library_PLAINEXT)) \
282
283
284gb_Library_LAYER := \
285	$(foreach lib,$(gb_Library_OOOLIBS),$(lib):OOO) \
286	$(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):URELIB) \
287	$(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):OOO) \
288	$(foreach lib,$(gb_Library_RTLIBS),$(lib):OOO) \
289	$(foreach lib,$(gb_Library_RTVERLIBS),$(lib):URELIB) \
290	$(foreach lib,$(gb_Library_STLLIBS),$(lib):URELIB) \
291	$(foreach lib,$(gb_Library_UNOLIBS_URE),$(lib):URELIB) \
292	$(foreach lib,$(gb_Library_UNOLIBS_OOO),$(lib):OOO) \
293	$(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):URELIB) \
294
295define gb_Library_get_rpath
296'-R$(call gb_LinkTarget__get_rpath_for_layer,$(call gb_Library_get_layer,$(1)))'
297endef
298
299define gb_Library_Library_platform
300$(call gb_LinkTarget_get_target,$(2)) : RPATH := $(call gb_Library_get_rpath,$(1))
301
302endef
303
304
305# StaticLibrary class
306
307gb_StaticLibrary_DEFS :=
308gb_StaticLibrary_SYSPRE := lib
309gb_StaticLibrary_PLAINEXT := .a
310gb_StaticLibrary_JPEGEXT := lib$(gb_StaticLibrary_PLAINEXT)
311
312gb_StaticLibrary_FILENAMES := \
313	$(foreach lib,$(gb_StaticLibrary_JPEGLIBS),$(lib):$(gb_StaticLibrary_SYSPRE)$(lib)$(gb_StaticLibrary_JPEGEXT)) \
314	$(foreach lib,$(gb_StaticLibrary_PLAINLIBS),$(lib):$(gb_StaticLibrary_SYSPRE)$(lib)$(gb_StaticLibrary_PLAINEXT)) \
315
316gb_StaticLibrary_StaticLibrary_platform =
317
318
319# Executable class
320
321gb_Executable_EXT :=
322
323gb_Executable_LAYER := \
324	$(foreach exe,$(gb_Executable_UREBIN),$(exe):UREBIN) \
325	$(foreach exe,$(gb_Executable_SDK),$(exe):SDKBIN) \
326	$(foreach exe,$(gb_Executable_OOO),$(exe):OOO) \
327	$(foreach exe,$(gb_Executable_BRAND),$(exe):BRAND) \
328	$(foreach exe,$(gb_Executable_NONE),$(exe):NONEBIN) \
329
330
331define gb_Executable_get_rpath
332'-R$(call gb_LinkTarget__get_rpath_for_layer,$(call gb_Executable_get_layer,$(1)))'
333endef
334
335define gb_Executable_Executable_platform
336$(call gb_LinkTarget_get_target,$(2)) : RPATH := $(call gb_Executable_get_rpath,$(1))
337
338endef
339
340
341# CppunitTest class
342
343gb_CppunitTest_CPPTESTPRECOMMAND := LD_LIBRARY_PATH=$(OUTDIR)/lib
344gb_CppunitTest_SYSPRE := libtest_
345gb_CppunitTest_EXT := .so
346gb_CppunitTest_get_filename = $(gb_CppunitTest_SYSPRE)$(1)$(gb_CppunitTest_EXT)
347gb_CppunitTest_get_libfilename = $(gb_CppunitTest_get_filename)
348
349define gb_CppunitTest_CppunitTest_platform
350$(call gb_LinkTarget_get_target,$(2)) : RPATH :=
351
352endef
353
354# JunitTest class
355
356define gb_JunitTest_JunitTest_platform
357$(call gb_JunitTest_get_target,$(1)) : DEFS := \
358	-Dorg.openoffice.test.arg.soffice="$$$${OOO_TEST_SOFFICE:-path:$(OUTDIR)/installation/opt/openoffice.org3/program/soffice}" \
359    -Dorg.openoffice.test.arg.env=LD_LIBRARY_PATH \
360    -Dorg.openoffice.test.arg.user=file://$(call gb_JunitTest_get_userdir,$(1)) \
361
362endef
363
364# SdiTarget class
365
366gb_SdiTarget_SVIDLPRECOMMAND := LD_LIBRARY_PATH=$(OUTDIR)/lib
367
368# SrsPartMergeTarget
369
370gb_SrsPartMergeTarget_TRANSEXPRECOMMAND := LD_LIBRARY_PATH=$(OUTDIR)/lib
371
372# SrsPartTarget class
373
374gb_SrsPartTarget_RSCTARGET := $(OUTDIR)/bin/rsc
375gb_SrsPartTarget_RSCCOMMAND := LD_LIBRARY_PATH=$(OUTDIR)/lib SOLARBINDIR=$(OUTDIR)/bin $(gb_SrsPartTarget_RSCTARGET)
376
377# Sun cc/CC support -xM1/-xMF flags, but unfortunately refuse input files that
378# do not have the right suffix, so use makedepend here...
379define gb_SrsPartTarget__command_dep
380$(call gb_Helper_abbreviate_dirs_native,\
381	$(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
382		$(INCLUDE) \
383		$(DEFS) \
384		$(2) \
385		-f - \
386	| $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
387		-v OBJECTFILE=$(call gb_SrsPartTarget_get_target,$(1)) \
388		-v OUTDIR=$(OUTDIR)/ \
389		-v WORKDIR=$(WORKDIR)/ \
390		-v SRCDIR=$(SRCDIR)/ \
391		-v REPODIR=$(REPODIR)/ \
392	> $(call gb_SrsPartTarget_get_dep_target,$(1)))
393endef
394
395
396# ComponentTarget
397
398gb_XSLTPROCPRECOMMAND := LD_LIBRARY_PATH=$(OUTDIR)/lib
399gb_Library_COMPONENTPREFIXES := \
400    OOO:vnd.sun.star.expand:\dOOO_BASE_DIR/program/ \
401    URELIB:vnd.sun.star.expand:\dURE_INTERNAL_LIB_DIR/ \
402
403
404# vim: set noet sw=4 ts=4:
405