xref: /aoo41x/main/solenv/inc/unxlng.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
24# generic mk file for unxlng (unix linux glibc)
25ASM*=
26AFLAGS*=
27SOLAR_JAVA*=
28# default optimization level for product code
29CDEFAULTOPT*=-O2
30# architecture dependent flags for the C and C++ compiler that can be changed by
31# exporting the variable ARCH_FLAGS="..." in the shell, which is used to start build
32ARCH_FLAGS*=
33# position independent code switch
34PICSWITCH*:=-fpic
35JAVAFLAGSDEBUG=-g
36
37# filter for supressing verbose messages from linker
38#not needed at the moment
39#LINKOUTPUT_FILTER=" |& $(SOLARENV)/bin/msg_filter"
40
41# _PTHREADS is needed for the stl
42CDEFS+=-DGLIBC=2 -D_PTHREADS -D_REENTRANT -DNEW_SOLAR -D_USE_NAMESPACE=1 -DSTLPORT_VERSION=$(STLPORT_VER)
43
44# enable visibility define in "sal/types.h"
45.IF "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE"
46CDEFS += -DHAVE_GCC_VISIBILITY_FEATURE
47.ENDIF # "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE"
48
49# this is a platform with JAVA support
50.IF "$(SOLAR_JAVA)"!=""
51JAVADEF=-DSOLAR_JAVA
52.IF "$(debug)"==""
53JAVA_RUNTIME=-ljava
54.ELSE
55JAVA_RUNTIME=-ljava_g
56.ENDIF
57.ENDIF
58
59# name of C++ Compiler
60CXX*=g++
61# name of C Compiler
62CC*=gcc
63.IF "$(SYSBASE)"!=""
64CFLAGS_SYSBASE:=--sysroot=$(SYSBASE)
65CXX+:=$(CFLAGS_SYSBASE)
66CC+:=$(CFLAGS_SYSBASE)
67.ENDIF          # "$(SYSBASE)"!=""
68CFLAGS+=-fmessage-length=0 -c
69
70# flags to enable build with symbols; required for crashdump feature
71.IF "$(ENABLE_SYMBOLS)"=="SMALL"
72CFLAGSENABLESYMBOLS=-g1
73.ELSE
74CFLAGSENABLESYMBOLS=-g # was temporarily commented out, reenabled before Beta
75
76.ENDIF
77
78# flags for the C++ Compiler
79CFLAGSCC= -pipe $(ARCH_FLAGS)
80# Flags for enabling exception handling
81CFLAGSEXCEPTIONS=-fexceptions -fno-enforce-eh-specs
82# Flags for disabling exception handling
83CFLAGS_NO_EXCEPTIONS=-fno-exceptions
84
85# -fpermissive should be removed as soon as possible
86CFLAGSCXX= -pipe $(ARCH_FLAGS)
87.IF "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE"
88CFLAGSCXX += -fvisibility-inlines-hidden
89.ENDIF # "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE"
90
91CFLAGS_CREATE_PCH=-x c++-header -I$(INCPCH) -DPRECOMPILED_HEADERS
92CFLAGS_USE_PCH=-I$(SLO)$/pch -DPRECOMPILED_HEADERS -Winvalid-pch
93CFLAGS_USE_EXCEPTIONS_PCH=-I$(SLO)$/pch_ex -DPRECOMPILED_HEADERS -Winvalid-pch
94
95# Compiler flags for compiling static object in multi threaded environment with graphical user interface
96CFLAGSOBJGUIMT=
97# Compiler flags for compiling static object in multi threaded environment with character user interface
98CFLAGSOBJCUIMT=
99# Compiler flags for compiling shared object in multi threaded environment with graphical user interface
100CFLAGSSLOGUIMT=$(PICSWITCH)
101# Compiler flags for compiling shared object in multi threaded environment with character user interface
102CFLAGSSLOCUIMT=$(PICSWITCH)
103# Compiler flags for profiling
104CFLAGSPROF=
105# Compiler flags for debugging
106CFLAGSDEBUG=-g
107CFLAGSDBGUTIL=
108# Compiler flags for enabling optimizations
109.IF "$(PRODUCT)"!=""
110CFLAGSOPT=$(CDEFAULTOPT) -fno-strict-aliasing		# optimizing for products
111.ELSE 	# "$(PRODUCT)"!=""
112CFLAGSOPT=   							# no optimizing for non products
113.ENDIF	# "$(PRODUCT)"!=""
114# Compiler flags for disabling optimizations
115CFLAGSNOOPT=-O0
116# Compiler flags for describing the output path
117CFLAGSOUTOBJ=-o
118
119# -Wshadow does not work for C with nested uses of pthread_cleanup_push:
120CFLAGSWARNCC=-Wall -Wextra -Wendif-labels
121CFLAGSWARNCXX=$(CFLAGSWARNCC) -Wshadow -Wno-ctor-dtor-privacy \
122    -Wno-non-virtual-dtor
123CFLAGSWALLCC=$(CFLAGSWARNCC)
124CFLAGSWALLCXX=$(CFLAGSWARNCXX)
125CFLAGSWERRCC=-Werror
126
127# Once all modules on this platform compile without warnings, set
128# COMPILER_WARN_ERRORS=TRUE here instead of setting MODULES_WITH_WARNINGS (see
129# settings.mk):
130MODULES_WITH_WARNINGS := \
131    soldep
132
133# switches for dynamic and static linking
134STATIC		= -Wl,-Bstatic
135DYNAMIC		= -Wl,-Bdynamic
136
137# name of linker
138LINK*=$(CXX)
139LINKC*=$(CC)
140
141# default linker flags
142.IF "$(SYSBASE)"!=""
143LINKFLAGS_SYSBASE:=-Wl,--sysroot=$(SYSBASE)
144.ENDIF          # "$(SYSBASE)"!=""
145LINKFLAGSDEFS*=-Wl,-z,defs
146LINKFLAGSRUNPATH_URELIB=-Wl,-rpath,\''$$ORIGIN'\'
147LINKFLAGSRUNPATH_UREBIN=-Wl,-rpath,\''$$ORIGIN/../lib:$$ORIGIN'\'
148    #TODO: drop $ORIGIN once no URE executable is also shipped in OOo
149LINKFLAGSRUNPATH_OOO=-Wl,-rpath,\''$$ORIGIN:$$ORIGIN/../ure-link/lib'\'
150LINKFLAGSRUNPATH_SDK=-Wl,-rpath,\''$$ORIGIN/../../ure-link/lib'\'
151LINKFLAGSRUNPATH_BRAND=-Wl,-rpath,\''$$ORIGIN:$$ORIGIN/../basis-link/program:$$ORIGIN/../basis-link/ure-link/lib'\'
152LINKFLAGSRUNPATH_OXT=
153LINKFLAGSRUNPATH_BOXT=-Wl,-rpath,\''$$ORIGIN/../../../basis-link/program'\'
154LINKFLAGSRUNPATH_NONE=
155LINKFLAGS=-Wl,-z,combreloc $(LINKFLAGSDEFS) $(LINKFLAGS_SYSBASE)
156.IF "$(HAVE_LD_BSYMBOLIC_FUNCTIONS)"  == "TRUE"
157LINKFLAGS += -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo
158.ENDIF
159
160# linker flags for linking applications
161LINKFLAGSAPPGUI= -Wl,-export-dynamic -Wl,--noinhibit-exec \
162    -Wl,-rpath-link,$(LB):$(SOLARLIBDIR):$(SYSBASE)/lib:$(SYSBASE)/usr/lib
163LINKFLAGSAPPCUI= -Wl,-export-dynamic -Wl,--noinhibit-exec \
164    -Wl,-rpath-link,$(LB):$(SOLARLIBDIR):$(SYSBASE)/lib:$(SYSBASE)/usr/lib
165
166# linker flags for linking shared libraries
167LINKFLAGSSHLGUI= -shared
168LINKFLAGSSHLCUI= -shared
169
170LINKFLAGSTACK=
171LINKFLAGSPROF=
172LINKFLAGSDEBUG=-g
173LINKFLAGSOPT=
174
175# linker flags for optimization (symbol hashtable)
176# for now, applied to symbol scoped libraries, only
177LINKFLAGSOPTIMIZE*=-Wl,-O1
178LINKVERSIONMAPFLAG=$(LINKFLAGSOPTIMIZE) -Wl,--version-script
179
180SONAME_SWITCH=-Wl,-h
181
182# Sequence of libs does matter !
183
184STDLIBCPP=-lstdc++
185
186# default objectfilenames to link
187STDOBJVCL=$(L)$/salmain.o
188STDOBJGUI=
189STDSLOGUI=
190STDOBJCUI=
191STDSLOCUI=
192
193.IF "$(ALLOC)" == "TCMALLOC"
194STDLIBGUIMT+=-ltcmalloc
195STDLIBCUIMT+=-ltcmalloc
196STDSHLGUIMT+=-ltcmalloc
197STDSHLCUIMT+=-ltcmalloc
198.ENDIF
199
200.IF "$(ALLOC)" == "JEMALLOC"
201STDLIBGUIMT+=-ljemalloc
202STDLIBCUIMT+=-ljemalloc
203STDSHLGUIMT+=-ljemalloc
204STDSHLCUIMT+=-ljemalloc
205.ENDIF
206
207.IF "$(HAVE_LD_HASH_STYLE)"  == "TRUE"
208LINKFLAGS += -Wl,--hash-style=both
209.ELSE
210LINKFLAGS += -Wl,-zdynsort
211.ENDIF
212
213# libraries for linking applications
214STDLIBGUIMT+=-Wl,--as-needed -ldl -lpthread -lm -Wl,--no-as-needed
215STDLIBCUIMT+=-Wl,--as-needed -ldl -lpthread -lm -Wl,--no-as-needed
216# libraries for linking shared libraries
217STDSHLGUIMT+=-Wl,--as-needed -ldl -lpthread -lm -Wl,--no-as-needed
218STDSHLCUIMT+=-Wl,--as-needed -ldl -lpthread -lm -Wl,--no-as-needed
219
220X11LINK_DYNAMIC = -Wl,--as-needed -lXext -lX11 -Wl,--no-as-needed
221
222LIBSALCPPRT*=-Wl,--whole-archive -lsalcpprt -Wl,--no-whole-archive
223
224.IF "$(USE_STLP_DEBUG)" != ""
225.IF "$(STLPORT_VER)" >= "500"
226LIBSTLPORT=$(DYNAMIC) -lstlportstlg
227LIBSTLPORTST=$(STATIC) -lstlportstlg $(DYNAMIC)
228.ELSE
229LIBSTLPORT=$(DYNAMIC) -lstlport_gcc_stldebug
230LIBSTLPORTST=$(STATIC) -lstlport_gcc_stldebug $(DYNAMIC)
231.ENDIF
232.ELSE # "$(USE_STLP_DEBUG)" != ""
233.IF "$(STLPORT_VER)" >= "500"
234LIBSTLPORT=$(DYNAMIC) -lstlport
235LIBSTLPORTST=$(STATIC) -lstlport $(DYNAMIC)
236.ELSE
237LIBSTLPORT=$(DYNAMIC) -lstlport_gcc
238LIBSTLPORTST=$(STATIC) -lstlport_gcc $(DYNAMIC)
239.ENDIF
240.ENDIF # "$(USE_STLP_DEBUG)" != ""
241
242#FILLUPARC=$(STATIC) -lsupc++ $(DYNAMIC)
243
244# name of library manager
245LIBMGR*=ar
246LIBFLAGS=-r
247
248# tool for generating import libraries
249IMPLIB=
250IMPLIBFLAGS=
251
252MAPSYM=
253MAPSYMFLAGS=
254
255RC=irc
256RCFLAGS=-fo$@ $(RCFILES)
257RCLINK=
258RCLINKFLAGS=
259RCSETVERSION=
260
261# platform specific identifier for shared libs
262DLLPRE=lib
263DLLPOST=.so
264PCHPOST=.gch
265