1 #*************************************************************************
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 # Copyright 2008 by Sun Microsystems, Inc.
7 # OpenOffice.org - a multi-platform office productivity suite
9 # $RCSfile: unxlngi6.mk,v $
13 # This file is part of OpenOffice.org.
15 # OpenOffice.org is free software: you can redistribute it and/or modify
16 # it under the terms of the GNU Lesser General Public License version 3
17 # only, as published by the Free Software Foundation.
19 # OpenOffice.org is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU Lesser General Public License version 3 for more details
23 # (a copy is included in the LICENSE file that accompanied this code).
25 # You should have received a copy of the GNU Lesser General Public License
26 # version 3 along with OpenOffice.org. If not, see
27 # <http://www.openoffice.org/license.html>
28 # for a copy of the LGPLv3 License.
30 #*************************************************************************
32 # generic mk file for unxlng (unix linux glibc)
36 # default optimization level for product code
38 # architecture dependent flags for the C and C++ compiler that can be changed by
39 # exporting the variable ARCH_FLAGS="..." in the shell, which is used to start build
41 # position independent code switch
45 # filter for supressing verbose messages from linker
46 #not needed at the moment
47 #LINKOUTPUT_FILTER=" |& $(SOLARENV)/bin/msg_filter"
49 # _PTHREADS is needed for the stl
50 CDEFS
+=$(PTHREAD_CFLAGS
) -DGLIBC
=2 -D_PTHREADS
-D_REENTRANT
-DNEW_SOLAR
-D_USE_NAMESPACE
=1 -DSTLPORT_VERSION
=$(STLPORT_VER
)
52 # enable visibility define in "sal/types.h"
53 .IF
"$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE"
54 CDEFS
+= -DHAVE_GCC_VISIBILITY_FEATURE
55 .ENDIF
# "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE"
57 # this is a platform with JAVA support
58 .IF
"$(SOLAR_JAVA)"!=""
67 # name of C++ Compiler
72 CFLAGS_SYSBASE
:=-isystem
$(SYSBASE
)$/usr
$/include
73 CXX
+:=$(CFLAGS_SYSBASE
)
74 CC
+:=$(CFLAGS_SYSBASE
)
75 .ENDIF
# "$(SYSBASE)"!=""
76 CFLAGS
+=-fmessage-length
=0 -c
78 # flags to enable build with symbols; required for crashdump feature
79 .IF
"$(ENABLE_SYMBOLS)"=="SMALL"
80 CFLAGSENABLESYMBOLS
=-g1
82 CFLAGSENABLESYMBOLS
=-g
# was temporarily commented out, reenabled before Beta
86 # flags for the C++ Compiler
87 CFLAGSCC
= -pipe
$(ARCH_FLAGS
)
88 # Flags for enabling exception handling
89 CFLAGSEXCEPTIONS
=-fexceptions
-fno-enforce-eh-specs
90 # Flags for disabling exception handling
91 CFLAGS_NO_EXCEPTIONS
=-fno-exceptions
93 # -fpermissive should be removed as soon as possible
94 CFLAGSCXX
= -pipe
$(ARCH_FLAGS
)
95 .IF
"$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE" && "$(HAVE_GCC_VISIBILITY_BROKEN)" != "TRUE"
96 CFLAGSCXX
+= -fvisibility-inlines-hidden
97 .ENDIF
# "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE"
99 CFLAGS_CREATE_PCH
=-x c
++-header
-I
$(INCPCH
) -DPRECOMPILED_HEADERS
100 CFLAGS_USE_PCH
=-I
$(SLO
)$/pch
-DPRECOMPILED_HEADERS
-Winvalid-pch
101 CFLAGS_USE_EXCEPTIONS_PCH
=-I
$(SLO
)$/pch_ex
-DPRECOMPILED_HEADERS
-Winvalid-pch
103 # Compiler flags for compiling static object in multi threaded environment with graphical user interface
105 # Compiler flags for compiling static object in multi threaded environment with character user interface
107 # Compiler flags for compiling shared object in multi threaded environment with graphical user interface
108 CFLAGSSLOGUIMT
=$(PICSWITCH
)
109 # Compiler flags for compiling shared object in multi threaded environment with character user interface
110 CFLAGSSLOCUIMT
=$(PICSWITCH
)
111 # Compiler flags for profiling
113 # Compiler flags for debugging
116 # Compiler flags for enabling optimizations
118 CFLAGSOPT
=$(CDEFAULTOPT
) -fno-strict-aliasing
# optimizing for products
119 .ELSE
# "$(PRODUCT)"!=""
120 CFLAGSOPT
= # no optimizing for non products
121 .ENDIF
# "$(PRODUCT)"!=""
122 # Compiler flags for disabling optimizations
124 # Compiler flags for describing the output path
127 # -Wshadow does not work for C with nested uses of pthread_cleanup_push:
128 CFLAGSWARNCC
=-Wall
-Wextra
-Wendif-labels
129 CFLAGSWARNCXX
=$(CFLAGSWARNCC
) -Wshadow
-Wno-ctor-dtor-privacy \
130 -Wno-non-virtual-dtor
131 CFLAGSWALLCC
=$(CFLAGSWARNCC
)
132 CFLAGSWALLCXX
=$(CFLAGSWARNCXX
)
135 # Once all modules on this platform compile without warnings, set
136 # COMPILER_WARN_ERRORS=TRUE here instead of setting MODULES_WITH_WARNINGS (see
138 MODULES_WITH_WARNINGS
:= \
141 # switches for dynamic and static linking
142 STATIC
= -Wl
,-Bstatic
143 DYNAMIC
= -Wl
,-Bdynamic
149 # default linker flags
150 LINKFLAGSDEFS
*=-Wl
,-z
,defs
151 LINKFLAGSRUNPATH_URELIB
=-Wl
,-rpath
,\''$$ORIGIN'\'
152 LINKFLAGSRUNPATH_UREBIN
=-Wl
,-rpath
,\''$$ORIGIN/../lib:$$ORIGIN'\'
153 #TODO: drop $ORIGIN once no URE executable is also shipped in OOo
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-link/lib'\'
157 LINKFLAGSRUNPATH_OXT
=
158 LINKFLAGSRUNPATH_NONE
=
159 # flag -Wl,-z,noexecstack sets the NX bit on the stack
160 LINKFLAGS
=-Wl
,-z
,noexecstack
-Wl
,-z
,combreloc
$(LINKFLAGSDEFS
)
161 .IF
"$(HAVE_LD_BSYMBOLIC_FUNCTIONS)" == "TRUE"
162 LINKFLAGS
+= -Wl
,-Bsymbolic-functions
-Wl
,--dynamic-list-cpp-new
-Wl
,--dynamic-list-cpp-typeinfo
164 .IF
"$(HAVE_WORKING_LD_AS_NEEDED)" == "TRUE"
165 LINKFLAGS
+= -Wl
,--as-needed
168 # linker flags for linking applications
169 LINKFLAGSAPPGUI
= -Wl
,-export-dynamic
-Wl
,--noinhibit-exec \
170 -Wl
,-rpath-link
,$(LB
):$(SOLARLIBDIR
)
171 LINKFLAGSAPPCUI
= -Wl
,-export-dynamic
-Wl
,--noinhibit-exec \
172 -Wl
,-rpath-link
,$(LB
):$(SOLARLIBDIR
)
174 # linker flags for linking shared libraries
175 LINKFLAGSSHLGUI
= -shared
176 LINKFLAGSSHLCUI
= -shared
183 # linker flags for optimization (symbol hashtable)
184 # for now, applied to symbol scoped libraries, only
185 LINKFLAGSOPTIMIZE
*=-Wl
,-O1
186 LINKVERSIONMAPFLAG
=$(LINKFLAGSOPTIMIZE
) -Wl
,--version-script
190 # Sequence of libs does matter !
194 # default objectfilenames to link
195 STDOBJVCL
=$(L
)$/salmain.o
201 .IF
"$(ALLOC)" == "TCMALLOC"
202 STDLIBGUIMT
+=-ltcmalloc
203 STDLIBCUIMT
+=-ltcmalloc
204 STDSHLGUIMT
+=-ltcmalloc
205 STDSHLCUIMT
+=-ltcmalloc
207 .IF
"$(HAVE_LD_HASH_STYLE)" == "TRUE"
208 LINKFLAGS
+= -Wl
,--hash-style
=$(WITH_LINKER_HASH_STYLE
)
210 LINKFLAGS
+= -Wl
,-zdynsort
213 # libraries for linking applications
214 STDLIBGUIMT
+=-Wl
,--as-needed
-lX11
-ldl
-lpthread
-lm
-Wl
,--no-as-needed
215 STDLIBCUIMT
+=-Wl
,--as-needed
-ldl
-lpthread
-lm
-Wl
,--no-as-needed
216 # libraries for linking shared libraries
217 STDSHLGUIMT
+=-Wl
,--as-needed
-lX11
-lXext
-ldl
-lpthread
-lm
-Wl
,--no-as-needed
218 STDSHLCUIMT
+=-Wl
,--as-needed
-ldl
-lpthread
-lm
-Wl
,--no-as-needed
220 LIBSALCPPRT
*=-Wl
,--whole-archive
-lsalcpprt
-Wl
,--no-whole-archive
222 .IF
"$(USE_STLP_DEBUG)" != ""
223 .IF
"$(STLPORT_VER)" >= "500"
224 LIBSTLPORT
=$(DYNAMIC
) -lstlportstlg
225 LIBSTLPORTST
=$(STATIC
) -lstlportstlg
$(DYNAMIC
)
227 LIBSTLPORT
=$(DYNAMIC
) -lstlport_gcc_stldebug
228 LIBSTLPORTST
=$(STATIC
) -lstlport_gcc_stldebug
$(DYNAMIC
)
230 .ELSE
# "$(USE_STLP_DEBUG)" != ""
231 .IF
"$(STLPORT_VER)" >= "500"
232 LIBSTLPORT
=$(DYNAMIC
) -lstlport
233 LIBSTLPORTST
=$(STATIC
) -lstlport
$(DYNAMIC
)
235 LIBSTLPORT
=$(DYNAMIC
) -lstlport_gcc
236 LIBSTLPORTST
=$(STATIC
) -lstlport_gcc
$(DYNAMIC
)
238 .ENDIF
# "$(USE_STLP_DEBUG)" != ""
240 #FILLUPARC=$(STATIC) -lsupc++ $(DYNAMIC)
242 # name of library manager
246 # tool for generating import libraries
254 RCFLAGS
=-fo
$@
$(RCFILES
)
259 # platform specific identifier for shared libs