1 | #
|
---|
2 | # Copyright (c) 1999, 2010, 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 Linux. 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 specific closed sources
|
---|
57 | ifndef OPENJDK
|
---|
58 | ifndef CLOSED_PLATFORM_SRC
|
---|
59 | CLOSED_PLATFORM_SRC = $(BUILDDIR)/../src/closed/solaris
|
---|
60 | endif
|
---|
61 | endif
|
---|
62 |
|
---|
63 | # platform specific include files
|
---|
64 | PLATFORM_INCLUDE_NAME = $(PLATFORM)
|
---|
65 | PLATFORM_INCLUDE = $(INCLUDEDIR)/$(PLATFORM_INCLUDE_NAME)
|
---|
66 |
|
---|
67 | # suffix used for make dependencies files.
|
---|
68 | DEPEND_SUFFIX = d
|
---|
69 | # The suffix applied to the library name for FDLIBM
|
---|
70 | FDDLIBM_SUFFIX = a
|
---|
71 | # The suffix applied to scripts (.bat for windows, nothing for unix)
|
---|
72 | SCRIPT_SUFFIX =
|
---|
73 | # CC compiler object code output directive flag value
|
---|
74 | CC_OBJECT_OUTPUT_FLAG = -o #trailing blank required!
|
---|
75 | CC_PROGRAM_OUTPUT_FLAG = -o #trailing blank required!
|
---|
76 |
|
---|
77 | #
|
---|
78 | # Default HPI libraries. Build will build only native, unless
|
---|
79 | # overriden at the make command line. This makes it convenient for
|
---|
80 | # people doing, say, a pthreads port -- they can create a posix
|
---|
81 | # directory here, and say "gnumake HPIS=posix" at the top
|
---|
82 | # level.
|
---|
83 | #
|
---|
84 | HPIS = native
|
---|
85 |
|
---|
86 | #
|
---|
87 | # Default optimization
|
---|
88 | #
|
---|
89 | CC_HIGHEST_OPT = -O3
|
---|
90 | CC_HIGHER_OPT = -O3
|
---|
91 | CC_LOWER_OPT = -O2
|
---|
92 | CC_NO_OPT =
|
---|
93 |
|
---|
94 | ifeq ($(PRODUCT), java)
|
---|
95 | _OPT = $(CC_HIGHER_OPT)
|
---|
96 | else
|
---|
97 | _OPT = $(CC_LOWER_OPT)
|
---|
98 | CPPFLAGS_DBG += -DLOGGING
|
---|
99 | endif
|
---|
100 |
|
---|
101 | # For all platforms, do not omit the frame pointer register usage.
|
---|
102 | # We need this frame pointer to make it easy to walk the stacks.
|
---|
103 | # This should be the default on X86, but ia64 and amd64 may not have this
|
---|
104 | # as the default.
|
---|
105 | CFLAGS_REQUIRED_amd64 += -fno-omit-frame-pointer -D_LITTLE_ENDIAN
|
---|
106 | CFLAGS_REQUIRED_i586 += -fno-omit-frame-pointer -D_LITTLE_ENDIAN
|
---|
107 | CFLAGS_REQUIRED_ia64 += -fno-omit-frame-pointer -D_LITTLE_ENDIAN
|
---|
108 | CFLAGS_REQUIRED_sparcv9 += -m64 -mcpu=v9
|
---|
109 | LDFLAGS_COMMON_sparcv9 += -m64 -mcpu=v9
|
---|
110 | CFLAGS_REQUIRED_sparc += -m32 -mcpu=v9
|
---|
111 | LDFLAGS_COMMON_sparc += -m32 -mcpu=v9
|
---|
112 | ifeq ($(ZERO_BUILD), true)
|
---|
113 | CFLAGS_REQUIRED = $(ZERO_ARCHFLAG)
|
---|
114 | ifeq ($(ZERO_ENDIANNESS), little)
|
---|
115 | CFLAGS_REQUIRED += -D_LITTLE_ENDIAN
|
---|
116 | endif
|
---|
117 | LDFLAGS_COMMON += $(ZERO_ARCHFLAG)
|
---|
118 | else
|
---|
119 | CFLAGS_REQUIRED = $(CFLAGS_REQUIRED_$(ARCH))
|
---|
120 | LDFLAGS_COMMON += $(LDFLAGS_COMMON_$(ARCH))
|
---|
121 | endif
|
---|
122 |
|
---|
123 | # Add in platform specific optimizations for all opt levels
|
---|
124 | CC_HIGHEST_OPT += $(_OPT_$(ARCH))
|
---|
125 | CC_HIGHER_OPT += $(_OPT_$(ARCH))
|
---|
126 | CC_LOWER_OPT += $(_OPT_$(ARCH))
|
---|
127 |
|
---|
128 | # If NO_OPTIMIZATIONS is defined in the environment, turn all optimzations off
|
---|
129 | ifdef NO_OPTIMIZATIONS
|
---|
130 | CC_HIGHEST_OPT = $(CC_NO_OPT)
|
---|
131 | CC_HIGHER_OPT = $(CC_NO_OPT)
|
---|
132 | CC_LOWER_OPT = $(CC_NO_OPT)
|
---|
133 | endif
|
---|
134 |
|
---|
135 | #
|
---|
136 | # Selection of warning messages
|
---|
137 | #
|
---|
138 | GCC_INHIBIT = -Wno-unused -Wno-parentheses
|
---|
139 | GCC_STYLE =
|
---|
140 | GCC_WARNINGS = -W -Wall $(GCC_STYLE) $(GCC_INHIBIT)
|
---|
141 |
|
---|
142 | #
|
---|
143 | # Treat compiler warnings as errors, if warnings not allowed
|
---|
144 | #
|
---|
145 | ifeq ($(COMPILER_WARNINGS_FATAL),true)
|
---|
146 | GCC_WARNINGS += -Werror
|
---|
147 | endif
|
---|
148 |
|
---|
149 | #
|
---|
150 | # Misc compiler options
|
---|
151 | #
|
---|
152 | ifeq ($(ARCH),ppc)
|
---|
153 | CFLAGS_COMMON = -fsigned-char
|
---|
154 | else # ARCH
|
---|
155 | CFLAGS_COMMON = -fno-strict-aliasing
|
---|
156 | endif # ARCH
|
---|
157 | PIC_CODE_LARGE = -fPIC
|
---|
158 | PIC_CODE_SMALL = -fpic
|
---|
159 | GLOBAL_KPIC = $(PIC_CODE_LARGE)
|
---|
160 | ifeq ($(ARCH), amd64)
|
---|
161 | CFLAGS_COMMON += $(GLOBAL_KPIC) $(GCC_WARNINGS) -pipe
|
---|
162 | else
|
---|
163 | CFLAGS_COMMON += $(GLOBAL_KPIC) $(GCC_WARNINGS)
|
---|
164 | endif
|
---|
165 |
|
---|
166 | # Linux 64bit machines use Dwarf2, which can be HUGE, have fastdebug use -g1
|
---|
167 | DEBUG_FLAG = -g
|
---|
168 | ifeq ($(FASTDEBUG), true)
|
---|
169 | ifeq ($(ARCH_DATA_MODEL), 64)
|
---|
170 | DEBUG_FLAG = -g1
|
---|
171 | endif
|
---|
172 | endif
|
---|
173 |
|
---|
174 | # DEBUG_BINARIES overrides everything
|
---|
175 | ifeq ($(DEBUG_BINARIES), true)
|
---|
176 | DEBUG_FLAG = -g
|
---|
177 | CFLAGS_REQUIRED += $(DEBUG_FLAG)
|
---|
178 | endif
|
---|
179 |
|
---|
180 | CFLAGS_OPT = $(POPT)
|
---|
181 | CFLAGS_DBG = $(DEBUG_FLAG)
|
---|
182 | CFLAGS_COMMON += $(CFLAGS_REQUIRED)
|
---|
183 |
|
---|
184 | CXXFLAGS_COMMON = $(GLOBAL_KPIC) -DCC_NOEX $(GCC_WARNINGS)
|
---|
185 | CXXFLAGS_OPT = $(POPT)
|
---|
186 | CXXFLAGS_DBG = $(DEBUG_FLAG)
|
---|
187 | CXXFLAGS_COMMON += $(CFLAGS_REQUIRED)
|
---|
188 |
|
---|
189 | # FASTDEBUG: Optimize the code in the -g versions, gives us a faster debug java
|
---|
190 | ifeq ($(FASTDEBUG), true)
|
---|
191 | CFLAGS_DBG += $(CC_LOWER_OPT)
|
---|
192 | CXXFLAGS_DBG += $(CC_LOWER_OPT)
|
---|
193 | endif
|
---|
194 |
|
---|
195 | CPP_ARCH_FLAGS = -DARCH='"$(ARCH)"'
|
---|
196 |
|
---|
197 | # Alpha arch does not like "alpha" defined (potential general arch cleanup issue here)
|
---|
198 | ifneq ($(ARCH),alpha)
|
---|
199 | CPP_ARCH_FLAGS += -D$(ARCH)
|
---|
200 | else
|
---|
201 | CPP_ARCH_FLAGS += -D_$(ARCH)_
|
---|
202 | endif
|
---|
203 |
|
---|
204 | CPPFLAGS_COMMON = $(CPP_ARCH_FLAGS) -DLINUX $(VERSION_DEFINES) \
|
---|
205 | -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -D_REENTRANT
|
---|
206 |
|
---|
207 | ifeq ($(ARCH_DATA_MODEL), 64)
|
---|
208 | CPPFLAGS_COMMON += -D_LP64=1
|
---|
209 | endif
|
---|
210 |
|
---|
211 | CPPFLAGS_OPT =
|
---|
212 | CPPFLAGS_DBG = -DDEBUG
|
---|
213 |
|
---|
214 | ifdef LIBRARY
|
---|
215 | # Libraries need to locate other libraries at runtime, and you can tell
|
---|
216 | # a library where to look by way of the dynamic runpaths (RPATH or RUNPATH)
|
---|
217 | # buried inside the .so. The $ORIGIN says to look relative to where
|
---|
218 | # the library itself is and it can be followed with relative paths from
|
---|
219 | # that. By default we always look in $ORIGIN, optionally we add relative
|
---|
220 | # paths if the Makefile sets LD_RUNPATH_EXTRAS to those relative paths.
|
---|
221 | # On Linux we add a flag -z origin, not sure if this is necessary, but
|
---|
222 | # doesn't seem to hurt.
|
---|
223 | # The environment variable LD_LIBRARY_PATH will over-ride these runpaths.
|
---|
224 | # Try: 'readelf -d lib*.so' to see these settings in a library.
|
---|
225 | #
|
---|
226 | LDFLAGS_COMMON += -Xlinker -z -Xlinker origin -Xlinker -rpath -Xlinker \$$ORIGIN
|
---|
227 | LDFLAGS_COMMON += $(LD_RUNPATH_EXTRAS:%=-Xlinker -z -Xlinker origin -Xlinker -rpath -Xlinker \$$ORIGIN/%)
|
---|
228 | endif
|
---|
229 |
|
---|
230 | EXTRA_LIBS += -lc
|
---|
231 |
|
---|
232 | LDFLAGS_DEFS_OPTION = -Xlinker -z -Xlinker defs
|
---|
233 | LDFLAGS_COMMON += $(LDFLAGS_DEFS_OPTION)
|
---|
234 |
|
---|
235 | #
|
---|
236 | # -L paths for finding and -ljava
|
---|
237 | #
|
---|
238 | LDFLAGS_OPT = -Xlinker -O1
|
---|
239 | LDFLAGS_COMMON += -L$(LIBDIR)/$(LIBARCH)
|
---|
240 | LDFLAGS_COMMON += -Wl,-soname=$(LIB_PREFIX)$(LIBRARY).$(LIBRARY_SUFFIX)
|
---|
241 |
|
---|
242 | #
|
---|
243 | # -static-libgcc is a gcc-3 flag to statically link libgcc, gcc-2.9x always
|
---|
244 | # statically link libgcc but will print a warning with the flag. We don't
|
---|
245 | # want the warning, so check gcc version first.
|
---|
246 | #
|
---|
247 | CC_VER_MAJOR := $(shell $(CC) -dumpversion | $(SED) 's/egcs-//' | $(CUT) -d'.' -f1)
|
---|
248 | ifeq ("$(CC_VER_MAJOR)", "3")
|
---|
249 | OTHER_LDFLAGS += -static-libgcc
|
---|
250 | endif
|
---|
251 |
|
---|
252 | # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
|
---|
253 | # (See Rules.gmk) The gcc 5 compiler might have an option for this?
|
---|
254 | AUTOMATIC_PCH_OPTION =
|
---|
255 |
|
---|
256 | #
|
---|
257 | # Post Processing of libraries/executables
|
---|
258 | #
|
---|
259 | ifeq ($(VARIANT), OPT)
|
---|
260 | ifneq ($(NO_STRIP), true)
|
---|
261 | ifneq ($(DEBUG_BINARIES), true)
|
---|
262 | # Debug 'strip -g' leaves local function Elf symbols (better stack
|
---|
263 | # traces)
|
---|
264 | POST_STRIP_PROCESS = $(STRIP) -g
|
---|
265 | endif
|
---|
266 | endif
|
---|
267 | endif
|
---|
268 |
|
---|
269 | #
|
---|
270 | # Use: ld $(LD_MAPFILE_FLAG) mapfile *.o
|
---|
271 | #
|
---|
272 | LD_MAPFILE_FLAG = -Xlinker --version-script -Xlinker
|
---|
273 |
|
---|
274 | #
|
---|
275 | # Support for Quantify.
|
---|
276 | #
|
---|
277 | ifdef QUANTIFY
|
---|
278 | QUANTIFY_CMD = quantify
|
---|
279 | QUANTIFY_OPTIONS = -cache-dir=/tmp/quantify -always-use-cache-dir=yes
|
---|
280 | LINK_PRE_CMD = $(QUANTIFY_CMD) $(QUANTIFY_OPTIONS)
|
---|
281 | endif
|
---|
282 |
|
---|
283 | #
|
---|
284 | # Path and option to link against the VM, if you have to. Note that
|
---|
285 | # there are libraries that link against only -ljava, but they do get
|
---|
286 | # -L to the -ljvm, this is because -ljava depends on -ljvm, whereas
|
---|
287 | # the library itself should not.
|
---|
288 | #
|
---|
289 | VM_NAME = server
|
---|
290 | JVMLIB = -L$(LIBDIR)/$(LIBARCH)/$(VM_NAME) -ljvm
|
---|
291 | JAVALIB = -ljava $(JVMLIB)
|
---|
292 |
|
---|
293 | #
|
---|
294 | # We want to privatize JVM symbols on Solaris. This is so the user can
|
---|
295 | # write a function called FindClass and this should not override the
|
---|
296 | # FindClass that is inside the JVM. At this point in time we are not
|
---|
297 | # concerned with other JNI libraries because we hope that there will
|
---|
298 | # not be as many clashes there.
|
---|
299 | #
|
---|
300 | PRIVATIZE_JVM_SYMBOLS = false
|
---|
301 |
|
---|
302 | USE_PTHREADS = true
|
---|
303 | override ALT_CODESET_KEY = _NL_CTYPE_CODESET_NAME
|
---|
304 | override AWT_RUNPATH =
|
---|
305 | override HAVE_ALTZONE = false
|
---|
306 | override HAVE_FILIOH = false
|
---|
307 | override HAVE_GETHRTIME = false
|
---|
308 | override HAVE_GETHRVTIME = false
|
---|
309 | override HAVE_SIGIGNORE = true
|
---|
310 | override LEX_LIBRARY = -lfl
|
---|
311 | ifeq ($(STATIC_CXX),true)
|
---|
312 | override LIBCXX = -Wl,-Bstatic -lstdc++ -lgcc -Wl,-Bdynamic
|
---|
313 | else
|
---|
314 | override LIBCXX = -lstdc++
|
---|
315 | endif
|
---|
316 | override LIBPOSIX4 =
|
---|
317 | override LIBSOCKET =
|
---|
318 | override LIBTHREAD =
|
---|
319 | override MOOT_PRIORITIES = true
|
---|
320 | override NO_INTERRUPTIBLE_IO = true
|
---|
321 | override OPENWIN_HOME = /usr/X11R6
|
---|
322 | ifeq ($(ARCH), amd64)
|
---|
323 | override OPENWIN_LIB = $(OPENWIN_HOME)/lib64
|
---|
324 | else
|
---|
325 | override OPENWIN_LIB = $(OPENWIN_HOME)/lib
|
---|
326 | endif
|
---|
327 | override OTHER_M4FLAGS = -D__GLIBC__ -DGNU_ASSEMBLER
|
---|
328 | override SUN_CMM_SUBDIR =
|
---|
329 | override THREADS_FLAG = native
|
---|
330 | override USE_GNU_M4 = true
|
---|
331 | override USING_GNU_TAR = true
|
---|
332 | override WRITE_LIBVERSION = false
|
---|
333 |
|
---|
334 | # USE_EXECNAME forces the launcher to look up argv[0] on $PATH, and put the
|
---|
335 | # resulting resolved absolute name of the executable in the environment
|
---|
336 | # variable EXECNAME. That executable name is then used that to locate the
|
---|
337 | # installation area.
|
---|
338 | override USE_EXECNAME = true
|
---|
339 |
|
---|
340 | # If your platform has DPS, it will have Type1 fonts too, in which case
|
---|
341 | # it is best to enable DPS support until such time as 2D's rasteriser
|
---|
342 | # can fully handle Type1 fonts in all cases. Default is "yes".
|
---|
343 | # HAVE_DPS should only be "no" if the platform has no DPS headers or libs
|
---|
344 | # DPS (Displayable PostScript) is available on Solaris machines
|
---|
345 | HAVE_DPS = no
|
---|
346 |
|
---|
347 | #
|
---|
348 | # Japanese manpages
|
---|
349 | #
|
---|
350 | JA_SOURCE_ENCODING = eucJP
|
---|
351 | JA_TARGET_ENCODINGS = eucJP
|
---|
352 |
|
---|
353 | # Settings for the JDI - Serviceability Agent binding.
|
---|
354 | HOTSPOT_SALIB_PATH = $(HOTSPOT_IMPORT_PATH)/jre/lib/$(LIBARCH)
|
---|
355 | SALIB_NAME = $(LIB_PREFIX)saproc.$(LIBRARY_SUFFIX)
|
---|
356 |
|
---|
357 | # The JDI - Serviceability Agent binding is not currently supported
|
---|
358 | # on Linux-ia64.
|
---|
359 | ifeq ($(ARCH), ia64)
|
---|
360 | INCLUDE_SA = false
|
---|
361 | else
|
---|
362 | INCLUDE_SA = true
|
---|
363 | endif
|
---|
364 |
|
---|