xref: /aoo42x/main/solenv/inc/unxmacx.mk (revision 7871dc3e)
1*7871dc3eSAndrew Rist#**************************************************************
2*7871dc3eSAndrew Rist#
3*7871dc3eSAndrew Rist#  Licensed to the Apache Software Foundation (ASF) under one
4*7871dc3eSAndrew Rist#  or more contributor license agreements.  See the NOTICE file
5*7871dc3eSAndrew Rist#  distributed with this work for additional information
6*7871dc3eSAndrew Rist#  regarding copyright ownership.  The ASF licenses this file
7*7871dc3eSAndrew Rist#  to you under the Apache License, Version 2.0 (the
8*7871dc3eSAndrew Rist#  "License"); you may not use this file except in compliance
9*7871dc3eSAndrew Rist#  with the License.  You may obtain a copy of the License at
10*7871dc3eSAndrew Rist#
11*7871dc3eSAndrew Rist#    http://www.apache.org/licenses/LICENSE-2.0
12*7871dc3eSAndrew Rist#
13*7871dc3eSAndrew Rist#  Unless required by applicable law or agreed to in writing,
14*7871dc3eSAndrew Rist#  software distributed under the License is distributed on an
15*7871dc3eSAndrew Rist#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*7871dc3eSAndrew Rist#  KIND, either express or implied.  See the License for the
17*7871dc3eSAndrew Rist#  specific language governing permissions and limitations
18*7871dc3eSAndrew Rist#  under the License.
19*7871dc3eSAndrew Rist#
20*7871dc3eSAndrew Rist#**************************************************************
21*7871dc3eSAndrew Rist
22*7871dc3eSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir##########################################################################
25cdf0e10cSrcweir# Platform MAKEFILE for Mac OS X and Darwin on both PowerPC and Intel
26cdf0e10cSrcweir##########################################################################
27cdf0e10cSrcweir
28cdf0e10cSrcweir# PROCESSOR_DEFINES and DLLPOSTFIX are defined in the particular platform file
29cdf0e10cSrcweir
30cdf0e10cSrcweirASM=
31cdf0e10cSrcweirAFLAGS=
32cdf0e10cSrcweirLINKOUTPUT_FILTER=
33cdf0e10cSrcweir
34cdf0e10cSrcweir# Definitions that we may need on the compile line.
35cdf0e10cSrcweir# -D_PTHREADS and -D_REENTRANT are needed for STLport, and must be specified when
36cdf0e10cSrcweir#  compiling STLport sources too, either internally or externally.
37cdf0e10cSrcweirCDEFS+=-DGLIBC=2 -D_PTHREADS -D_REENTRANT -DNO_PTHREAD_PRIORITY $(PROCESSOR_DEFINES) -DSTLPORT_VERSION=$(STLPORT_VER) -D_USE_NAMESPACE=1
38cdf0e10cSrcweir.IF "$(GUIBASE)"=="unx" && "$(USE_SYSTEM_STL)"!="YES"
39cdf0e10cSrcweirCDEFS+=-DX_LOCALE
40cdf0e10cSrcweir.ENDIF
41cdf0e10cSrcweir.IF "$(GUIBASE)"=="aqua"
42cdf0e10cSrcweir# MAXOSX_DEPLOYMENT_TARGET : The minimum version required to run the build,
43cdf0e10cSrcweir# build can assume functions/libraries of that version to be available
44cdf0e10cSrcweir# unless you want to do runtime checks for 10.5 api, you also want to use the 10.4 sdk
45cdf0e10cSrcweir# (safer/easier than dealing with the MAC_OS_X_VERSION_MAX_ALLOWED macro)
46cdf0e10cSrcweir# http://developer.apple.com/technotes/tn2002/tn2064.html
47cdf0e10cSrcweir# done in setsolar/configure now. left here for documentation
48cdf0e10cSrcweir#MACOSX_DEPLOYMENT_TARGET=10.4
49cdf0e10cSrcweir#.EXPORT: MACOSX_DEPLOYMENT_TARGET
50cdf0e10cSrcweirCDEFS+=-DQUARTZ
51cdf0e10cSrcweirEXTRA_CDEFS*=-isysroot /Developer/SDKs/MacOSX10.4u.sdk
52cdf0e10cSrcweir.ENDIF
53cdf0e10cSrcweir
54cdf0e10cSrcweir# Name of library where static data members are initialized
55cdf0e10cSrcweir# STATICLIBNAME=static$(DLLPOSTFIX)
56cdf0e10cSrcweir# STATICLIB=-l$(STATICLIBNAME)
57cdf0e10cSrcweir
58cdf0e10cSrcweir# enable visibility define in "sal/types.h"
59cdf0e10cSrcweir.IF "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE"
60cdf0e10cSrcweirCDEFS += -DHAVE_GCC_VISIBILITY_FEATURE
61cdf0e10cSrcweir.ENDIF # "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE"
62cdf0e10cSrcweir
63cdf0e10cSrcweir
64cdf0e10cSrcweir# MacOS X specific Java compilation/link flags
65cdf0e10cSrcweirSOLAR_JAVA*=TRUE
66cdf0e10cSrcweir.IF "$(SOLAR_JAVA)"!=""
67cdf0e10cSrcweir	JAVADEF=-DSOLAR_JAVA
68cdf0e10cSrcweir	JAVAFLAGSDEBUG=-g
69cdf0e10cSrcweir	JAVA_RUNTIME=-framework JavaVM
70cdf0e10cSrcweir.ENDIF
71cdf0e10cSrcweir
72cdf0e10cSrcweir# architecture dependent flags for the C and C++ compiler that can be changed by
73cdf0e10cSrcweir# exporting the variable ARCH_FLAGS="..." in the shell, which is used to start build
74cdf0e10cSrcweirARCH_FLAGS*=
75cdf0e10cSrcweir
76cdf0e10cSrcweir# Specify the compiler to use.  NOTE:  MacOS X should always specify
77cdf0e10cSrcweir# c++ for C++ compilation as it does certain C++ specific things
78cdf0e10cSrcweir# behind the scenes for us.
79cdf0e10cSrcweir# CC = C++ compiler to use
80cdf0e10cSrcweir# cc = C compiler to use
81cdf0e10cSrcweir# objc = Objective C compiler to use
82cdf0e10cSrcweir# objcpp = Objective C++ compiler to use
83cdf0e10cSrcweirCXX*=g++
84cdf0e10cSrcweirCC*=gcc
85cdf0e10cSrcweirobjc*=$(CC)
86cdf0e10cSrcweirobjcpp*=$(CXX)
87cdf0e10cSrcweir
88cdf0e10cSrcweirCFLAGS=-fsigned-char -fmessage-length=0 -malign-natural -c $(EXTRA_CFLAGS)
89cdf0e10cSrcweir
90cdf0e10cSrcweir.IF "$(DISABLE_DEPRECATION_WARNING)" == "TRUE"
91cdf0e10cSrcweirCFLAGS+=-Wno-deprecated-declarations
92cdf0e10cSrcweir.ENDIF
93cdf0e10cSrcweir# ---------------------------------
94cdf0e10cSrcweir#  Compilation flags
95cdf0e10cSrcweir# ---------------------------------
96cdf0e10cSrcweir# Normal C compilation flags
97cdf0e10cSrcweirCFLAGSCC=-pipe -fsigned-char -malign-natural $(ARCH_FLAGS)
98cdf0e10cSrcweir
99cdf0e10cSrcweir# Normal Objective C compilation flags
100cdf0e10cSrcweir#OBJCFLAGS=-no-precomp
101cdf0e10cSrcweirOBJCFLAGS=-fobjc-exceptions
102cdf0e10cSrcweir# -x options generally ignored by ccache, tell it that it can cache
103cdf0e10cSrcweir# the result nevertheless
104cdf0e10cSrcweirCCACHE_SKIP:=$(eq,$(USE_CCACHE),YES --ccache-skip $(NULL))
105cdf0e10cSrcweirOBJCXXFLAGS:=$(CCACHE_SKIP) -x $(CCACHE_SKIP) objective-c++ -fobjc-exceptions
106cdf0e10cSrcweir
107cdf0e10cSrcweir# Comp Flags for files that need exceptions enabled (C and C++)
108cdf0e10cSrcweirCFLAGSEXCEPTIONS=-fexceptions -fno-enforce-eh-specs
109cdf0e10cSrcweir
110cdf0e10cSrcweir# Comp Flags for files that do not need exceptions enabled (C and C++)
111cdf0e10cSrcweirCFLAGS_NO_EXCEPTIONS=-fno-exceptions
112cdf0e10cSrcweir
113cdf0e10cSrcweir# Normal C++ compilation flags
114cdf0e10cSrcweirCFLAGSCXX=-pipe -malign-natural -fsigned-char -Wno-long-double $(ARCH_FLAGS)
115cdf0e10cSrcweirCFLAGSCXX+= -Wno-ctor-dtor-privacy
116cdf0e10cSrcweir
117cdf0e10cSrcweirPICSWITCH:=-fPIC
118cdf0e10cSrcweir# Other flags
119cdf0e10cSrcweirCFLAGSOBJGUIMT=$(PICSWITCH) -fno-common
120cdf0e10cSrcweirCFLAGSOBJCUIMT=$(PICSWITCH) -fno-common
121cdf0e10cSrcweirCFLAGSSLOGUIMT=$(PICSWITCH) -fno-common
122cdf0e10cSrcweirCFLAGSSLOCUIMT=$(PICSWITCH) -fno-common
123cdf0e10cSrcweirCFLAGSPROF=
124cdf0e10cSrcweir
125cdf0e10cSrcweir# Flag for including debugging information in object files
126cdf0e10cSrcweirCFLAGSDEBUG=-g
127cdf0e10cSrcweirCFLAGSDBGUTIL=
128cdf0e10cSrcweir
129cdf0e10cSrcweir# Flag to specify output file to compiler/linker
130cdf0e10cSrcweirCFLAGSOUTOBJ=-o
131cdf0e10cSrcweir
132cdf0e10cSrcweir# Flags to enable precompiled headers
133cdf0e10cSrcweirCFLAGS_CREATE_PCH=-x c++-header -I$(INCPCH) -DPRECOMPILED_HEADERS
134cdf0e10cSrcweirCFLAGS_USE_PCH=-I$(SLO)/pch -DPRECOMPILED_HEADERS -Winvalid-pch
135cdf0e10cSrcweirCFLAGS_USE_EXCEPTIONS_PCH=-I$(SLO)/pch_ex -DPRECOMPILED_HEADERS -Winvalid-pch
136cdf0e10cSrcweir
137cdf0e10cSrcweir# ---------------------------------
138cdf0e10cSrcweir#  Optimization flags
139cdf0e10cSrcweir# ---------------------------------
140cdf0e10cSrcweirCFLAGSOPT=-O2 -fno-strict-aliasing
141cdf0e10cSrcweirCFLAGSNOOPT=-O0
142cdf0e10cSrcweir
143cdf0e10cSrcweir# -Wshadow does not work for C with nested uses of pthread_cleanup_push:
144cdf0e10cSrcweir# -Wshadow does not work for C++ as /usr/include/c++/4.0.0/ext/hashtable.h
145cdf0e10cSrcweir# l. 717 contains a declaration of __cur2 shadowing the declaration at l. 705,
146cdf0e10cSrcweir# in template code for which a #pragma gcc system_header would not work:
147cdf0e10cSrcweir# -Wextra doesn not work for gcc-3.3
148cdf0e10cSrcweirCFLAGSWARNCC=-Wall -Wendif-labels
149cdf0e10cSrcweirCFLAGSWARNCXX=$(CFLAGSWARNCC) -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor
150cdf0e10cSrcweirCFLAGSWALLCC=$(CFLAGSWARNCC)
151cdf0e10cSrcweirCFLAGSWALLCXX=$(CFLAGSWARNCXX)
152cdf0e10cSrcweirCFLAGSWERRCC=-Werror
153cdf0e10cSrcweir
154cdf0e10cSrcweir# All modules on this platform compile without warnings.
155cdf0e10cSrcweir# If you need to set MODULES_WITH_WARNINGS here, comment
156cdf0e10cSrcweir# COMPILER_WARN_ERRORS=TRUE here (see settings.mk):
157cdf0e10cSrcweirCOMPILER_WARN_ERRORS=TRUE
158cdf0e10cSrcweir
159cdf0e10cSrcweir#special settings form environment
160cdf0e10cSrcweirCDEFS+=$(EXTRA_CDEFS)
161cdf0e10cSrcweir
162cdf0e10cSrcweirSTDLIBCPP=-lstdc++
163cdf0e10cSrcweir
164cdf0e10cSrcweir# ---------------------------------
165cdf0e10cSrcweir#  STLport library names
166cdf0e10cSrcweir# ---------------------------------
167cdf0e10cSrcweir.IF "$(USE_STLP_DEBUG)" != ""
168cdf0e10cSrcweir.IF "$(STLPORT_VER)" >= "500"
169cdf0e10cSrcweirLIBSTLPORT=-lstlportstlg
170cdf0e10cSrcweirLIBSTLPORTST=$(STATIC) -lstlportstlg
171cdf0e10cSrcweir.ELSE
172cdf0e10cSrcweirLIBSTLPORT=-lstlport_gcc_stldebug
173cdf0e10cSrcweirLIBSTLPORTST=$(SOLARVERSION)/$(INPATH)/lib/libstlport_gcc_stldebug.a
174cdf0e10cSrcweir.ENDIF
175cdf0e10cSrcweir.ELSE # "$(USE_STLP_DEBUG" != ""
176cdf0e10cSrcweir.IF "$(STLPORT_VER)" >= "500"
177cdf0e10cSrcweirLIBSTLPORT=-lstlport
178cdf0e10cSrcweirLIBSTLPORTST=$(STATIC) -lstlport
179cdf0e10cSrcweir.ELSE
180cdf0e10cSrcweirLIBSTLPORT=-lstlport_gcc
181cdf0e10cSrcweirLIBSTLPORTST=$(SOLARVERSION)/$(INPATH)/lib/libstlport_gcc.a
182cdf0e10cSrcweir.ENDIF
183cdf0e10cSrcweir.ENDIF # "$(USE_STLP_DEBUG" != ""
184cdf0e10cSrcweir
185cdf0e10cSrcweir# ---------------------------------
186cdf0e10cSrcweir#  Link stage flags
187cdf0e10cSrcweir# ---------------------------------
188cdf0e10cSrcweir# always link with gcc since you may be linking c code and don't want -lstdc++ linked in!
189cdf0e10cSrcweir
190cdf0e10cSrcweir##  ericb 04 mars 2005
191cdf0e10cSrcweir
192cdf0e10cSrcweirLINK*=$(CXX)
193cdf0e10cSrcweirLINKC*=$(CC)
194cdf0e10cSrcweir
195cdf0e10cSrcweirLINKFLAGSDEFS*=-Wl,-multiply_defined,suppress
196cdf0e10cSrcweir# assure backwards-compatibility
197cdf0e10cSrcweirEXTRA_LINKFLAGS*=-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk
198cdf0e10cSrcweir# Very long install_names are needed so that install_name_tool -change later on
199cdf0e10cSrcweir# does not complain that "larger updated load commands do not fit:"
200cdf0e10cSrcweirLINKFLAGSRUNPATH_URELIB=-install_name '@__________________________________________________URELIB/$(@:f)'
201cdf0e10cSrcweirLINKFLAGSRUNPATH_UREBIN=
202cdf0e10cSrcweirLINKFLAGSRUNPATH_OOO=-install_name '@__________________________________________________OOO/$(@:f)'
203cdf0e10cSrcweirLINKFLAGSRUNPATH_SDK=
204cdf0e10cSrcweirLINKFLAGSRUNPATH_BRAND=
205cdf0e10cSrcweirLINKFLAGSRUNPATH_OXT=
206cdf0e10cSrcweirLINKFLAGSRUNPATH_BOXT=
207cdf0e10cSrcweirLINKFLAGSRUNPATH_NONE=-install_name '@__________________________________________________NONE/$(@:f)'
208cdf0e10cSrcweirLINKFLAGS=$(LINKFLAGSDEFS)
209cdf0e10cSrcweir
210cdf0e10cSrcweir# [ed] 5/14/02 If we're building for aqua, add in the objc runtime library into our link line
211cdf0e10cSrcweir.IF "$(GUIBASE)" == "aqua"
212cdf0e10cSrcweir	LINKFLAGS+=-lobjc
213cdf0e10cSrcweir	# Sometimes we still use files that would be in a GUIBASE="unx" specific directory
214cdf0e10cSrcweir	# because they really aren't GUIBASE specific, so we've got to account for that here.
215cdf0e10cSrcweir	INCGUI+= -I$(PRJ)/unx/inc
216cdf0e10cSrcweir.ENDIF
217cdf0e10cSrcweir
218cdf0e10cSrcweir#special settings form environment
219cdf0e10cSrcweirLINKFLAGS+=$(EXTRA_LINKFLAGS)
220cdf0e10cSrcweir
221cdf0e10cSrcweir# Random link flags dealing with different cases of linking
222cdf0e10cSrcweir
223cdf0e10cSrcweirLINKFLAGSAPPGUI=-bind_at_load
224cdf0e10cSrcweirLINKFLAGSSHLGUI=-dynamiclib -single_module
225cdf0e10cSrcweirLINKFLAGSAPPCUI=-bind_at_load
226cdf0e10cSrcweirLINKFLAGSSHLCUI=-dynamiclib -single_module
227cdf0e10cSrcweirLINKFLAGSTACK=
228cdf0e10cSrcweirLINKFLAGSPROF=
229cdf0e10cSrcweir
230cdf0e10cSrcweir# Flag to add debugging information to final products
231cdf0e10cSrcweirLINKFLAGSDEBUG=-g
232cdf0e10cSrcweirLINKFLAGSOPT=
233cdf0e10cSrcweir
234cdf0e10cSrcweir# ---------------------------------
235cdf0e10cSrcweir#  MacOS X shared library specifics
236cdf0e10cSrcweir# ---------------------------------
237cdf0e10cSrcweir
238cdf0e10cSrcweir# Tag to identify an output file as a library
239cdf0e10cSrcweirDLLPRE=lib
240cdf0e10cSrcweir# File extension to identify dynamic shared libraries on MacOS X
241cdf0e10cSrcweirDLLPOST=.dylib
242cdf0e10cSrcweir# Precompiled header file extension
243cdf0e10cSrcweirPCHPOST=.gch
244cdf0e10cSrcweir
245cdf0e10cSrcweir# We don't use mapping on MacOS X
246cdf0e10cSrcweir#LINKVERSIONMAPFLAG=-Wl,--version-script
247cdf0e10cSrcweirLINKVERSIONMAPFLAG=-Wl,-exported_symbols_list
248cdf0e10cSrcweir
249cdf0e10cSrcweirSONAME_SWITCH=-Wl,-h
250cdf0e10cSrcweir
251cdf0e10cSrcweirSTDLIBCPP=-lstdc++
252cdf0e10cSrcweir
253cdf0e10cSrcweirSTDOBJVCL=$(L)/salmain.o
254cdf0e10cSrcweirSTDOBJGUI=
255cdf0e10cSrcweirSTDSLOGUI=
256cdf0e10cSrcweirSTDOBJCUI=
257cdf0e10cSrcweirSTDSLOCUI=
258cdf0e10cSrcweir
259cdf0e10cSrcweir.IF "$(GUIBASE)" == "aqua"
260cdf0e10cSrcweir	STDLIBCUIMT=CPPRUNTIME -lm
261cdf0e10cSrcweir	STDLIBGUIMT=-framework Carbon -framework Cocoa -lpthread CPPRUNTIME -lm
262cdf0e10cSrcweir	STDSHLCUIMT=-lpthread CPPRUNTIME -lm
263cdf0e10cSrcweir	STDSHLGUIMT=-framework Carbon -framework CoreFoundation -framework Cocoa -lpthread CPPRUNTIME -lm
264cdf0e10cSrcweir.ELSE
265cdf0e10cSrcweir	STDLIBCUIMT= CPPRUNTIME -lm
266cdf0e10cSrcweir	STDLIBGUIMT=-lX11 -lpthread CPPRUNTIME -lm
267cdf0e10cSrcweir	STDSHLCUIMT=-lpthread CPPRUNTIME -lm
268cdf0e10cSrcweir	STDSHLGUIMT=-lX11 -lXext -lpthread CPPRUNTIME -lm -framework CoreFoundation
269cdf0e10cSrcweir.ENDIF
270cdf0e10cSrcweir
271cdf0e10cSrcweirLIBMGR=ar
272cdf0e10cSrcweirLIBFLAGS=-r
273cdf0e10cSrcweir
274cdf0e10cSrcweirIMPLIB=
275cdf0e10cSrcweirIMPLIBFLAGS=
276cdf0e10cSrcweir
277cdf0e10cSrcweirMAPSYM=
278cdf0e10cSrcweirMAPSYMFLAGS=
279cdf0e10cSrcweir
280cdf0e10cSrcweirRC=irc
281cdf0e10cSrcweirRCFLAGS=-fo$@ $(RCFILES)
282cdf0e10cSrcweirRCLINK=
283cdf0e10cSrcweirRCLINKFLAGS=
284cdf0e10cSrcweirRCSETVERSION=
285cdf0e10cSrcweir
286cdf0e10cSrcweirOOO_LIBRARY_PATH_VAR = DYLD_LIBRARY_PATH
287