1 # |
|
2 # Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. |
|
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 # |
|
5 # This code is free software; you can redistribute it and/or modify it |
|
6 # under the terms of the GNU General Public License version 2 only, as |
|
7 # published by the Free Software Foundation. Oracle designates this |
|
8 # particular file as subject to the "Classpath" exception as provided |
|
9 # by Oracle in the LICENSE file that accompanied this code. |
|
10 # |
|
11 # This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 # version 2 for more details (a copy is included in the LICENSE file that |
|
15 # accompanied this code). |
|
16 # |
|
17 # You should have received a copy of the GNU General Public License version |
|
18 # 2 along with this work; if not, write to the Free Software Foundation, |
|
19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 # |
|
21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 # or visit www.oracle.com if you need additional information or have any |
|
23 # questions. |
|
24 # |
|
25 |
|
26 # |
|
27 # Makefile to specify compiler flags for programs and libraries |
|
28 # targeted to MACOSX. Should not contain any rules. |
|
29 # |
|
30 # WARNING: This file is shared with other workspaces. |
|
31 # So when it includes other files, it must use JDK_TOPDIR. |
|
32 # |
|
33 |
|
34 # Warning: the following variables are overriden by Defs.gmk. Set |
|
35 # values will be silently ignored: |
|
36 # CFLAGS (set $(OTHER_CFLAGS) instead) |
|
37 # CPPFLAGS (set $(OTHER_CPPFLAGS) instead) |
|
38 # CXXFLAGS (set $(OTHER_CXXFLAGS) instead) |
|
39 # LDFLAGS (set $(OTHER_LDFAGS) instead) |
|
40 # LDLIBS (set $(EXTRA_LIBS) instead) |
|
41 # LDLIBS_COMMON (set $(EXTRA_LIBS) instead) |
|
42 |
|
43 # Get shared JDK settings |
|
44 include $(JDK_MAKE_SHARED_DIR)/Defs.gmk |
|
45 |
|
46 # Part of INCREMENTAL_BUILD mechanism. |
|
47 # Compiler emits things like: path/file.o: file.h |
|
48 # We want something like: relative_path/file.o relative_path/file.d: file.h |
|
49 CC_DEPEND = -MM |
|
50 CC_DEPEND_FILTER = $(SED) -e 's!$*\.$(OBJECT_SUFFIX)!$(dir $@)& $(dir $@)$*.$(DEPEND_SUFFIX)!g' |
|
51 |
|
52 ifndef PLATFORM_SRC |
|
53 PLATFORM_SRC = $(BUILDDIR)/../src/solaris |
|
54 endif # PLATFORM_SRC |
|
55 |
|
56 PLATFORM_SRC_MACOS = $(BUILDDIR)/../src/macosx |
|
57 |
|
58 # BSD build pulls its platform sources from the solaris tree. |
|
59 JAVA_SRCDIR_LIST = src/$(PLATFORM) src/solaris src/share |
|
60 NATIVE_SRCDIR_LIST = src/$(PLATFORM) src/solaris src/share |
|
61 |
|
62 # Platform specific closed sources |
|
63 ifndef OPENJDK |
|
64 ifndef CLOSED_PLATFORM_SRC |
|
65 CLOSED_PLATFORM_SRC = $(BUILDDIR)/../src/closed/solaris |
|
66 endif |
|
67 endif |
|
68 |
|
69 # platform specific include files |
|
70 PLATFORM_INCLUDE_NAME = $(OS_NAME) |
|
71 PLATFORM_INCLUDE = $(INCLUDEDIR)/$(PLATFORM_INCLUDE_NAME) |
|
72 |
|
73 # suffix used for make dependencies files. |
|
74 DEPEND_SUFFIX = d |
|
75 # The suffix applied to the library name for FDLIBM |
|
76 FDDLIBM_SUFFIX = a |
|
77 # The suffix applied to scripts (.bat for windows, nothing for unix) |
|
78 SCRIPT_SUFFIX = |
|
79 # CC compiler object code output directive flag value |
|
80 CC_OBJECT_OUTPUT_FLAG = -o #trailing blank required! |
|
81 CC_PROGRAM_OUTPUT_FLAG = -o #trailing blank required! |
|
82 |
|
83 # |
|
84 # Default optimization |
|
85 # |
|
86 |
|
87 ifndef OPTIMIZATION_LEVEL |
|
88 ifeq ($(PRODUCT), java) |
|
89 OPTIMIZATION_LEVEL = HIGHER |
|
90 else |
|
91 OPTIMIZATION_LEVEL = LOWER |
|
92 endif |
|
93 endif |
|
94 ifndef FASTDEBUG_OPTIMIZATION_LEVEL |
|
95 FASTDEBUG_OPTIMIZATION_LEVEL = LOWER |
|
96 endif |
|
97 |
|
98 # For macosx use -Os by default, unless -O3 can be proved to be worth the cost, as per policy |
|
99 # <http://wikis.sun.com/display/OpenJDK/Mac+OS+X+Port+Compilers> |
|
100 CC_OPT/NONE = |
|
101 CC_OPT/LOWER = -Os |
|
102 CC_OPT/HIGHER = -Os |
|
103 CC_OPT/HIGHEST = -Os |
|
104 |
|
105 CC_OPT = $(CC_OPT/$(OPTIMIZATION_LEVEL)) |
|
106 |
|
107 # For all platforms, do not omit the frame pointer register usage. |
|
108 # We need this frame pointer to make it easy to walk the stacks. |
|
109 # This should be the default on X86, but ia64, and x86_64 |
|
110 # may not have this as the default. |
|
111 CFLAGS_REQUIRED_x86_64 += -m64 -fno-omit-frame-pointer -D_LITTLE_ENDIAN |
|
112 LDFLAGS_COMMON_x86_64 += -m64 |
|
113 CFLAGS_REQUIRED_i586 += -m32 -fno-omit-frame-pointer -D_LITTLE_ENDIAN |
|
114 LDFLAGS_COMMON_i586 += -m32 |
|
115 CFLAGS_REQUIRED_ia64 += -m64 -fno-omit-frame-pointer -D_LITTLE_ENDIAN |
|
116 CFLAGS_REQUIRED_sparcv9 += -m64 -mcpu=v9 |
|
117 LDFLAGS_COMMON_sparcv9 += -m64 -mcpu=v9 |
|
118 CFLAGS_REQUIRED_sparc += -m32 -mcpu=v9 |
|
119 LDFLAGS_COMMON_sparc += -m32 -mcpu=v9 |
|
120 CFLAGS_REQUIRED_arm += -fsigned-char -D_LITTLE_ENDIAN |
|
121 CFLAGS_REQUIRED_ppc += -fsigned-char -D_BIG_ENDIAN |
|
122 ifeq ($(ZERO_BUILD), true) |
|
123 CFLAGS_REQUIRED = $(ZERO_ARCHFLAG) |
|
124 ifeq ($(ZERO_ENDIANNESS), little) |
|
125 CFLAGS_REQUIRED += -D_LITTLE_ENDIAN |
|
126 endif |
|
127 LDFLAGS_COMMON += $(ZERO_ARCHFLAG) |
|
128 else ifeq ($(ARCH), universal) |
|
129 CFLAGS_REQUIRED += -arch i386 -arch x86_64 -D_LITTLE_ENDIAN |
|
130 LDFLAGS_COMMON += -arch i386 -arch x86_64 |
|
131 else |
|
132 CFLAGS_REQUIRED = $(CFLAGS_REQUIRED_$(ARCH)) |
|
133 LDFLAGS_COMMON += $(LDFLAGS_COMMON_$(ARCH)) |
|
134 endif |
|
135 # 16-byte stack re-alignment on 32-bit Darwin |
|
136 CFLAGS_REQUIRED_i586 += -mstackrealign |
|
137 |
|
138 OTHER_CFLAGS = \ |
|
139 -F/System/Library/Frameworks/JavaVM.framework/Frameworks \ |
|
140 -F/System/Library/Frameworks/ApplicationServices.framework/Frameworks |
|
141 |
|
142 # |
|
143 # Selection of warning messages |
|
144 # |
|
145 GCC_INHIBIT = -Wno-unused -Wno-parentheses |
|
146 GCC_STYLE = |
|
147 GCC_WARNINGS = -W -Wall $(GCC_STYLE) $(GCC_INHIBIT) |
|
148 |
|
149 # |
|
150 # Treat compiler warnings as errors, if warnings not allowed |
|
151 # |
|
152 ifeq ($(COMPILER_WARNINGS_FATAL),true) |
|
153 GCC_WARNINGS += -Werror |
|
154 endif |
|
155 |
|
156 # |
|
157 # Misc compiler options |
|
158 # |
|
159 ifneq ($(ARCH),ppc) |
|
160 CFLAGS_COMMON = -fno-strict-aliasing |
|
161 endif |
|
162 PIC_CODE_LARGE = -fPIC |
|
163 PIC_CODE_SMALL = -fpic |
|
164 GLOBAL_KPIC = $(PIC_CODE_LARGE) |
|
165 CFLAGS_COMMON += $(GLOBAL_KPIC) $(GCC_WARNINGS) |
|
166 ifeq ($(ARCH), x86_64) |
|
167 CFLAGS_COMMON += -pipe |
|
168 endif |
|
169 |
|
170 # BSD 64bit machines use Dwarf2, which can be HUGE, have fastdebug use -g1 |
|
171 DEBUG_FLAG = -g |
|
172 ifeq ($(FASTDEBUG), true) |
|
173 ifeq ($(ARCH_DATA_MODEL), 64) |
|
174 DEBUG_FLAG = -g1 |
|
175 endif |
|
176 endif |
|
177 |
|
178 # DEBUG_BINARIES overrides everything, use full -g debug information |
|
179 ifeq ($(DEBUG_BINARIES), true) |
|
180 DEBUG_FLAG = -g |
|
181 CFLAGS_REQUIRED += $(DEBUG_FLAG) |
|
182 endif |
|
183 |
|
184 CFLAGS_OPT = $(CC_OPT) |
|
185 CFLAGS_DBG = $(DEBUG_FLAG) |
|
186 CFLAGS_COMMON += $(CFLAGS_REQUIRED) |
|
187 |
|
188 CXXFLAGS_COMMON = $(GLOBAL_KPIC) -DCC_NOEX $(GCC_WARNINGS) |
|
189 CXXFLAGS_OPT = $(CC_OPT) |
|
190 CXXFLAGS_DBG = $(DEBUG_FLAG) |
|
191 CXXFLAGS_COMMON += $(CFLAGS_REQUIRED) |
|
192 |
|
193 # FASTDEBUG: Optimize the code in the -g versions, gives us a faster debug java |
|
194 ifeq ($(FASTDEBUG), true) |
|
195 CFLAGS_DBG += $(CC_OPT/$(FASTDEBUG_OPTIMIZATION_LEVEL)) |
|
196 CXXFLAGS_DBG += $(CC_OPT/$(FASTDEBUG_OPTIMIZATION_LEVEL)) |
|
197 endif |
|
198 |
|
199 CPP_ARCH_FLAGS = -DARCH='"$(ARCH)"' |
|
200 |
|
201 # Alpha arch does not like "alpha" defined (potential general arch cleanup issue here) |
|
202 ifneq ($(ARCH),alpha) |
|
203 CPP_ARCH_FLAGS += -D$(ARCH) |
|
204 else |
|
205 CPP_ARCH_FLAGS += -D_$(ARCH)_ |
|
206 endif |
|
207 CPPFLAGS_COMMON = $(CPP_ARCH_FLAGS) -D_ALLBSD_SOURCE $(VERSION_DEFINES) \ |
|
208 -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -D_REENTRANT |
|
209 |
|
210 CPPFLAGS_COMMON += -DMACOSX |
|
211 |
|
212 ifeq ($(ARCH_DATA_MODEL), 64) |
|
213 CPPFLAGS_COMMON += -D_LP64=1 |
|
214 endif |
|
215 |
|
216 CPPFLAGS_OPT = -DNDEBUG |
|
217 CPPFLAGS_DBG = -DDEBUG |
|
218 ifneq ($(PRODUCT), java) |
|
219 CPPFLAGS_DBG += -DLOGGING |
|
220 endif |
|
221 |
|
222 # Libraries need to locate other libraries at runtime, and you can tell |
|
223 # a library where to look by way of the dynamic runpaths (RPATH or RUNPATH) |
|
224 # buried inside the .{so,dylib}. The {$ORIGIN,@loader_path/} says to look |
|
225 # relative to where the library itself is and it can be followed |
|
226 # with relative paths from that. By default we always look in |
|
227 # {$ORIGIN,@loader_path/}, optionally we add relative paths if the Makefile |
|
228 # sets LD_RUNPATH_EXTRAS to those relative paths. |
|
229 # Except on MacOS X we add a flag -z origin, not sure if this is necessary, |
|
230 # but doesn't seem to hurt. |
|
231 # The environment variable LD_LIBRARY_PATH will over-ride these runpaths. |
|
232 # See 'man {dyld,rtld}' for more information. |
|
233 # Try: 'readelf -d lib*.so' to see these settings in a library. |
|
234 # |
|
235 LDFLAGS_COMMON += -Xlinker -rpath -Xlinker @loader_path/. |
|
236 LDFLAGS_COMMON += $(LD_RUNPATH_EXTRAS:%=-Xlinker -rpath -Xlinker @loader_path/%) |
|
237 LDFLAGS_COMMON += -Xlinker -install_name -Xlinker @rpath/$(@F) |
|
238 |
|
239 # |
|
240 # -L paths for finding and -ljava |
|
241 # |
|
242 LDFLAGS_COMMON += -L$(LIBDIR) |
|
243 |
|
244 # |
|
245 # -static-libgcc is a gcc-3 flag to statically link libgcc, gcc-2.9x always |
|
246 # statically link libgcc but will print a warning with the flag. We don't |
|
247 # want the warning, so check gcc version first. |
|
248 # |
|
249 ifeq ($(CC_MAJORVER),3) |
|
250 OTHER_LDFLAGS += -static-libgcc |
|
251 endif |
|
252 |
|
253 # Automatic precompiled header option to use (if COMPILE_APPROACH=batch) |
|
254 # (See Rules.gmk) The gcc 5 compiler might have an option for this? |
|
255 AUTOMATIC_PCH_OPTION = |
|
256 |
|
257 # |
|
258 # Post Processing of libraries/executables |
|
259 # |
|
260 ifeq ($(VARIANT), OPT) |
|
261 ifneq ($(NO_STRIP), true) |
|
262 ifneq ($(DEBUG_BINARIES), true) |
|
263 # Debug 'strip -S' leaves local function Elf symbols (better stack |
|
264 # traces) |
|
265 POST_STRIP_PROCESS = $(STRIP) -S |
|
266 endif |
|
267 endif |
|
268 endif |
|
269 |
|
270 # |
|
271 # Use: ld $(LD_MAPFILE_FLAG) mapfile *.o |
|
272 # |
|
273 LD_MAPFILE_FLAG = -Xlinker --version-script -Xlinker |
|
274 |
|
275 # |
|
276 # Support for Quantify. |
|
277 # |
|
278 ifdef QUANTIFY |
|
279 QUANTIFY_CMD = quantify |
|
280 QUANTIFY_OPTIONS = -cache-dir=/tmp/quantify -always-use-cache-dir=yes |
|
281 LINK_PRE_CMD = $(QUANTIFY_CMD) $(QUANTIFY_OPTIONS) |
|
282 endif |
|
283 |
|
284 # Darwin does not support linker map files. |
|
285 LDNOMAP=true |
|
286 |
|
287 # |
|
288 # Path and option to link against the VM, if you have to. Note that |
|
289 # there are libraries that link against only -ljava, but they do get |
|
290 # -L to the -ljvm, this is because -ljava depends on -ljvm, whereas |
|
291 # the library itself should not. |
|
292 # |
|
293 VM_NAME = server |
|
294 JVMLIB = -L$(LIBDIR)/server -L$(LIBDIR)/client -ljvm |
|
295 JAVALIB = -ljava $(JVMLIB) |
|
296 |
|
297 # |
|
298 # We want to privatize JVM symbols on Solaris. This is so the user can |
|
299 # write a function called FindClass and this should not override the |
|
300 # FindClass that is inside the JVM. At this point in time we are not |
|
301 # concerned with other JNI libraries because we hope that there will |
|
302 # not be as many clashes there. |
|
303 # |
|
304 PRIVATIZE_JVM_SYMBOLS = false |
|
305 |
|
306 USE_PTHREADS = true |
|
307 override ALT_CODESET_KEY = _NL_CTYPE_CODESET_NAME |
|
308 override AWT_RUNPATH = |
|
309 override HAVE_ALTZONE = false |
|
310 override HAVE_FILIOH = false |
|
311 override HAVE_GETHRTIME = false |
|
312 override HAVE_GETHRVTIME = false |
|
313 override HAVE_SIGIGNORE = true |
|
314 override LEX_LIBRARY = -lfl |
|
315 ifeq ($(STATIC_CXX),true) |
|
316 override LIBCXX = -Wl,-Bstatic -lstdc++ -lgcc -Wl,-Bdynamic |
|
317 else |
|
318 override LIBCXX = -lstdc++ |
|
319 endif |
|
320 override LIBPOSIX4 = |
|
321 override LIBSOCKET = |
|
322 override LIBNSL = |
|
323 override LIBTHREAD = |
|
324 override LIBDL = |
|
325 override MOOT_PRIORITIES = true |
|
326 override NO_INTERRUPTIBLE_IO = true |
|
327 override OPENWIN_HOME = $(X11_PATH) |
|
328 override OPENWIN_LIB = $(OPENWIN_HOME)/lib |
|
329 override OTHER_M4FLAGS = -D__GLIBC__ -DGNU_ASSEMBLER |
|
330 override SUN_CMM_SUBDIR = |
|
331 override THREADS_FLAG = native |
|
332 override USE_GNU_M4 = true |
|
333 override USING_GNU_TAR = true |
|
334 override WRITE_LIBVERSION = false |
|
335 |
|
336 ifdef ALT_X11_PATH |
|
337 X11_PATH = $(ALT_X11_PATH) |
|
338 else |
|
339 X11_PATH = /usr/X11R6 |
|
340 endif |
|
341 |
|
342 ifdef ALT_PACKAGE_PATH |
|
343 PACKAGE_PATH = $(ALT_PACKAGE_PATH) |
|
344 else |
|
345 PACKAGE_PATH = /opt/local |
|
346 endif |
|
347 |
|
348 # ALSA |
|
349 ifdef ALT_ALSA_LIB_PATH |
|
350 ALSA_LIB_PATH = $(ALT_ALSA_LIB_PATH) |
|
351 else |
|
352 ALSA_LIB_PATH = $(PACKAGE_PATH)/lib |
|
353 endif |
|
354 |
|
355 ifdef ALT_ALSA_HEADERS_PATH |
|
356 ALSA_HEADERS_PATH = $(ALT_ALSA_HEADERS_PATH) |
|
357 else |
|
358 ALSA_HEADERS_PATH = $(PACKAGE_PATH)/include |
|
359 endif |
|
360 |
|
361 # USE_EXECNAME forces the launcher to look up argv[0] on $PATH, and put the |
|
362 # resulting resolved absolute name of the executable in the environment |
|
363 # variable EXECNAME. That executable name is then used that to locate the |
|
364 # installation area. |
|
365 override USE_EXECNAME = true |
|
366 |
|
367 # If your platform has DPS, it will have Type1 fonts too, in which case |
|
368 # it is best to enable DPS support until such time as 2D's rasteriser |
|
369 # can fully handle Type1 fonts in all cases. Default is "yes". |
|
370 # HAVE_DPS should only be "no" if the platform has no DPS headers or libs |
|
371 # DPS (Displayable PostScript) is available on Solaris machines |
|
372 HAVE_DPS = no |
|
373 |
|
374 SYSTEM_ZLIB = true |
|
375 |
|
376 # |
|
377 # Japanese manpages |
|
378 # |
|
379 JA_SOURCE_ENCODING = eucJP |
|
380 JA_TARGET_ENCODINGS = UTF-8 |
|
381 |
|
382 # Settings for the JDI - Serviceability Agent binding. |
|
383 |
|
384 HOTSPOT_SALIB_PATH = $(HOTSPOT_IMPORT_PATH)/jre/lib/$(LIBARCH) |
|
385 SALIB_NAME = $(LIB_PREFIX)saproc.$(LIBRARY_SUFFIX) |
|
386 |
|
387 # The JDI - Serviceability Agent binding is not currently supported |
|
388 # on ia64. |
|
389 ifeq ($(ARCH), ia64) |
|
390 INCLUDE_SA = false |
|
391 else |
|
392 INCLUDE_SA = true |
|
393 endif |
|
394 |
|
395 ifdef CROSS_COMPILE_ARCH |
|
396 # X11 headers are not under /usr/include |
|
397 OTHER_CFLAGS += -I$(OPENWIN_HOME)/include |
|
398 OTHER_CXXFLAGS += -I$(OPENWIN_HOME)/include |
|
399 OTHER_CPPFLAGS += -I$(OPENWIN_HOME)/include |
|
400 endif |
|
401 |
|
402 LIB_LOCATION ?= $(LIBDIR) |
|