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