xref: /trunk/main/solenv/inc/unxmacc.mk (revision 8c537dee592d6af715b13414815e3c9b980ab315)
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# Do NOT force MAC_OS_X_VERSION_MAX_ALLOWED.  Apple renamed the constants at
40# macOS 11: the old MAC_OS_X_VERSION_<v> family stops at 10_15, and 11+ uses
41# MAC_OS_VERSION_<v> (no "_X_").  The old code emitted
42# -DMAC_OS_X_VERSION_MAX_ALLOWED=MAC_OS_X_VERSION_$(target), which for an 11.0+
43# deployment target references an undefined macro (expands to 0) and trips
44# AvailabilityMacros.h's "MAC_OS_X_VERSION_MAX_ALLOWED must be >=
45# MAC_OS_X_VERSION_MIN_REQUIRED" #error.  Leaving it unset lets the SDK derive
46# the correct value, max(14.0, MIN_REQUIRED).  Nothing in the tree reads this
47# macro (the lone consumer, vcl PictToBmpFlt.cxx, checks the distinct
48# __MAC_OS_X_VERSION_MAX_ALLOWED), so dropping the -D is safe on old SDKs too.
49
50CDEFS+=-DQUARTZ
51EXTRA_CDEFS*=-isysroot $(MACOSX_SDK_PATH)
52
53# Name of library where static data members are initialized
54# STATICLIBNAME=static$(DLLPOSTFIX)
55# STATICLIB=-l$(STATICLIBNAME)
56
57# enable visibility define in "sal/types.h"
58.IF "$(HAVE_GCC_VISIBILITY_FEATURE)" == "TRUE"
59    CDEFS += -DHAVE_GCC_VISIBILITY_FEATURE
60.ENDIF
61
62# MacOS X specific Java compilation/link flags
63SOLAR_JAVA*=TRUE
64.IF "$(SOLAR_JAVA)"!=""
65    JAVADEF=-DSOLAR_JAVA
66    JAVAFLAGSDEBUG=-g
67    JAVA_RUNTIME=-framework JavaVM
68.ENDIF
69
70# architecture dependent flags for the C and C++ compiler that can be changed by
71# exporting the variable ARCH_FLAGS="..." in the shell, which is used to start build
72ARCH_FLAGS*=
73
74# Specify the compiler to use.  NOTE:  MacOS X should always specify
75# c++ for C++ compilation as it does certain C++ specific things
76# behind the scenes for us.
77# CC = C++ compiler to use
78# cc = C compiler to use
79# objc = Objective C compiler to use
80# objcpp = Objective C++ compiler to use
81CXX*=clang++
82CC*=clang
83objc*=$(CC)
84objcpp*=$(CXX)
85
86EXTRA_CFLAGS=
87
88CFLAGS=-fsigned-char -fmessage-length=0 -c $(EXTRA_CFLAGS)
89
90.IF "$(DISABLE_DEPRECATION_WARNING)" == "TRUE"
91CFLAGS+=-Wno-deprecated-declarations
92.ENDIF
93# ---------------------------------
94#  Compilation flags
95# ---------------------------------
96# Normal C compilation flags
97# Clang 16+ (Xcode 15+) removed support for K&R-style function definitions and
98# implicit-int, turning them from warnings into hard errors. Much of the
99# in-tree C is old-style, so pin the C dialect to gnu89 (symmetric with the
100# gnu++98 C++ pin). gnu89 still permits later constructs as GNU extensions, so
101# it does not break modern C modules.
102CFLAGSCC=-pipe -fsigned-char -std=gnu89
103
104# Normal Objective C compilation flags
105#OBJCFLAGS=-no-precomp
106OBJCFLAGS=-fobjc-exceptions
107# -x options generally ignored by ccache, tell it that it can cache
108# the result nevertheless
109CCACHE_SKIP:=$(eq,$(USE_CCACHE),YES --ccache-skip $(NULL))
110OBJCXXFLAGS:=$(CCACHE_SKIP) -x $(CCACHE_SKIP) objective-c++ -fobjc-exceptions
111
112# Comp Flags for files that need exceptions enabled (C and C++)
113CFLAGSEXCEPTIONS=-fexceptions
114
115# Comp Flags for files that do not need exceptions enabled (C and C++)
116CFLAGS_NO_EXCEPTIONS=-fno-exceptions
117
118# Normal C++ compilation flags
119CFLAGSCXX=-pipe -fsigned-char
120
121CFLAGSCXX+= -Wno-ctor-dtor-privacy
122
123PICSWITCH:=-fPIC
124# Other flags
125CFLAGSOBJGUIMT=$(PICSWITCH) -fno-common
126CFLAGSOBJCUIMT=$(PICSWITCH) -fno-common
127CFLAGSSLOGUIMT=$(PICSWITCH) -fno-common
128CFLAGSSLOCUIMT=$(PICSWITCH) -fno-common
129CFLAGSPROF=
130
131# Flag for including debugging information in object files
132CFLAGSDEBUG=-g
133CFLAGSDBGUTIL=
134
135# Flag to specify output file to compiler/linker
136CFLAGSOUTOBJ=-o
137
138# Flags to enable precompiled headers
139CFLAGS_CREATE_PCH=-x c++-header -I$(INCPCH) -DPRECOMPILED_HEADERS
140CFLAGS_USE_PCH=-I$(SLO)/pch -DPRECOMPILED_HEADERS -Winvalid-pch
141CFLAGS_USE_EXCEPTIONS_PCH=-I$(SLO)/pch_ex -DPRECOMPILED_HEADERS -Winvalid-pch
142
143# ---------------------------------
144#  Optimization flags
145# ---------------------------------
146CFLAGSOPT=-O2 -fno-strict-aliasing
147CFLAGSNOOPT=-O0
148
149# -Wshadow does not work for C with nested uses of pthread_cleanup_push:
150# -Wshadow does not work for C++ as /usr/include/c++/4.0.0/ext/hashtable.h
151# l. 717 contains a declaration of __cur2 shadowing the declaration at l. 705,
152# in template code for which a #pragma gcc system_header would not work:
153CFLAGSWARNCC=-Wall -Wendif-labels
154CFLAGSWARNCXX=$(CFLAGSWARNCC) -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor
155CFLAGSWALLCC=$(CFLAGSWARNCC)
156CFLAGSWALLCXX=$(CFLAGSWARNCXX)
157CFLAGSWERRCC=-Werror -Wno-error=deprecated
158
159# All modules on this platform compile without warnings.
160# If you need to set MODULES_WITH_WARNINGS here, comment
161# COMPILER_WARN_ERRORS=TRUE here (see settings.mk):
162COMPILER_WARN_ERRORS=TRUE
163
164#special settings from environment
165CDEFS+=$(EXTRA_CDEFS)
166
167# ---------------------------------
168#  STL library names
169# ---------------------------------
170
171CDEFS+=-DHAVE_STL_INCLUDE_PATH -I../v1/
172STDLIBCPP=-lc++
173
174# ---------------------------------
175#  Link stage flags
176# ---------------------------------
177
178LINK*=$(CXX)
179LINKC*=$(CC)
180
181###LINKFLAGSDEFS*=-Wl,-multiply_defined,suppress
182EXTRA_LINKFLAGS*=-L$(MACOSX_SDK_PATH) -Wl,-headerpad_max_install_names
183LINKFLAGSRUNPATH_URELIB=-install_name '@_______URELIB/$(@:f)'
184LINKFLAGSRUNPATH_UREBIN=
185LINKFLAGSRUNPATH_OOO=-install_name '@_______OOO/$(@:f)'
186LINKFLAGSRUNPATH_SDK=
187LINKFLAGSRUNPATH_BRAND=
188LINKFLAGSRUNPATH_OXT=
189LINKFLAGSRUNPATH_BOXT=
190LINKFLAGSRUNPATH_NONE=-install_name '@_______NONE/$(@:f)'
191LINKFLAGS=$(LINKFLAGSDEFS)
192
193LINKFLAGS+=-lobjc
194LINKFLAGS+=-lc++
195
196#special settings form environment
197LINKFLAGS+=$(EXTRA_LINKFLAGS)
198
199# Random link flags dealing with different cases of linking
200
201LINKFLAGSAPPGUI=-bind_at_load
202LINKFLAGSSHLGUI=-dynamiclib -single_module
203LINKFLAGSAPPCUI=-bind_at_load
204LINKFLAGSSHLCUI=-dynamiclib -single_module
205LINKFLAGSTACK=
206LINKFLAGSPROF=
207
208# Flag to add debugging information to final products
209LINKFLAGSDEBUG=-g
210LINKFLAGSOPT=
211
212# ---------------------------------
213#  MacOS X shared library specifics
214# ---------------------------------
215
216# Tag to identify an output file as a library
217DLLPRE=lib
218# File extension to identify dynamic shared libraries on MacOS X
219DLLPOST=.dylib
220# Precompiled header file extension
221PCHPOST=.gch
222
223#LINKVERSIONMAPFLAG=-Xlinker -map -Xlinker
224LINKVERSIONMAPFLAG=-Wl,-map -Wl,
225
226SONAME_SWITCH=-Wl,-h
227
228
229STDOBJVCL=$(L)/salmain.o
230STDOBJGUI=
231STDSLOGUI=
232STDOBJCUI=
233STDSLOCUI=
234
235#STDLIBCUIMT=CPPRUNTIME -lm
236#STDLIBGUIMT=-framework Carbon -framework Cocoa -lpthread CPPRUNTIME -lm
237STDSHLCUIMT=-lpthread CPPRUNTIME -lm
238STDSHLGUIMT=-framework Carbon -framework CoreFoundation -framework Cocoa -lpthread CPPRUNTIME -lm
239
240LIBMGR=ar
241LIBFLAGS=-r
242
243IMPLIB=
244IMPLIBFLAGS=
245
246MAPSYM=
247MAPSYMFLAGS=
248
249RC=irc
250RCFLAGS=-fo$@ $(RCFILES)
251RCLINK=
252RCLINKFLAGS=
253RCSETVERSION=
254
255OOO_LIBRARY_PATH_VAR = DYLD_LIBRARY_PATH
256