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
38 # DARWIN_VERSION holds the Darwin version in the format: 000000. For example,
39 # if the Darwin version is 1.3.7, DARWIN_VERSION will be set to 010307.
40 # Not used now, comment it out. Remove it after some time.
41 # DARWIN_VERSION=$(shell -/bin/sh -c "uname -r | sed 's/\./ /g' | xargs printf %2.2i%2.2i%2.2i")
47 # Definitions that we may need on the compile line.
48 # -D_PTHREADS and -D_REENTRANT are needed for STLport, and must be specified when
49 # compiling STLport sources too, either internally or externally.
50 CDEFS
+=-DGLIBC
=2 -D_PTHREADS
-D_REENTRANT
-DNO_PTHREAD_PRIORITY
$(PROCESSOR_DEFINES
) -DSTLPORT_VERSION
=$(STLPORT_VER
) -D_USE_NAMESPACE
=1
51 .IF
"$(GUIBASE)"=="unx" && "$(USE_SYSTEM_STL)"!="YES"
54 .IF
"$(GUIBASE)"=="aqua"
55 # TODO: use MACOSX_DEPLOYMENT_TARGET instead of MAC_OS_X_VERSION_MIN_REQUIRED?
56 CDEFS
+=-DQUARTZ
-DMAC_OS_X_VERSION_MIN_REQUIRED
=1040
59 # Name of library where static data members are initialized
60 # STATICLIBNAME=static$(DLLPOSTFIX)
61 # STATICLIB=-l$(STATICLIBNAME)
63 # enable visibility define in "sal/types.h"
64 .IF
"$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE"
65 CDEFS
+= -DHAVE_GCC_VISIBILITY_FEATURE
66 .ENDIF
# "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE"
69 # MacOS X specific Java compilation/link flags
71 .IF
"$(SOLAR_JAVA)"!=""
74 JAVA_RUNTIME
=-framework JavaVM
77 # architecture dependent flags for the C and C++ compiler that can be changed by
78 # exporting the variable ARCH_FLAGS="..." in the shell, which is used to start build
81 # Specify the compiler to use. NOTE: MacOS X should always specify
82 # c++ for C++ compilation as it does certain C++ specific things
83 # behind the scenes for us.
84 # CC = C++ compiler to use
85 # cc = C compiler to use
86 # objc = Objective C compiler to use
87 # objcpp = Objective C++ compiler to use
93 CFLAGS
=-fmessage-length
=0 -malign-natural
-c
$(EXTRA_CFLAGS
)
95 .IF
"$(DISABLE_DEPRECATION_WARNING)" == "TRUE"
96 CFLAGS
+=-Wno-deprecated-declarations
98 # ---------------------------------
100 # ---------------------------------
101 # Normal C compilation flags
102 CFLAGSCC
=-pipe
-malign-natural
$(ARCH_FLAGS
)
104 # Normal Objective C compilation flags
105 #OBJCFLAGS=-no-precomp
106 OBJCFLAGS
=-fobjc-exceptions
107 OBJCXXFLAGS
=-x objective-c
++ -fobjc-exceptions
109 # Comp Flags for files that need exceptions enabled (C and C++)
110 CFLAGSEXCEPTIONS
=-fexceptions
-fno-enforce-eh-specs
112 # Comp Flags for files that do not need exceptions enabled (C and C++)
113 CFLAGS_NO_EXCEPTIONS
=-fno-exceptions
115 # Normal C++ compilation flags
116 CFLAGSCXX
=-pipe
-malign-natural
-Wno-long-double
$(ARCH_FLAGS
)
117 CFLAGSCXX
+= -Wno-ctor-dtor-privacy
121 CFLAGSOBJGUIMT
=$(PICSWITCH
) -fno-common
122 CFLAGSOBJCUIMT
=$(PICSWITCH
) -fno-common
123 CFLAGSSLOGUIMT
=$(PICSWITCH
) -fno-common
124 CFLAGSSLOCUIMT
=$(PICSWITCH
) -fno-common
127 # Flag for including debugging information in object files
131 # Flag to specify output file to compiler/linker
134 # Flags to enable precompiled headers
135 CFLAGS_CREATE_PCH
=-x c
++-header
-I
$(INCPCH
) -DPRECOMPILED_HEADERS
136 CFLAGS_USE_PCH
=-I
$(SLO
)/pch
-DPRECOMPILED_HEADERS
-Winvalid-pch
137 CFLAGS_USE_EXCEPTIONS_PCH
=-I
$(SLO
)/pch_ex
-DPRECOMPILED_HEADERS
-Winvalid-pch
139 # ---------------------------------
141 # ---------------------------------
142 CFLAGSOPT
=-O2
-fno-strict-aliasing
145 # -Wshadow does not work for C with nested uses of pthread_cleanup_push:
146 # -Wshadow does not work for C++ as /usr/include/c++/4.0.0/ext/hashtable.h
147 # l. 717 contains a declaration of __cur2 shadowing the declaration at l. 705,
148 # in template code for which a #pragma gcc system_header would not work:
149 # -Wextra doesn not work for gcc-3.3
150 CFLAGSWARNCC
=-Wall
-Wendif-labels
151 CFLAGSWARNCXX
=$(CFLAGSWARNCC
) -Wno-ctor-dtor-privacy
-Wno-non-virtual-dtor
152 CFLAGSWALLCC
=$(CFLAGSWARNCC
)
153 CFLAGSWALLCXX
=$(CFLAGSWARNCXX
)
156 # All modules on this platform compile without warnings.
157 # If you need to set MODULES_WITH_WARNINGS here, comment
158 # COMPILER_WARN_ERRORS=TRUE here (see settings.mk):
159 COMPILER_WARN_ERRORS
=TRUE
161 #special settings form environment
162 CDEFS
+=$(EXTRA_CDEFS
)
166 # ---------------------------------
167 # STLport library names
168 # ---------------------------------
169 .IF
"$(USE_STLP_DEBUG)" != ""
170 .IF
"$(STLPORT_VER)" >= "500"
171 LIBSTLPORT
=-lstlportstlg
172 LIBSTLPORTST
=$(STATIC
) -lstlportstlg
174 LIBSTLPORT
=-lstlport_gcc_stldebug
175 LIBSTLPORTST
=$(SOLARVERSION
)/$(INPATH
)/lib
/libstlport_gcc_stldebug.a
177 .ELSE
# "$(USE_STLP_DEBUG" != ""
178 .IF
"$(STLPORT_VER)" >= "500"
180 LIBSTLPORTST
=$(STATIC
) -lstlport
182 LIBSTLPORT
=-lstlport_gcc
183 LIBSTLPORTST
=$(SOLARVERSION
)/$(INPATH
)/lib
/libstlport_gcc.a
185 .ENDIF
# "$(USE_STLP_DEBUG" != ""
187 # ---------------------------------
189 # ---------------------------------
190 # always link with gcc since you may be linking c code and don't want -lstdc++ linked in!
192 ## ericb 04 mars 2005
197 LINKFLAGSDEFS
*=-Wl
,-multiply_defined
,suppress
198 # Very long install_names are needed so that install_name_tool -change later on
199 # does not complain that "larger updated load commands do not fit:"
200 LINKFLAGSRUNPATH_URELIB
=-install_name
'@__________________________________________________URELIB/$(@:f)'
201 LINKFLAGSRUNPATH_UREBIN
=
202 LINKFLAGSRUNPATH_OOO
=-install_name
'@__________________________________________________OOO/$(@:f)'
203 LINKFLAGSRUNPATH_SDK
=
204 LINKFLAGSRUNPATH_BRAND
=
205 LINKFLAGSRUNPATH_OXT
=
206 LINKFLAGSRUNPATH_NONE
=
207 LINKFLAGS
=$(LINKFLAGSDEFS
)
209 .IF
"$(HAVE_WORKING_LD_AS_NEEDED)" == "TRUE"
210 LINKFLAGS
+= -Wl
,--as-needed
213 # [ed] 5/14/02 If we're building for aqua, add in the objc runtime library into our link line
214 .IF
"$(GUIBASE)" == "aqua"
216 # Sometimes we still use files that would be in a GUIBASE="unx" specific directory
217 # because they really aren't GUIBASE specific, so we've got to account for that here.
218 INCGUI
+= -I
$(PRJ
)/unx
/inc
221 #special settings form environment
222 LINKFLAGS
+=$(EXTRA_LINKFLAGS
)
224 # Random link flags dealing with different cases of linking
226 LINKFLAGSAPPGUI
=-bind_at_load
227 LINKFLAGSSHLGUI
=-dynamiclib
-single_module
228 LINKFLAGSAPPCUI
=-bind_at_load
229 LINKFLAGSSHLCUI
=-dynamiclib
-single_module
233 # Flag to add debugging information to final products
237 # ---------------------------------
238 # MacOS X shared library specifics
239 # ---------------------------------
241 # Tag to identify an output file as a library
243 # File extension to identify dynamic shared libraries on MacOS X
245 # Precompiled header file extension
248 # We don't use mapping on MacOS X
249 #LINKVERSIONMAPFLAG=-Wl,--version-script
250 LINKVERSIONMAPFLAG
=-Wl
,-exported_symbols_list
256 STDOBJVCL
=$(L
)/salmain.o
262 .IF
"$(GUIBASE)" == "aqua"
263 STDLIBCUIMT
=CPPRUNTIME
-lm
264 STDLIBGUIMT
=-framework Carbon
-framework Cocoa
-lpthread CPPRUNTIME
-lm
265 STDSHLCUIMT
=-lpthread CPPRUNTIME
-lm
266 STDSHLGUIMT
=-framework Carbon
-framework CoreFoundation
-framework Cocoa
-lpthread CPPRUNTIME
-lm
268 STDLIBCUIMT
= CPPRUNTIME
-lm
269 STDLIBGUIMT
=-lX11
-lpthread CPPRUNTIME
-lm
270 STDSHLCUIMT
=-lpthread CPPRUNTIME
-lm
271 STDSHLGUIMT
=-lX11
-lXext
-lpthread CPPRUNTIME
-lm
-framework CoreFoundation
284 RCFLAGS
=-fo
$@
$(RCFILES
)
289 # Add SOLARLIBDIR to the end of a (potentially previously undefined)
290 # DYLD_LIBRARY_PATH (there is no real reason to prefer adding at the end over
291 # adding at the start); the ": &&" in the bash case enables this to work at the
292 # start of a recipe line that is not prefixed by "+" as well as in the middle of
293 # an existing && chain; the tcsh case is somewhat imprecise in that it
294 # potentially affects multiple commands following on the recipe line:
295 .IF
"$(USE_SHELL)" == "bash"
296 AUGMENT_LIBRARY_PATH
= : && \
297 DYLD_LIBRARY_PATH
=$${{DYLD_LIBRARY_PATH
+$${{DYLD_LIBRARY_PATH
}}:}}$(SOLARLIBDIR
)
299 AUGMENT_LIBRARY_PATH
= if
($$?DYLD_LIBRARY_PATH
== 1) \
300 eval
'setenv DYLD_LIBRARY_PATH "$${{DYLD_LIBRARY_PATH}}:$(SOLARLIBDIR)"' \
301 && if
($$?DYLD_LIBRARY_PATH
== 0) \
302 setenv DYLD_LIBRARY_PATH
"$(SOLARLIBDIR)" &&