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