xref: /aoo42x/main/solenv/inc/unxlng.mk (revision 92dd2fb2)
17871dc3eSAndrew Rist#**************************************************************
27871dc3eSAndrew Rist#
37871dc3eSAndrew Rist#  Licensed to the Apache Software Foundation (ASF) under one
47871dc3eSAndrew Rist#  or more contributor license agreements.  See the NOTICE file
57871dc3eSAndrew Rist#  distributed with this work for additional information
67871dc3eSAndrew Rist#  regarding copyright ownership.  The ASF licenses this file
77871dc3eSAndrew Rist#  to you under the Apache License, Version 2.0 (the
87871dc3eSAndrew Rist#  "License"); you may not use this file except in compliance
97871dc3eSAndrew Rist#  with the License.  You may obtain a copy of the License at
107871dc3eSAndrew Rist#
117871dc3eSAndrew Rist#    http://www.apache.org/licenses/LICENSE-2.0
127871dc3eSAndrew Rist#
137871dc3eSAndrew Rist#  Unless required by applicable law or agreed to in writing,
147871dc3eSAndrew Rist#  software distributed under the License is distributed on an
157871dc3eSAndrew Rist#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
167871dc3eSAndrew Rist#  KIND, either express or implied.  See the License for the
177871dc3eSAndrew Rist#  specific language governing permissions and limitations
187871dc3eSAndrew Rist#  under the License.
197871dc3eSAndrew Rist#
207871dc3eSAndrew Rist#**************************************************************
217871dc3eSAndrew Rist
227871dc3eSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir# generic mk file for unxlng (unix linux glibc)
25cdf0e10cSrcweirASM*=
26cdf0e10cSrcweirAFLAGS*=
27cdf0e10cSrcweirSOLAR_JAVA*=
28cdf0e10cSrcweir# default optimization level for product code
29cdf0e10cSrcweirCDEFAULTOPT*=-O2
30cdf0e10cSrcweir# architecture dependent flags for the C and C++ compiler that can be changed by
31cdf0e10cSrcweir# exporting the variable ARCH_FLAGS="..." in the shell, which is used to start build
32cdf0e10cSrcweirARCH_FLAGS*=
33cdf0e10cSrcweir# position independent code switch
34cdf0e10cSrcweirPICSWITCH*:=-fpic
35cdf0e10cSrcweirJAVAFLAGSDEBUG=-g
36cdf0e10cSrcweir
3786e1cf34SPedro Giffuni# filter for suppressing verbose messages from linker
38cdf0e10cSrcweir#not needed at the moment
39cdf0e10cSrcweir#LINKOUTPUT_FILTER=" |& $(SOLARENV)/bin/msg_filter"
40cdf0e10cSrcweir
41cdf0e10cSrcweir# _PTHREADS is needed for the stl
42b597708bSHerbert DürrCDEFS+=-DGLIBC=2 -D_PTHREADS -D_REENTRANT -DNEW_SOLAR -D_USE_NAMESPACE=1
43b597708bSHerbert DürrCDEFS+=-DBOOST_DETAIL_NO_CONTAINER_FWD
44cdf0e10cSrcweir
45cdf0e10cSrcweir# enable visibility define in "sal/types.h"
46cdf0e10cSrcweir.IF "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE"
47cdf0e10cSrcweirCDEFS += -DHAVE_GCC_VISIBILITY_FEATURE
48cdf0e10cSrcweir.ENDIF # "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE"
49cdf0e10cSrcweir
50cdf0e10cSrcweir# this is a platform with JAVA support
51cdf0e10cSrcweir.IF "$(SOLAR_JAVA)"!=""
52cdf0e10cSrcweirJAVADEF=-DSOLAR_JAVA
53cdf0e10cSrcweir.IF "$(debug)"==""
54cdf0e10cSrcweirJAVA_RUNTIME=-ljava
55cdf0e10cSrcweir.ELSE
56cdf0e10cSrcweirJAVA_RUNTIME=-ljava_g
57cdf0e10cSrcweir.ENDIF
58cdf0e10cSrcweir.ENDIF
59cdf0e10cSrcweir
60cdf0e10cSrcweir# name of C++ Compiler
61cdf0e10cSrcweirCXX*=g++
62cdf0e10cSrcweir# name of C Compiler
63cdf0e10cSrcweirCC*=gcc
64cdf0e10cSrcweir.IF "$(SYSBASE)"!=""
65cdf0e10cSrcweirCFLAGS_SYSBASE:=--sysroot=$(SYSBASE)
66cdf0e10cSrcweirCXX+:=$(CFLAGS_SYSBASE)
67cdf0e10cSrcweirCC+:=$(CFLAGS_SYSBASE)
68cdf0e10cSrcweir.ENDIF          # "$(SYSBASE)"!=""
69cdf0e10cSrcweirCFLAGS+=-fmessage-length=0 -c
70cdf0e10cSrcweir
71cdf0e10cSrcweir# flags to enable build with symbols; required for crashdump feature
72cdf0e10cSrcweir.IF "$(ENABLE_SYMBOLS)"=="SMALL"
73cdf0e10cSrcweirCFLAGSENABLESYMBOLS=-g1
74cdf0e10cSrcweir.ELSE
75cdf0e10cSrcweirCFLAGSENABLESYMBOLS=-g # was temporarily commented out, reenabled before Beta
76cdf0e10cSrcweir
77cdf0e10cSrcweir.ENDIF
78cdf0e10cSrcweir
79cdf0e10cSrcweir# flags for the C++ Compiler
80cdf0e10cSrcweirCFLAGSCC= -pipe $(ARCH_FLAGS)
81cdf0e10cSrcweir# Flags for enabling exception handling
82bcc22a4cSDamjan Jovanovic.IF "$(COM)"=="CLANG"
83bcc22a4cSDamjan JovanovicCFLAGSEXCEPTIONS=-fexceptions
84bcc22a4cSDamjan Jovanovic.ELSE
85cdf0e10cSrcweirCFLAGSEXCEPTIONS=-fexceptions -fno-enforce-eh-specs
86bcc22a4cSDamjan Jovanovic.ENDIF
87cdf0e10cSrcweir# Flags for disabling exception handling
88cdf0e10cSrcweirCFLAGS_NO_EXCEPTIONS=-fno-exceptions
89cdf0e10cSrcweir
90cdf0e10cSrcweir# -fpermissive should be removed as soon as possible
91*92dd2fb2SDon LewisCFLAGSCXX= -pipe $(ARCH_FLAGS) -std=gnu++98
92cdf0e10cSrcweir.IF "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE"
93cdf0e10cSrcweirCFLAGSCXX += -fvisibility-inlines-hidden
94cdf0e10cSrcweir.ENDIF # "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE"
95cdf0e10cSrcweir
96cdf0e10cSrcweirCFLAGS_CREATE_PCH=-x c++-header -I$(INCPCH) -DPRECOMPILED_HEADERS
97cdf0e10cSrcweirCFLAGS_USE_PCH=-I$(SLO)$/pch -DPRECOMPILED_HEADERS -Winvalid-pch
98cdf0e10cSrcweirCFLAGS_USE_EXCEPTIONS_PCH=-I$(SLO)$/pch_ex -DPRECOMPILED_HEADERS -Winvalid-pch
99cdf0e10cSrcweir
100cdf0e10cSrcweir# Compiler flags for compiling static object in multi threaded environment with graphical user interface
101cdf0e10cSrcweirCFLAGSOBJGUIMT=
102cdf0e10cSrcweir# Compiler flags for compiling static object in multi threaded environment with character user interface
103cdf0e10cSrcweirCFLAGSOBJCUIMT=
104cdf0e10cSrcweir# Compiler flags for compiling shared object in multi threaded environment with graphical user interface
105cdf0e10cSrcweirCFLAGSSLOGUIMT=$(PICSWITCH)
106cdf0e10cSrcweir# Compiler flags for compiling shared object in multi threaded environment with character user interface
107cdf0e10cSrcweirCFLAGSSLOCUIMT=$(PICSWITCH)
108cdf0e10cSrcweir# Compiler flags for profiling
109cdf0e10cSrcweirCFLAGSPROF=
110cdf0e10cSrcweir# Compiler flags for debugging
111cdf0e10cSrcweirCFLAGSDEBUG=-g
112cdf0e10cSrcweirCFLAGSDBGUTIL=
113cdf0e10cSrcweir# Compiler flags for enabling optimizations
114cdf0e10cSrcweir.IF "$(PRODUCT)"!=""
115cdf0e10cSrcweirCFLAGSOPT=$(CDEFAULTOPT) -fno-strict-aliasing		# optimizing for products
116cdf0e10cSrcweir.ELSE 	# "$(PRODUCT)"!=""
117cdf0e10cSrcweirCFLAGSOPT=   							# no optimizing for non products
118cdf0e10cSrcweir.ENDIF	# "$(PRODUCT)"!=""
119cdf0e10cSrcweir# Compiler flags for disabling optimizations
120cdf0e10cSrcweirCFLAGSNOOPT=-O0
121cdf0e10cSrcweir# Compiler flags for describing the output path
122cdf0e10cSrcweirCFLAGSOUTOBJ=-o
123cdf0e10cSrcweir
124cdf0e10cSrcweir# -Wshadow does not work for C with nested uses of pthread_cleanup_push:
125cdf0e10cSrcweirCFLAGSWARNCC=-Wall -Wextra -Wendif-labels
126cdf0e10cSrcweirCFLAGSWARNCXX=$(CFLAGSWARNCC) -Wshadow -Wno-ctor-dtor-privacy \
127cdf0e10cSrcweir    -Wno-non-virtual-dtor
128cdf0e10cSrcweirCFLAGSWALLCC=$(CFLAGSWARNCC)
129cdf0e10cSrcweirCFLAGSWALLCXX=$(CFLAGSWARNCXX)
130cdf0e10cSrcweirCFLAGSWERRCC=-Werror
131cdf0e10cSrcweir
132cdf0e10cSrcweir# Once all modules on this platform compile without warnings, set
133cdf0e10cSrcweir# COMPILER_WARN_ERRORS=TRUE here instead of setting MODULES_WITH_WARNINGS (see
134cdf0e10cSrcweir# settings.mk):
135f3ecff4eSAndre FischerMODULES_WITH_WARNINGS :=
136cdf0e10cSrcweir
137cdf0e10cSrcweir# switches for dynamic and static linking
138cdf0e10cSrcweirSTATIC		= -Wl,-Bstatic
139cdf0e10cSrcweirDYNAMIC		= -Wl,-Bdynamic
140cdf0e10cSrcweir
141cdf0e10cSrcweir# name of linker
142cdf0e10cSrcweirLINK*=$(CXX)
143cdf0e10cSrcweirLINKC*=$(CC)
144cdf0e10cSrcweir
145cdf0e10cSrcweir# default linker flags
146cdf0e10cSrcweir.IF "$(SYSBASE)"!=""
147cdf0e10cSrcweirLINKFLAGS_SYSBASE:=-Wl,--sysroot=$(SYSBASE)
148cdf0e10cSrcweir.ENDIF          # "$(SYSBASE)"!=""
149cdf0e10cSrcweirLINKFLAGSDEFS*=-Wl,-z,defs
150cdf0e10cSrcweirLINKFLAGSRUNPATH_URELIB=-Wl,-rpath,\''$$ORIGIN'\'
151910823aeSJürgen SchmidtLINKFLAGSRUNPATH_UREBIN=-Wl,-rpath,\''$$ORIGIN'\'
152910823aeSJürgen Schmidt#LINKFLAGSRUNPATH_UREBIN=-Wl,-rpath,\''$$ORIGIN/../lib:$$ORIGIN'\'
153cdf0e10cSrcweir    #TODO: drop $ORIGIN once no URE executable is also shipped in OOo
154910823aeSJürgen SchmidtLINKFLAGSRUNPATH_OOO=-Wl,-rpath,\''$$ORIGIN'\'
155910823aeSJürgen SchmidtLINKFLAGSRUNPATH_SDK=-Wl,-rpath,\''$$ORIGIN'\'
156910823aeSJürgen SchmidtLINKFLAGSRUNPATH_BRAND=-Wl,-rpath,\''$$ORIGIN'\'
157910823aeSJürgen Schmidt#LINKFLAGSRUNPATH_OOO=-Wl,-rpath,\''$$ORIGIN:$$ORIGIN/../ure-link/lib'\'
158910823aeSJürgen Schmidt#LINKFLAGSRUNPATH_SDK=-Wl,-rpath,\''$$ORIGIN/../../ure-link/lib'\'
159910823aeSJürgen Schmidt#LINKFLAGSRUNPATH_BRAND=-Wl,-rpath,\''$$ORIGIN:$$ORIGIN/../basis-link/program:$$ORIGIN/../basis-link/ure-lin
160cdf0e10cSrcweirLINKFLAGSRUNPATH_OXT=
161910823aeSJürgen SchmidtLINKFLAGSRUNPATH_BOXT=-Wl,-rpath,\''$$ORIGIN'\'
162910823aeSJürgen Schmidt#LINKFLAGSRUNPATH_BOXT=-Wl,-rpath,\''$$ORIGIN/../../../basis-link/program'\'
163cdf0e10cSrcweirLINKFLAGSRUNPATH_NONE=
164cdf0e10cSrcweirLINKFLAGS=-Wl,-z,combreloc $(LINKFLAGSDEFS) $(LINKFLAGS_SYSBASE)
165cdf0e10cSrcweir.IF "$(HAVE_LD_BSYMBOLIC_FUNCTIONS)"  == "TRUE"
166cdf0e10cSrcweirLINKFLAGS += -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo
167cdf0e10cSrcweir.ENDIF
168cdf0e10cSrcweir
169cdf0e10cSrcweir# linker flags for linking applications
170cdf0e10cSrcweirLINKFLAGSAPPGUI= -Wl,-export-dynamic -Wl,--noinhibit-exec \
171cdf0e10cSrcweir    -Wl,-rpath-link,$(LB):$(SOLARLIBDIR):$(SYSBASE)/lib:$(SYSBASE)/usr/lib
172cdf0e10cSrcweirLINKFLAGSAPPCUI= -Wl,-export-dynamic -Wl,--noinhibit-exec \
173cdf0e10cSrcweir    -Wl,-rpath-link,$(LB):$(SOLARLIBDIR):$(SYSBASE)/lib:$(SYSBASE)/usr/lib
174cdf0e10cSrcweir
175cdf0e10cSrcweir# linker flags for linking shared libraries
176cdf0e10cSrcweirLINKFLAGSSHLGUI= -shared
177cdf0e10cSrcweirLINKFLAGSSHLCUI= -shared
178cdf0e10cSrcweir
179cdf0e10cSrcweirLINKFLAGSTACK=
180cdf0e10cSrcweirLINKFLAGSPROF=
181cdf0e10cSrcweirLINKFLAGSDEBUG=-g
182cdf0e10cSrcweirLINKFLAGSOPT=
183cdf0e10cSrcweir
184cdf0e10cSrcweir# linker flags for optimization (symbol hashtable)
185cdf0e10cSrcweir# for now, applied to symbol scoped libraries, only
186cdf0e10cSrcweirLINKFLAGSOPTIMIZE*=-Wl,-O1
187cdf0e10cSrcweirLINKVERSIONMAPFLAG=$(LINKFLAGSOPTIMIZE) -Wl,--version-script
188cdf0e10cSrcweir
189cdf0e10cSrcweirSONAME_SWITCH=-Wl,-h
190cdf0e10cSrcweir
191cdf0e10cSrcweir# Sequence of libs does matter !
192cdf0e10cSrcweir
193cdf0e10cSrcweirSTDLIBCPP=-lstdc++
194cdf0e10cSrcweir
195cdf0e10cSrcweir# default objectfilenames to link
196cdf0e10cSrcweirSTDOBJVCL=$(L)$/salmain.o
197cdf0e10cSrcweirSTDOBJGUI=
198cdf0e10cSrcweirSTDSLOGUI=
199cdf0e10cSrcweirSTDOBJCUI=
200cdf0e10cSrcweirSTDSLOCUI=
201cdf0e10cSrcweir
202cdf0e10cSrcweir.IF "$(ALLOC)" == "TCMALLOC"
203cdf0e10cSrcweirSTDLIBGUIMT+=-ltcmalloc
204cdf0e10cSrcweirSTDLIBCUIMT+=-ltcmalloc
205cdf0e10cSrcweirSTDSHLGUIMT+=-ltcmalloc
206cdf0e10cSrcweirSTDSHLCUIMT+=-ltcmalloc
207cdf0e10cSrcweir.ENDIF
208cdf0e10cSrcweir
209cdf0e10cSrcweir.IF "$(ALLOC)" == "JEMALLOC"
210cdf0e10cSrcweirSTDLIBGUIMT+=-ljemalloc
211cdf0e10cSrcweirSTDLIBCUIMT+=-ljemalloc
212cdf0e10cSrcweirSTDSHLGUIMT+=-ljemalloc
213cdf0e10cSrcweirSTDSHLCUIMT+=-ljemalloc
214cdf0e10cSrcweir.ENDIF
215cdf0e10cSrcweir
216cdf0e10cSrcweir.IF "$(HAVE_LD_HASH_STYLE)"  == "TRUE"
217cdf0e10cSrcweirLINKFLAGS += -Wl,--hash-style=both
218cdf0e10cSrcweir.ELSE
219cdf0e10cSrcweirLINKFLAGS += -Wl,-zdynsort
220cdf0e10cSrcweir.ENDIF
221cdf0e10cSrcweir
222cdf0e10cSrcweir# libraries for linking applications
223cdf0e10cSrcweirSTDLIBGUIMT+=-Wl,--as-needed -ldl -lpthread -lm -Wl,--no-as-needed
224cdf0e10cSrcweirSTDLIBCUIMT+=-Wl,--as-needed -ldl -lpthread -lm -Wl,--no-as-needed
225cdf0e10cSrcweir# libraries for linking shared libraries
226cdf0e10cSrcweirSTDSHLGUIMT+=-Wl,--as-needed -ldl -lpthread -lm -Wl,--no-as-needed
227cdf0e10cSrcweirSTDSHLCUIMT+=-Wl,--as-needed -ldl -lpthread -lm -Wl,--no-as-needed
228cdf0e10cSrcweir
229cdf0e10cSrcweirX11LINK_DYNAMIC = -Wl,--as-needed -lXext -lX11 -Wl,--no-as-needed
230cdf0e10cSrcweir
231cdf0e10cSrcweirLIBSALCPPRT*=-Wl,--whole-archive -lsalcpprt -Wl,--no-whole-archive
232cdf0e10cSrcweir
233cdf0e10cSrcweir#FILLUPARC=$(STATIC) -lsupc++ $(DYNAMIC)
234cdf0e10cSrcweir
235cdf0e10cSrcweir# name of library manager
236cdf0e10cSrcweirLIBMGR*=ar
237cdf0e10cSrcweirLIBFLAGS=-r
238cdf0e10cSrcweir
239cdf0e10cSrcweir# tool for generating import libraries
240cdf0e10cSrcweirIMPLIB=
241cdf0e10cSrcweirIMPLIBFLAGS=
242cdf0e10cSrcweir
243cdf0e10cSrcweirMAPSYM=
244cdf0e10cSrcweirMAPSYMFLAGS=
245cdf0e10cSrcweir
246cdf0e10cSrcweirRC=irc
247cdf0e10cSrcweirRCFLAGS=-fo$@ $(RCFILES)
248cdf0e10cSrcweirRCLINK=
249cdf0e10cSrcweirRCLINKFLAGS=
250cdf0e10cSrcweirRCSETVERSION=
251cdf0e10cSrcweir
252cdf0e10cSrcweir# platform specific identifier for shared libs
253cdf0e10cSrcweirDLLPRE=lib
254cdf0e10cSrcweirDLLPOST=.so
255cdf0e10cSrcweirPCHPOST=.gch
256