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