xref: /aoo41x/main/solenv/gbuild/platform/solaris.mk (revision cdf0e10c)
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 := si$(gb_Library_PLAINEXT)
247gb_Library_UNOEXT := .uno$(gb_Library_PLAINEXT)
248else # ifeq ($(CPUNAME),SPARC)
249gb_Library_OOOEXT := ss$(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
270gb_Library_FILENAMES := \
271	$(foreach lib,$(gb_Library_OOOLIBS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_OOOEXT)) \
272	$(foreach lib,$(gb_Library_PLAINLIBS_NONE),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \
273	$(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \
274	$(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_PLAINEXT)) \
275	$(foreach lib,$(gb_Library_RTLIBS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_RTEXT)) \
276	$(foreach lib,$(gb_Library_RTVERLIBS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_RTEXT)) \
277	$(foreach lib,$(gb_Library_STLLIBS),$(lib):$(gb_Library_SYSPRE)$(lib)$(gb_Library_STLEXT)) \
278	$(foreach lib,$(gb_Library_UNOLIBS_URE),$(lib):$(lib)$(gb_Library_UNOEXT)) \
279	$(foreach lib,$(gb_Library_UNOLIBS_OOO),$(lib):$(lib)$(gb_Library_UNOEXT)) \
280	$(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):$(gb_Library_UNOVERPRE)$(lib)$(gb_Library_PLAINEXT)) \
281
282
283gb_Library_LAYER := \
284	$(foreach lib,$(gb_Library_OOOLIBS),$(lib):OOO) \
285	$(foreach lib,$(gb_Library_PLAINLIBS_URE),$(lib):URELIB) \
286	$(foreach lib,$(gb_Library_PLAINLIBS_OOO),$(lib):OOO) \
287	$(foreach lib,$(gb_Library_RTLIBS),$(lib):OOO) \
288	$(foreach lib,$(gb_Library_RTVERLIBS),$(lib):URELIB) \
289	$(foreach lib,$(gb_Library_STLLIBS),$(lib):URELIB) \
290	$(foreach lib,$(gb_Library_UNOLIBS_URE),$(lib):URELIB) \
291	$(foreach lib,$(gb_Library_UNOLIBS_OOO),$(lib):OOO) \
292	$(foreach lib,$(gb_Library_UNOVERLIBS),$(lib):URELIB) \
293
294define gb_Library_get_rpath
295'-R$(call gb_LinkTarget__get_rpath_for_layer,$(call gb_Library_get_layer,$(1)))'
296endef
297
298define gb_Library_Library_platform
299$(call gb_LinkTarget_get_target,$(2)) : RPATH := $(call gb_Library_get_rpath,$(1))
300
301endef
302
303
304# StaticLibrary class
305
306gb_StaticLibrary_DEFS :=
307gb_StaticLibrary_SYSPRE := lib
308gb_StaticLibrary_PLAINEXT := .a
309gb_StaticLibrary_JPEGEXT := lib$(gb_StaticLibrary_PLAINEXT)
310
311gb_StaticLibrary_FILENAMES := \
312	$(foreach lib,$(gb_StaticLibrary_JPEGLIBS),$(lib):$(gb_StaticLibrary_SYSPRE)$(lib)$(gb_StaticLibrary_JPEGEXT)) \
313	$(foreach lib,$(gb_StaticLibrary_PLAINLIBS),$(lib):$(gb_StaticLibrary_SYSPRE)$(lib)$(gb_StaticLibrary_PLAINEXT)) \
314
315gb_StaticLibrary_StaticLibrary_platform =
316
317
318# Executable class
319
320gb_Executable_EXT :=
321
322gb_Executable_LAYER := \
323	$(foreach exe,$(gb_Executable_UREBIN),$(exe):UREBIN) \
324	$(foreach exe,$(gb_Executable_SDK),$(exe):SDKBIN) \
325	$(foreach exe,$(gb_Executable_OOO),$(exe):OOO) \
326	$(foreach exe,$(gb_Executable_BRAND),$(exe):BRAND) \
327	$(foreach exe,$(gb_Executable_NONE),$(exe):NONEBIN) \
328
329
330define gb_Executable_get_rpath
331'-R$(call gb_LinkTarget__get_rpath_for_layer,$(call gb_Executable_get_layer,$(1)))'
332endef
333
334define gb_Executable_Executable_platform
335$(call gb_LinkTarget_get_target,$(2)) : RPATH := $(call gb_Executable_get_rpath,$(1))
336
337endef
338
339
340# CppunitTest class
341
342gb_CppunitTest_CPPTESTPRECOMMAND := LD_LIBRARY_PATH=$(OUTDIR)/lib
343gb_CppunitTest_SYSPRE := libtest_
344gb_CppunitTest_EXT := .so
345gb_CppunitTest_get_filename = $(gb_CppunitTest_SYSPRE)$(1)$(gb_CppunitTest_EXT)
346gb_CppunitTest_get_libfilename = $(gb_CppunitTest_get_filename)
347
348define gb_CppunitTest_CppunitTest_platform
349$(call gb_LinkTarget_get_target,$(2)) : RPATH :=
350
351endef
352
353# JunitTest class
354
355define gb_JunitTest_JunitTest_platform
356$(call gb_JunitTest_get_target,$(1)) : DEFS := \
357	-Dorg.openoffice.test.arg.soffice="$$$${OOO_TEST_SOFFICE:-path:$(OUTDIR)/installation/opt/openoffice.org3/program/soffice}" \
358    -Dorg.openoffice.test.arg.env=LD_LIBRARY_PATH \
359    -Dorg.openoffice.test.arg.user=file://$(call gb_JunitTest_get_userdir,$(1)) \
360
361endef
362
363# SdiTarget class
364
365gb_SdiTarget_SVIDLPRECOMMAND := LD_LIBRARY_PATH=$(OUTDIR)/lib
366
367# SrsPartMergeTarget
368
369gb_SrsPartMergeTarget_TRANSEXPRECOMMAND := LD_LIBRARY_PATH=$(OUTDIR)/lib
370
371# SrsPartTarget class
372
373gb_SrsPartTarget_RSCTARGET := $(OUTDIR)/bin/rsc
374gb_SrsPartTarget_RSCCOMMAND := LD_LIBRARY_PATH=$(OUTDIR)/lib SOLARBINDIR=$(OUTDIR)/bin $(gb_SrsPartTarget_RSCTARGET)
375
376# Sun cc/CC support -xM1/-xMF flags, but unfortunately refuse input files that
377# do not have the right suffix, so use makedepend here...
378define gb_SrsPartTarget__command_dep
379$(call gb_Helper_abbreviate_dirs_native,\
380	$(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
381		$(INCLUDE) \
382		$(DEFS) \
383		$(2) \
384		-f - \
385	| $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
386		-v OBJECTFILE=$(call gb_SrsPartTarget_get_target,$(1)) \
387		-v OUTDIR=$(OUTDIR)/ \
388		-v WORKDIR=$(WORKDIR)/ \
389		-v SRCDIR=$(SRCDIR)/ \
390		-v REPODIR=$(REPODIR)/ \
391	> $(call gb_SrsPartTarget_get_dep_target,$(1)))
392endef
393
394
395# ComponentTarget
396
397gb_XSLTPROCPRECOMMAND := LD_LIBRARY_PATH=$(OUTDIR)/lib
398gb_Library_COMPONENTPREFIXES := \
399    OOO:vnd.sun.star.expand:\dOOO_BASE_DIR/program/ \
400    URELIB:vnd.sun.star.expand:\dURE_INTERNAL_LIB_DIR/ \
401
402
403# vim: set noet sw=4 ts=4:
404