xref: /trunk/main/solenv/inc/unxmacc.mk (revision 2a8fa3f06b2c9d1595434663e9efddc53f9375b2)
1#**************************************************************
2#
3#  Licensed to the Apache Software Foundation (ASF) under one
4#  or more contributor license agreements.  See the NOTICE file
5#  distributed with this work for additional information
6#  regarding copyright ownership.  The ASF licenses this file
7#  to you under the Apache License, Version 2.0 (the
8#  "License"); you may not use this file except in compliance
9#  with the License.  You may obtain a copy of the License at
10#
11#    http://www.apache.org/licenses/LICENSE-2.0
12#
13#  Unless required by applicable law or agreed to in writing,
14#  software distributed under the License is distributed on an
15#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16#  KIND, either express or implied.  See the License for the
17#  specific language governing permissions and limitations
18#  under the License.
19#
20#**************************************************************
21
22
23
24##########################################################################
25# Platform MAKEFILE for Mac OS X and Darwin on both PowerPC and Intel
26##########################################################################
27
28# PROCESSOR_DEFINES and DLLPOSTFIX are defined in the particular platform file
29
30ASM=
31AFLAGS=
32LINKOUTPUT_FILTER=
33
34# Definitions that we may need on the compile line.
35# -D_PTHREADS and -D_REENTRANT are needed for STLport, and must be specified when
36#  compiling STLport sources too, either internally or externally.
37CDEFS+=-DGLIBC=2 -D_PTHREADS -D_REENTRANT -DNO_PTHREAD_PRIORITY $(PROCESSOR_DEFINES) -D_USE_NAMESPACE=1
38
39.IF "$(MACOSX_DEPLOYMENT_TARGET)" != ""
40    CDEFS += -DMAC_OS_X_VERSION_MAX_ALLOWED=MAC_OS_X_VERSION_$(subst,.,_ $(MACOSX_DEPLOYMENT_TARGET))
41.ENDIF
42
43CDEFS+=-DQUARTZ
44EXTRA_CDEFS*=-isysroot $(MACOSX_SDK_PATH)
45
46# Name of library where static data members are initialized
47# STATICLIBNAME=static$(DLLPOSTFIX)
48# STATICLIB=-l$(STATICLIBNAME)
49
50# enable visibility define in "sal/types.h"
51.IF "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE"
52    CDEFS += -DHAVE_GCC_VISIBILITY_FEATURE
53.ENDIF
54
55# MacOS X specific Java compilation/link flags
56SOLAR_JAVA*=TRUE
57.IF "$(SOLAR_JAVA)"!=""
58    JAVADEF=-DSOLAR_JAVA
59    JAVAFLAGSDEBUG=-g
60    JAVA_RUNTIME=-framework JavaVM
61.ENDIF
62
63# architecture dependent flags for the C and C++ compiler that can be changed by
64# exporting the variable ARCH_FLAGS="..." in the shell, which is used to start build
65ARCH_FLAGS*=
66
67# Specify the compiler to use.  NOTE:  MacOS X should always specify
68# c++ for C++ compilation as it does certain C++ specific things
69# behind the scenes for us.
70# CC = C++ compiler to use
71# cc = C compiler to use
72# objc = Objective C compiler to use
73# objcpp = Objective C++ compiler to use
74CXX*=clang++
75CC*=clang
76objc*=$(CC)
77objcpp*=$(CXX)
78
79EXTRA_CFLAGS=
80
81CFLAGS=-fsigned-char -fmessage-length=0 -c $(EXTRA_CFLAGS)
82
83.IF "$(DISABLE_DEPRECATION_WARNING)" == "TRUE"
84CFLAGS+=-Wno-deprecated-declarations
85.ENDIF
86# ---------------------------------
87#  Compilation flags
88# ---------------------------------
89# Normal C compilation flags
90# Clang 16+ (Xcode 15+) removed support for K&R-style function definitions and
91# implicit-int, turning them from warnings into hard errors. Much of the
92# in-tree C is old-style, so pin the C dialect to gnu89 (symmetric with the
93# gnu++98 C++ pin). gnu89 still permits later constructs as GNU extensions, so
94# it does not break modern C modules.
95CFLAGSCC=-pipe -fsigned-char -std=gnu89
96
97# Normal Objective C compilation flags
98#OBJCFLAGS=-no-precomp
99OBJCFLAGS=-fobjc-exceptions
100# -x options generally ignored by ccache, tell it that it can cache
101# the result nevertheless
102CCACHE_SKIP:=$(eq,$(USE_CCACHE),YES --ccache-skip $(NULL))
103OBJCXXFLAGS:=$(CCACHE_SKIP) -x $(CCACHE_SKIP) objective-c++ -fobjc-exceptions
104
105# Comp Flags for files that need exceptions enabled (C and C++)
106CFLAGSEXCEPTIONS=-fexceptions
107
108# Comp Flags for files that do not need exceptions enabled (C and C++)
109CFLAGS_NO_EXCEPTIONS=-fno-exceptions
110
111# Normal C++ compilation flags
112CFLAGSCXX=-pipe -fsigned-char
113
114CFLAGSCXX+= -Wno-ctor-dtor-privacy
115
116PICSWITCH:=-fPIC
117# Other flags
118CFLAGSOBJGUIMT=$(PICSWITCH) -fno-common
119CFLAGSOBJCUIMT=$(PICSWITCH) -fno-common
120CFLAGSSLOGUIMT=$(PICSWITCH) -fno-common
121CFLAGSSLOCUIMT=$(PICSWITCH) -fno-common
122CFLAGSPROF=
123
124# Flag for including debugging information in object files
125CFLAGSDEBUG=-g
126CFLAGSDBGUTIL=
127
128# Flag to specify output file to compiler/linker
129CFLAGSOUTOBJ=-o
130
131# Flags to enable precompiled headers
132CFLAGS_CREATE_PCH=-x c++-header -I$(INCPCH) -DPRECOMPILED_HEADERS
133CFLAGS_USE_PCH=-I$(SLO)/pch -DPRECOMPILED_HEADERS -Winvalid-pch
134CFLAGS_USE_EXCEPTIONS_PCH=-I$(SLO)/pch_ex -DPRECOMPILED_HEADERS -Winvalid-pch
135
136# ---------------------------------
137#  Optimization flags
138# ---------------------------------
139CFLAGSOPT=-O2 -fno-strict-aliasing
140CFLAGSNOOPT=-O0
141
142# -Wshadow does not work for C with nested uses of pthread_cleanup_push:
143# -Wshadow does not work for C++ as /usr/include/c++/4.0.0/ext/hashtable.h
144# l. 717 contains a declaration of __cur2 shadowing the declaration at l. 705,
145# in template code for which a #pragma gcc system_header would not work:
146CFLAGSWARNCC=-Wall -Wendif-labels
147CFLAGSWARNCXX=$(CFLAGSWARNCC) -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor
148CFLAGSWALLCC=$(CFLAGSWARNCC)
149CFLAGSWALLCXX=$(CFLAGSWARNCXX)
150CFLAGSWERRCC=-Werror -Wno-error=deprecated
151
152# All modules on this platform compile without warnings.
153# If you need to set MODULES_WITH_WARNINGS here, comment
154# COMPILER_WARN_ERRORS=TRUE here (see settings.mk):
155COMPILER_WARN_ERRORS=TRUE
156
157#special settings from environment
158CDEFS+=$(EXTRA_CDEFS)
159
160# ---------------------------------
161#  STL library names
162# ---------------------------------
163
164CDEFS+=-DHAVE_STL_INCLUDE_PATH -I../v1/
165STDLIBCPP=-lc++
166
167# ---------------------------------
168#  Link stage flags
169# ---------------------------------
170
171LINK*=$(CXX)
172LINKC*=$(CC)
173
174###LINKFLAGSDEFS*=-Wl,-multiply_defined,suppress
175EXTRA_LINKFLAGS*=-L$(MACOSX_SDK_PATH) -Wl,-headerpad_max_install_names
176LINKFLAGSRUNPATH_URELIB=-install_name '@_______URELIB/$(@:f)'
177LINKFLAGSRUNPATH_UREBIN=
178LINKFLAGSRUNPATH_OOO=-install_name '@_______OOO/$(@:f)'
179LINKFLAGSRUNPATH_SDK=
180LINKFLAGSRUNPATH_BRAND=
181LINKFLAGSRUNPATH_OXT=
182LINKFLAGSRUNPATH_BOXT=
183LINKFLAGSRUNPATH_NONE=-install_name '@_______NONE/$(@:f)'
184LINKFLAGS=$(LINKFLAGSDEFS)
185
186LINKFLAGS+=-lobjc
187LINKFLAGS+=-lc++
188
189#special settings form environment
190LINKFLAGS+=$(EXTRA_LINKFLAGS)
191
192# Random link flags dealing with different cases of linking
193
194LINKFLAGSAPPGUI=-bind_at_load
195LINKFLAGSSHLGUI=-dynamiclib -single_module
196LINKFLAGSAPPCUI=-bind_at_load
197LINKFLAGSSHLCUI=-dynamiclib -single_module
198LINKFLAGSTACK=
199LINKFLAGSPROF=
200
201# Flag to add debugging information to final products
202LINKFLAGSDEBUG=-g
203LINKFLAGSOPT=
204
205# ---------------------------------
206#  MacOS X shared library specifics
207# ---------------------------------
208
209# Tag to identify an output file as a library
210DLLPRE=lib
211# File extension to identify dynamic shared libraries on MacOS X
212DLLPOST=.dylib
213# Precompiled header file extension
214PCHPOST=.gch
215
216#LINKVERSIONMAPFLAG=-Xlinker -map -Xlinker
217LINKVERSIONMAPFLAG=-Wl,-map -Wl,
218
219SONAME_SWITCH=-Wl,-h
220
221
222STDOBJVCL=$(L)/salmain.o
223STDOBJGUI=
224STDSLOGUI=
225STDOBJCUI=
226STDSLOCUI=
227
228#STDLIBCUIMT=CPPRUNTIME -lm
229#STDLIBGUIMT=-framework Carbon -framework Cocoa -lpthread CPPRUNTIME -lm
230STDSHLCUIMT=-lpthread CPPRUNTIME -lm
231STDSHLGUIMT=-framework Carbon -framework CoreFoundation -framework Cocoa -lpthread CPPRUNTIME -lm
232
233LIBMGR=ar
234LIBFLAGS=-r
235
236IMPLIB=
237IMPLIBFLAGS=
238
239MAPSYM=
240MAPSYMFLAGS=
241
242RC=irc
243RCFLAGS=-fo$@ $(RCFILES)
244RCLINK=
245RCLINKFLAGS=
246RCSETVERSION=
247
248OOO_LIBRARY_PATH_VAR = DYLD_LIBRARY_PATH
249