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: unxmacx.mk,v $
11 # $Revision: 1.34.56.1 $
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 ##########################################################################
33 # Platform MAKEFILE for Mac OS X and Darwin on both PowerPC and Intel
34 ##########################################################################
36 # PROCESSOR_DEFINES and DLLPOSTFIX are defined in the particular platform file
42 # Definitions that we may need on the compile line.
43 # -D_PTHREADS and -D_REENTRANT are needed for STLport, and must be specified when
44 # compiling STLport sources too, either internally or externally.
45 CDEFS
+=-DGLIBC
=2 -D_PTHREADS
-D_REENTRANT
-DNO_PTHREAD_PRIORITY
$(PROCESSOR_DEFINES
) -DSTLPORT_VERSION
=$(STLPORT_VER
) -D_USE_NAMESPACE
=1
46 .IF
"$(GUIBASE)"=="unx" && "$(USE_SYSTEM_STL)"!="YES"
49 .IF
"$(GUIBASE)"=="aqua"
50 # MAXOSX_DEPLOYMENT_TARGET : The minimum version required to run the build,
51 # build can assume functions/libraries of that version to be available
52 # unless you want to do runtime checks for 10.5 api, you also want to use the 10.4 sdk
53 # (safer/easier than dealing with the MAC_OS_X_VERSION_MAX_ALLOWED macro)
54 # http://developer.apple.com/technotes/tn2002/tn2064.html
55 MACOSX_DEPLOYMENT_TARGET
=10.4
56 .EXPORT
: MACOSX_DEPLOYMENT_TARGET
58 EXTRA_CDEFS
*=-isysroot
/Developer
/SDKs
/MacOSX10.4u.sdk
61 # Name of library where static data members are initialized
62 # STATICLIBNAME=static$(DLLPOSTFIX)
63 # STATICLIB=-l$(STATICLIBNAME)
65 # enable visibility define in "sal/types.h"
66 .IF
"$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE"
67 CDEFS
+= -DHAVE_GCC_VISIBILITY_FEATURE
68 .ENDIF
# "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE"
71 # MacOS X specific Java compilation/link flags
73 .IF
"$(SOLAR_JAVA)"!=""
76 JAVA_RUNTIME
=-framework JavaVM
79 # architecture dependent flags for the C and C++ compiler that can be changed by
80 # exporting the variable ARCH_FLAGS="..." in the shell, which is used to start build
83 # Specify the compiler to use. NOTE: MacOS X should always specify
84 # c++ for C++ compilation as it does certain C++ specific things
85 # behind the scenes for us.
86 # CC = C++ compiler to use
87 # cc = C compiler to use
88 # objc = Objective C compiler to use
89 # objcpp = Objective C++ compiler to use
95 CFLAGS
=-fsigned-char
-fmessage-length
=0 -malign-natural
-c
$(EXTRA_CFLAGS
)
97 .IF
"$(DISABLE_DEPRECATION_WARNING)" == "TRUE"
98 CFLAGS
+=-Wno-deprecated-declarations
100 # ---------------------------------
102 # ---------------------------------
103 # Normal C compilation flags
104 CFLAGSCC
=-pipe
-fsigned-char
-malign-natural
$(ARCH_FLAGS
)
106 # Normal Objective C compilation flags
107 #OBJCFLAGS=-no-precomp
108 OBJCFLAGS
=-fobjc-exceptions
109 # -x options generally ignored by ccache, tell it that it can cache
110 # the result nevertheless
111 CCACHE_SKIP
:=$(eq
,$(USE_CCACHE
),YES
--ccache-skip
$(NULL
))
112 OBJCXXFLAGS
:=$(CCACHE_SKIP
) -x
$(CCACHE_SKIP
) objective-c
++ -fobjc-exceptions
114 # Comp Flags for files that need exceptions enabled (C and C++)
115 CFLAGSEXCEPTIONS
=-fexceptions
-fno-enforce-eh-specs
117 # Comp Flags for files that do not need exceptions enabled (C and C++)
118 CFLAGS_NO_EXCEPTIONS
=-fno-exceptions
120 # Normal C++ compilation flags
121 CFLAGSCXX
=-pipe
-malign-natural
-fsigned-char
-Wno-long-double
$(ARCH_FLAGS
)
122 CFLAGSCXX
+= -Wno-ctor-dtor-privacy
126 CFLAGSOBJGUIMT
=$(PICSWITCH
) -fno-common
127 CFLAGSOBJCUIMT
=$(PICSWITCH
) -fno-common
128 CFLAGSSLOGUIMT
=$(PICSWITCH
) -fno-common
129 CFLAGSSLOCUIMT
=$(PICSWITCH
) -fno-common
132 # Flag for including debugging information in object files
136 # Flag to specify output file to compiler/linker
139 # Flags to enable precompiled headers
140 CFLAGS_CREATE_PCH
=-x c
++-header
-I
$(INCPCH
) -DPRECOMPILED_HEADERS
141 CFLAGS_USE_PCH
=-I
$(SLO
)/pch
-DPRECOMPILED_HEADERS
-Winvalid-pch
142 CFLAGS_USE_EXCEPTIONS_PCH
=-I
$(SLO
)/pch_ex
-DPRECOMPILED_HEADERS
-Winvalid-pch
144 # ---------------------------------
146 # ---------------------------------
147 CFLAGSOPT
=-O2
-fno-strict-aliasing
150 # -Wshadow does not work for C with nested uses of pthread_cleanup_push:
151 # -Wshadow does not work for C++ as /usr/include/c++/4.0.0/ext/hashtable.h
152 # l. 717 contains a declaration of __cur2 shadowing the declaration at l. 705,
153 # in template code for which a #pragma gcc system_header would not work:
154 # -Wextra doesn not work for gcc-3.3
155 CFLAGSWARNCC
=-Wall
-Wendif-labels
156 CFLAGSWARNCXX
=$(CFLAGSWARNCC
) -Wno-ctor-dtor-privacy
-Wno-non-virtual-dtor
157 CFLAGSWALLCC
=$(CFLAGSWARNCC
)
158 CFLAGSWALLCXX
=$(CFLAGSWARNCXX
)
161 # All modules on this platform compile without warnings.
162 # If you need to set MODULES_WITH_WARNINGS here, comment
163 # COMPILER_WARN_ERRORS=TRUE here (see settings.mk):
164 COMPILER_WARN_ERRORS
=TRUE
166 #special settings form environment
167 CDEFS
+=$(EXTRA_CDEFS
)
171 # ---------------------------------
172 # STLport library names
173 # ---------------------------------
174 .IF
"$(USE_STLP_DEBUG)" != ""
175 .IF
"$(STLPORT_VER)" >= "500"
176 LIBSTLPORT
=-lstlportstlg
177 LIBSTLPORTST
=$(STATIC
) -lstlportstlg
179 LIBSTLPORT
=-lstlport_gcc_stldebug
180 LIBSTLPORTST
=$(SOLARVERSION
)/$(INPATH
)/lib
/libstlport_gcc_stldebug.a
182 .ELSE
# "$(USE_STLP_DEBUG" != ""
183 .IF
"$(STLPORT_VER)" >= "500"
185 LIBSTLPORTST
=$(STATIC
) -lstlport
187 LIBSTLPORT
=-lstlport_gcc
188 LIBSTLPORTST
=$(SOLARVERSION
)/$(INPATH
)/lib
/libstlport_gcc.a
190 .ENDIF
# "$(USE_STLP_DEBUG" != ""
192 # ---------------------------------
194 # ---------------------------------
195 # always link with gcc since you may be linking c code and don't want -lstdc++ linked in!
197 ## ericb 04 mars 2005
202 LINKFLAGSDEFS
*=-Wl
,-multiply_defined
,suppress
203 # assure backwards-compatibility
204 EXTRA_LINKFLAGS
*=-Wl
,-syslibroot
,/Developer
/SDKs
/MacOSX10.4u.sdk
205 # Very long install_names are needed so that install_name_tool -change later on
206 # does not complain that "larger updated load commands do not fit:"
207 LINKFLAGSRUNPATH_URELIB
=-install_name
'@__________________________________________________URELIB/$(@:f)'
208 LINKFLAGSRUNPATH_UREBIN
=
209 LINKFLAGSRUNPATH_OOO
=-install_name
'@__________________________________________________OOO/$(@:f)'
210 LINKFLAGSRUNPATH_SDK
=
211 LINKFLAGSRUNPATH_BRAND
=
212 LINKFLAGSRUNPATH_OXT
=
213 LINKFLAGSRUNPATH_NONE
=
214 LINKFLAGS
=$(LINKFLAGSDEFS
)
216 .IF
"$(HAVE_WORKING_LD_AS_NEEDED)" == "TRUE"
217 LINKFLAGS
+= -Wl
,--as-needed
220 # [ed] 5/14/02 If we're building for aqua, add in the objc runtime library into our link line
221 .IF
"$(GUIBASE)" == "aqua"
223 # Sometimes we still use files that would be in a GUIBASE="unx" specific directory
224 # because they really aren't GUIBASE specific, so we've got to account for that here.
225 INCGUI
+= -I
$(PRJ
)/unx
/inc
228 #special settings form environment
229 LINKFLAGS
+=$(EXTRA_LINKFLAGS
)
231 # Random link flags dealing with different cases of linking
233 LINKFLAGSAPPGUI
=-bind_at_load
234 LINKFLAGSSHLGUI
=-dynamiclib
-single_module
235 LINKFLAGSAPPCUI
=-bind_at_load
236 LINKFLAGSSHLCUI
=-dynamiclib
-single_module
240 # Flag to add debugging information to final products
244 # ---------------------------------
245 # MacOS X shared library specifics
246 # ---------------------------------
248 # Tag to identify an output file as a library
250 # File extension to identify dynamic shared libraries on MacOS X
252 # Precompiled header file extension
255 # We don't use mapping on MacOS X
256 #LINKVERSIONMAPFLAG=-Wl,--version-script
257 LINKVERSIONMAPFLAG
=-Wl
,-exported_symbols_list
263 STDOBJVCL
=$(L
)/salmain.o
269 .IF
"$(GUIBASE)" == "aqua"
270 STDLIBCUIMT
=CPPRUNTIME
-lm
271 STDLIBGUIMT
=-framework Carbon
-framework Cocoa
-lpthread CPPRUNTIME
-lm
272 STDSHLCUIMT
=-lpthread CPPRUNTIME
-lm
273 STDSHLGUIMT
=-framework Carbon
-framework CoreFoundation
-framework Cocoa
-lpthread CPPRUNTIME
-lm
275 STDLIBCUIMT
= CPPRUNTIME
-lm
276 STDLIBGUIMT
=-lX11
-lpthread CPPRUNTIME
-lm
277 STDSHLCUIMT
=-lpthread CPPRUNTIME
-lm
278 STDSHLGUIMT
=-lX11
-lXext
-lpthread CPPRUNTIME
-lm
-framework CoreFoundation
291 RCFLAGS
=-fo
$@
$(RCFILES
)
296 # Add SOLARLIBDIR to the end of a (potentially previously undefined)
297 # DYLD_LIBRARY_PATH (there is no real reason to prefer adding at the end over
298 # adding at the start); the ": &&" in the bash case enables this to work at the
299 # start of a recipe line that is not prefixed by "+" as well as in the middle of
300 # an existing && chain; the tcsh case is somewhat imprecise in that it
301 # potentially affects multiple commands following on the recipe line:
302 .IF
"$(USE_SHELL)" == "bash"
303 AUGMENT_LIBRARY_PATH
= : && \
304 DYLD_LIBRARY_PATH
=$${{DYLD_LIBRARY_PATH
+$${{DYLD_LIBRARY_PATH
}}:}}$(SOLARLIBDIR
)
306 AUGMENT_LIBRARY_PATH
= if
($$?DYLD_LIBRARY_PATH
== 1) \
307 eval
'setenv DYLD_LIBRARY_PATH "$${{DYLD_LIBRARY_PATH}}:$(SOLARLIBDIR)"' \
308 && if
($$?DYLD_LIBRARY_PATH
== 0) \
309 setenv DYLD_LIBRARY_PATH
"$(SOLARLIBDIR)" &&