|
1 # |
|
2 # Copyright 1995-2007 Sun Microsystems, Inc. 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. Sun designates this |
|
8 # particular file as subject to the "Classpath" exception as provided |
|
9 # by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
22 # CA 95054 USA or visit www.sun.com if you need additional information or |
|
23 # have any questions. |
|
24 # |
|
25 |
|
26 # |
|
27 # Makefile to specify compiler flags for programs and libraries |
|
28 # targeted to Solaris. Should not contain any rules. |
|
29 # |
|
30 |
|
31 # Warning: the following variables are overridden by Defs.gmk. Set |
|
32 # values will be silently ignored: |
|
33 # CFLAGS (set $(OTHER_CFLAGS) instead) |
|
34 # CPPFLAGS (set $(OTHER_CPPFLAGS) instead) |
|
35 # CXXFLAGS (set $(OTHER_CXXFLAGS) instead) |
|
36 # LDFLAGS (set $(OTHER_LDFAGS) instead) |
|
37 # LDLIBS (set $(EXTRA_LIBS) instead) |
|
38 # LDLIBS_COMMON (set $(EXTRA_LIBS) instead) |
|
39 # LINTFLAGS (set $(OTHER_LINTFLAGS) instead) |
|
40 |
|
41 # Get shared JDK settings |
|
42 include $(BUILDDIR)/common/shared/Defs.gmk |
|
43 |
|
44 ifndef PLATFORM_SRC |
|
45 PLATFORM_SRC = $(TOPDIR)/src/solaris |
|
46 endif # PLATFORM_SRC |
|
47 |
|
48 # platform specific include files |
|
49 PLATFORM_INCLUDE_NAME = $(PLATFORM) |
|
50 PLATFORM_INCLUDE = $(INCLUDEDIR)/$(PLATFORM_INCLUDE_NAME) |
|
51 |
|
52 # suffix used for make dependencies files |
|
53 DEPEND_SUFFIX = d |
|
54 # suffix used for lint files |
|
55 LINT_SUFFIX = ln |
|
56 # The suffix applied to the library name for FDLIBM |
|
57 FDDLIBM_SUFFIX = a |
|
58 # The suffix applied to scripts (.bat for windows, nothing for unix) |
|
59 SCRIPT_SUFFIX = |
|
60 # CC compiler object code output directive flag value |
|
61 CC_OBJECT_OUTPUT_FLAG = -o #trailing blank required! |
|
62 CC_PROGRAM_OUTPUT_FLAG = -o #trailing blank required! |
|
63 |
|
64 # |
|
65 # Default HPI libraries. Build will build only native unless |
|
66 # overriden at the make command line. This makes it convenient for |
|
67 # people doing, say, a pthreads port -- they can create a posix |
|
68 # directory here, and say "gnumake HPIS=posix" at the top |
|
69 # level. |
|
70 # |
|
71 HPIS = native |
|
72 |
|
73 # |
|
74 # Java default optimization (-x04/-O2) etc. Applies to the VM. |
|
75 # |
|
76 ifeq ($(PRODUCT), java) |
|
77 _OPT = $(CC_HIGHER_OPT) |
|
78 else |
|
79 _OPT = $(CC_LOWER_OPT) |
|
80 CPPFLAGS_DBG += -DLOGGING -DDBINFO |
|
81 endif |
|
82 |
|
83 # |
|
84 # If -Xa is in CFLAGS_COMMON it will end up ahead of $(POPT) for the |
|
85 # optimized build, and that ordering of the flags completely freaks |
|
86 # out cc. Hence, -Xa is instead in each CFLAGS variant. |
|
87 # |
|
88 # The more unusual options to the Sun C compiler: |
|
89 # -v Stricter type checking, more error checking |
|
90 # (To turn ALL warnings into fatals, use -errwarn=%all) |
|
91 # -xstrconst Place string literals and constants in read-only area |
|
92 # (means you can't write on your string literals) |
|
93 # -xs Force debug information (stabs) into the .so or a.out |
|
94 # (makes the library/executable debuggable without the |
|
95 # .o files needing to be around, but at a space cost) |
|
96 # -g & -O If you add the -g option to the optimized compiles |
|
97 # you will get better stack retraces, the code is |
|
98 # still optimized. This includes a space cost too. |
|
99 # -xc99=%none Do NOT allow for c99 extensions to be used. |
|
100 # e.g. declarations must precede statements |
|
101 # -xCC Allow the C++ style of comments in C: // |
|
102 # Required with many of the source files. |
|
103 # -mt Assume multi-threaded (important) |
|
104 # |
|
105 |
|
106 # |
|
107 # Debug flag for C and C++ compiler |
|
108 # |
|
109 CFLAGS_DEBUG_OPTION=-g |
|
110 CXXFLAGS_DEBUG_OPTION=-g |
|
111 |
|
112 # Turn off -g if we are doing tcov build |
|
113 ifdef TCOV_BUILD |
|
114 CFLAGS_DEBUG_OPTION= |
|
115 CXXFLAGS_DEBUG_OPTION= |
|
116 endif |
|
117 |
|
118 # FASTDEBUG: Optimize the -g builds, gives us a faster debug java |
|
119 # If true adds -O to the debug compiles. This allows for any assert |
|
120 # tests to remain and debug checking. The resulting code is faster |
|
121 # but less debuggable. Stack traces are still valid, although only |
|
122 # approximate line numbers are given. Printing of local variables |
|
123 # during a debugging session is not possible, but stepping and |
|
124 # printing of global or static variables should be possible. |
|
125 # Performance/size of files should be about the same, maybe smaller. |
|
126 # |
|
127 ifeq ($(FASTDEBUG), true) |
|
128 CC_FASTDEBUG_OPT = $(CC_LOWER_OPT) |
|
129 CFLAGS_DEBUG_OPTION = -g $(CC_FASTDEBUG_OPT) |
|
130 CXXFLAGS_DEBUG_OPTION = -g0 $(CC_FASTDEBUG_OPT) |
|
131 endif |
|
132 |
|
133 CFLAGS_COMMON = -v -mt -L$(OBJDIR) -xc99=%none |
|
134 CFLAGS_COMMON += -xCC |
|
135 CFLAGS_COMMON += -errshort=tags |
|
136 CFLAGS_OPT = $(POPT) |
|
137 CFLAGS_DBG = $(CFLAGS_DEBUG_OPTION) |
|
138 CFLAGS_COMMON += -Xa $(CFLAGS_REQUIRED) |
|
139 |
|
140 # Assume MT behavior all the time (important) |
|
141 CXXFLAGS_COMMON = -mt |
|
142 |
|
143 # Assume no C++ exceptions are used |
|
144 CXXFLAGS_COMMON += -features=no%except -DCC_NOEX |
|
145 |
|
146 # For C++, these options tell it to assume nothing about locating libraries |
|
147 # either at compile time, or at runtime. Use of these options will likely |
|
148 # require the use of -L and -R options to indicate where libraries will |
|
149 # be found at compile time (-L) and at runtime (-R). |
|
150 # The /usr/lib location comes for free, so no need to specify that one. |
|
151 # Note: C is much simplier and there is no need for these options. This |
|
152 # is mostly needed to avoid dependencies on libraries in the |
|
153 # Compiler install area, also see LIBCXX and LIBM. |
|
154 CXXFLAGS_COMMON += -norunpath -xnolib |
|
155 |
|
156 # |
|
157 # Treat compiler warnings as errors, if requested |
|
158 # |
|
159 ifeq ($(COMPILER_WARNINGS_FATAL),true) |
|
160 CFLAGS_COMMON += -errwarn=%all |
|
161 CXXFLAGS_COMMON += -errwarn=%all |
|
162 endif |
|
163 |
|
164 CXXFLAGS_OPT = $(POPT) |
|
165 CXXFLAGS_DBG = $(CXXFLAGS_DEBUG_OPTION) |
|
166 CXXFLAGS_COMMON += $(CFLAGS_REQUIRED) |
|
167 |
|
168 # Add -xstrconst to the library compiles. This forces all string |
|
169 # literals into the read-only data section, which prevents them from |
|
170 # being written to and increases the runtime pages shared on the system. |
|
171 # |
|
172 ifdef LIBRARY |
|
173 CFLAGS_COMMON +=-xstrconst |
|
174 endif |
|
175 |
|
176 # Source browser database |
|
177 # |
|
178 # COMPILE_WITH_SB |
|
179 # If defined adds -xsb to compiles and creates a |
|
180 # source browsing database during compilation. |
|
181 # |
|
182 ifdef COMPILE_WITH_SB |
|
183 ifeq ($(LIBRARY), java) |
|
184 CFLAGS_DBG += -xsb |
|
185 endif |
|
186 endif |
|
187 |
|
188 # Lint Flags: |
|
189 # -Xa ANSI C plus K&R, favor ANSI rules |
|
190 # -Xarch=XXX Same as 'cc -xarch=XXX' |
|
191 # -fd report on old style func defs |
|
192 # -errchk=structarg report on 64bit struct args by value |
|
193 # -errchk=longptr64 report on 64bit to 32bit issues (ignores casts) |
|
194 # -errchk=parentheses report on suggested use of extra parens |
|
195 # -v suppress unused args |
|
196 # -x suppress unused externs |
|
197 # -u suppress extern func/vars used/defined |
|
198 # -errfmt=simple use one line errors with position info |
|
199 |
|
200 LINTFLAGS_COMMON = -Xa |
|
201 LINTFLAGS_COMMON += -fd |
|
202 LINTFLAGS_COMMON += -errchk=structarg,longptr64,parentheses |
|
203 LINTFLAGS_COMMON += -v |
|
204 LINTFLAGS_COMMON += -x |
|
205 LINTFLAGS_COMMON += -u |
|
206 LINTFLAGS_COMMON += -errfmt=simple |
|
207 LINTFLAGS_OPT = |
|
208 LINTFLAGS_DBG = |
|
209 |
|
210 # The -W0,-noglobal tells the compiler to NOT generate mangled global |
|
211 # ELF data symbols for file local static data. |
|
212 # This can break fix&continue, but we'd rather do the same compilations |
|
213 # for deliverable bits as we do for non-deliverable bits |
|
214 # Tell the compilers to never generate globalized names, all the time. |
|
215 CFLAGS_COMMON += -W0,-noglobal |
|
216 |
|
217 # Arch specific settings (determines type of .o files and instruction set) |
|
218 ifeq ($(ARCH_FAMILY), sparc) |
|
219 ifdef VIS_NEEDED |
|
220 XARCH_VALUE/32=v8plusa |
|
221 XARCH_VALUE/64=v9a |
|
222 else |
|
223 # Someday this should change to improve optimization on UltraSPARC |
|
224 # and abandon the old v8-only machines like the SPARCstation 10. |
|
225 # Indications with Mustang is that alacrity runs do not show a |
|
226 # big improvement using v8plus over v8, but other benchmarks might. |
|
227 XARCH_VALUE/32=v8 |
|
228 XARCH_VALUE/64=v9 |
|
229 endif |
|
230 endif |
|
231 ifeq ($(ARCH_FAMILY), i586) |
|
232 XARCH_VALUE/64=amd64 |
|
233 XARCH_VALUE/32= |
|
234 endif |
|
235 |
|
236 # Arch value based on current data model being built |
|
237 XARCH_VALUE=$(XARCH_VALUE/$(ARCH_DATA_MODEL)) |
|
238 ifneq ($(XARCH_VALUE), ) |
|
239 # The actual compiler -xarch options to use |
|
240 XARCH_OPTION/32 = -xarch=$(XARCH_VALUE/32) |
|
241 XARCH_OPTION/64 = -xarch=$(XARCH_VALUE/64) |
|
242 XARCH_OPTION = $(XARCH_OPTION/$(ARCH_DATA_MODEL)) |
|
243 endif |
|
244 |
|
245 # If we have a specific -xarch value to use, add it |
|
246 ifdef XARCH_OPTION |
|
247 CFLAGS_COMMON += $(XARCH_OPTION) |
|
248 CXXFLAGS_COMMON += $(XARCH_OPTION) |
|
249 ASFLAGS_COMMON += $(XARCH_OPTION) |
|
250 EXTRA_LIBS += $(XARCH_OPTION) |
|
251 LINTFLAGS_COMMON += -Xarch=$(XARCH_VALUE) |
|
252 endif |
|
253 |
|
254 # |
|
255 # uncomment the following to build with PERTURBALOT set |
|
256 # |
|
257 # OTHER_CFLAGS += -DPERTURBALOT |
|
258 # |
|
259 |
|
260 CPPFLAGS_COMMON = -D$(ARCH_FAMILY) -D__solaris__ -D_REENTRANT |
|
261 CPPFLAGS_OPT = |
|
262 CPPFLAGS_DBG = -DDEBUG |
|
263 |
|
264 ifeq ($(ARCH_FAMILY), i586) |
|
265 # The macro _LITTLE_ENDIAN needs to be defined the same to avoid the |
|
266 # Sun C compiler warning message: warning: macro redefined: _LITTLE_ENDIAN |
|
267 # (The Solaris X86 system defines this in file /usr/include/sys/isa_defs.h). |
|
268 # Note: -Dmacro is the same as #define macro 1 |
|
269 # -Dmacro= is the same as #define macro |
|
270 # |
|
271 CPPFLAGS_COMMON += -DcpuIntel -D_LITTLE_ENDIAN= -D$(LIBARCH) |
|
272 # Turn off a superfluous compiler error message on Intel |
|
273 CFLAGS_COMMON += -erroff=E_BAD_PRAGMA_PACK_VALUE |
|
274 endif |
|
275 |
|
276 # Java memory management is based on memory mapping by default, but a |
|
277 # system only assuming malloc/free can be built by adding -DUSE_MALLOC |
|
278 |
|
279 CPPFLAGS_COMMON += -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS |
|
280 CPPFLAGS_OPT += -DTRIMMED |
|
281 |
|
282 LDFLAGS_DEFS_OPTION = -z defs |
|
283 LDFLAGS_COMMON += $(LDFLAGS_DEFS_OPTION) |
|
284 |
|
285 # |
|
286 # -L paths for finding and -ljava |
|
287 # |
|
288 LDFLAGS_COMMON += -L$(LIBDIR)/$(LIBARCH) |
|
289 LDFLAGS_OPT = |
|
290 LDFLAGS_DBG = |
|
291 |
|
292 # |
|
293 # We never really want the incremental linker, ever |
|
294 # The -xildoff option tells Sun's compilers to NOT use incremental linker |
|
295 # |
|
296 LDFLAGS_COMMON += -xildoff |
|
297 |
|
298 ifdef LIBRARY |
|
299 # Libraries need to locate other libraries at runtime, and you can tell |
|
300 # a library where to look by way of the dynamic runpaths (RPATH or RUNPATH) |
|
301 # buried inside the .so. The $ORIGIN says to look relative to where |
|
302 # the library itself is and it can be followed with relative paths from |
|
303 # that. By default we always look in $ORIGIN, optionally we add relative |
|
304 # paths if the Makefile sets LD_RUNPATH_EXTRAS to those relative paths. |
|
305 # The environment variable LD_LIBRARY_PATH will over-ride these runpaths. |
|
306 # Try: 'dump -Lv lib*.so' to see these settings in a library. |
|
307 # |
|
308 LDFLAGS_COMMON += -R\$$ORIGIN |
|
309 LDFLAGS_COMMON += $(LD_RUNPATH_EXTRAS:%=-R\$$ORIGIN/%) |
|
310 endif |
|
311 |
|
312 EXTRA_LIBS += -lc |
|
313 |
|
314 # Postprocessing is done on the images directories only |
|
315 # |
|
316 ifeq ($(VARIANT), OPT) |
|
317 ifeq ($(PARTIAL_GPROF), true) |
|
318 NO_STRIP = true |
|
319 endif |
|
320 ifeq ($(GPROF), true) |
|
321 NO_STRIP = true |
|
322 endif |
|
323 ifneq ($(NO_STRIP), true) |
|
324 # Debug 'strip -x' leaves local function Elf symbols (better stack traces) |
|
325 POST_STRIP_PROCESS = $(STRIP) -x |
|
326 endif |
|
327 endif |
|
328 POST_MCS_PROCESS=$(MCS) -d -a "JDK $(FULL_VERSION)" |
|
329 |
|
330 # |
|
331 # Sun C compiler will take -M and pass it on to ld. |
|
332 # Usage: ld $(LD_MAPFILE_FLAG) mapfile *.o |
|
333 # |
|
334 ifeq ($(CC_VERSION),gcc) |
|
335 LD_MAPFILE_FLAG = -Xlinker -M -Xlinker |
|
336 else |
|
337 LD_MAPFILE_FLAG = -M |
|
338 endif |
|
339 |
|
340 # |
|
341 # Variables globally settable from the make command line (default |
|
342 # values in brackets): |
|
343 # GPROF (false) |
|
344 # Eg: % gnumake GPROF=true |
|
345 GPROF = false |
|
346 ifeq ($(GPROF), true) |
|
347 CFLAGS_COMMON += -DGPROF -xpg |
|
348 EXTRA_LIBS += -xpg |
|
349 endif |
|
350 |
|
351 # PARTIAL_GPROF is to be used ONLY during compilation - it should not |
|
352 # appear during linking of libraries or programs. It also should |
|
353 # prevent linking with -z defs to allow a symbol to remain undefined. |
|
354 # |
|
355 PARTIAL_GPROF = false |
|
356 ifeq ($(PARTIAL_GPROF), true) |
|
357 CFLAGS_GPROF += -xpg |
|
358 LDFLAGS_DEFS_OPTION = -z nodefs |
|
359 endif |
|
360 |
|
361 # |
|
362 # For a TCOV build we add in the TCOV_OPTION |
|
363 # |
|
364 ifdef TCOV_BUILD |
|
365 TCOV_OPTION = -xprofile=tcov |
|
366 LDFLAGS_COMMON += $(TCOV_OPTION) -Kpic |
|
367 CFLAGS_COMMON += $(TCOV_OPTION) |
|
368 CXXFLAGS_COMMON += $(TCOV_OPTION) |
|
369 EXTRA_LIBS += $(TCOV_OPTION) |
|
370 LDNOMAP=true |
|
371 endif |
|
372 |
|
373 # |
|
374 # Solaris only uses native threads. |
|
375 # |
|
376 THREADS_FLAG= native |
|
377 THREADS_DIR= threads |
|
378 |
|
379 # |
|
380 # Support for Quantify. |
|
381 # |
|
382 ifdef QUANTIFY |
|
383 QUANTIFY_CMD = quantify |
|
384 QUANTIFY_OPTIONS = -cache-dir=/tmp/quantify -always-use-cache-dir=yes |
|
385 LINK_PRE_CMD = $(QUANTIFY_CMD) $(QUANTIFY_OPTIONS) |
|
386 ifdef LIBRARY |
|
387 CFLAGS_COMMON += -K PIC |
|
388 endif |
|
389 endif |
|
390 |
|
391 # |
|
392 # Support for Purify. |
|
393 # |
|
394 ifdef PURIFY |
|
395 PURIFY_CMD = /net/suntools.eng/export/tools/sparc/bin/purify |
|
396 PURIFY_OPTIONS = -cache-dir=/tmp/quantify -always-use-cache-dir=yes |
|
397 LINK_PRE_CMD = $(PURIFY_CMD) $(PURIFY_OPTIONS) |
|
398 ifdef LIBRARY |
|
399 CFLAGS_COMMON += -K PIC |
|
400 endif |
|
401 endif |
|
402 |
|
403 # |
|
404 # Different "levels" of optimization. |
|
405 # |
|
406 ifeq ($(CC_VERSION),gcc) |
|
407 CC_HIGHEST_OPT = -O3 |
|
408 CC_HIGHER_OPT = -O3 |
|
409 CC_LOWER_OPT = -O2 |
|
410 CFLAGS_REQUIRED_i586 += -fno-omit-frame-pointer |
|
411 CFLAGS_REQUIRED_amd64 += -fno-omit-frame-pointer |
|
412 # Automatic precompiled header option to use (if COMPILE_APPROACH=batch) |
|
413 # (See Rules.gmk) May need to wait for gcc 5? |
|
414 AUTOMATIC_PCH_OPTION = |
|
415 else |
|
416 # Highest could be -xO5, but indications are that -xO5 should be reserved |
|
417 # for a per-file use, on sources with known performance impacts. |
|
418 CC_HIGHEST_OPT = -xO4 |
|
419 CC_HIGHER_OPT = -xO4 |
|
420 CC_LOWER_OPT = -xO2 |
|
421 # |
|
422 # WARNING: Use of _OPT=$(CC_HIGHEST_OPT) in your Makefile needs to be |
|
423 # done with care, there are some assumptions below that need to |
|
424 # be understood about the use of pointers, and IEEE behavior. |
|
425 # |
|
426 # Use non-standard floating point mode (not IEEE 754) |
|
427 CC_HIGHEST_OPT += -fns |
|
428 # Do some simplification of floating point arithmetic (not IEEE 754) |
|
429 CC_HIGHEST_OPT += -fsimple |
|
430 # Use single precision floating point with 'float' |
|
431 CC_HIGHEST_OPT += -fsingle |
|
432 # Assume memory references via basic pointer types do not alias |
|
433 # (Source with excessing pointer casting and data access with mixed |
|
434 # pointer types are not recommended) |
|
435 CC_HIGHEST_OPT += -xalias_level=basic |
|
436 # Use intrinsic or inline versions for math/std functions |
|
437 # (If you expect perfect errno behavior, do not use this) |
|
438 CC_HIGHEST_OPT += -xbuiltin=%all |
|
439 # Loop data dependency optimizations (need -xO3 or higher) |
|
440 CC_HIGHEST_OPT += -xdepend |
|
441 # Pointer parameters to functions do not overlap |
|
442 # (Similar to -xalias_level=basic usage, but less obvious sometimes. |
|
443 # If you pass in multiple pointers to the same data, do not use this) |
|
444 CC_HIGHEST_OPT += -xrestrict |
|
445 # Inline some library routines |
|
446 # (If you expect perfect errno behavior, do not use this) |
|
447 CC_HIGHEST_OPT += -xlibmil |
|
448 # Use optimized math routines |
|
449 # (If you expect perfect errno behavior, do not use this) |
|
450 # Can cause undefined external on Solaris 8 X86 on __sincos, removing for now |
|
451 # CC_HIGHEST_OPT += -xlibmopt |
|
452 ifeq ($(ARCH_FAMILY), sparc) |
|
453 # Assume at most 8byte alignment, raise SIGBUS on error |
|
454 ### Presents an ABI issue with customer JNI libs? |
|
455 ####CC_HIGHEST_OPT += -xmemalign=8s |
|
456 # Automatic prefetch instructions, explicit prefetch macros |
|
457 CC_HIGHEST_OPT += -xprefetch=auto,explicit |
|
458 # Pick ultra as the chip to optimize to |
|
459 CC_HIGHEST_OPT += -xchip=ultra |
|
460 endif |
|
461 ifeq ($(ARCH), i586) |
|
462 # Pick pentium as the chip to optimize to |
|
463 CC_HIGHEST_OPT += -xchip=pentium |
|
464 endif |
|
465 ifdef LIBRARY |
|
466 # The Solaris CBE (Common Build Environment) requires that the use |
|
467 # of appl registers be disabled when compiling a public library (or |
|
468 # a library that's loaded by a public library) on sparc. |
|
469 CFLAGS_REQUIRED_sparc += -xregs=no%appl |
|
470 CFLAGS_REQUIRED_sparcv9 += -xregs=no%appl |
|
471 endif |
|
472 ifeq ($(shell $(EXPR) $(CC_VER) \> 5.6), 1) |
|
473 # Do NOT use the frame pointer register as a general purpose opt register |
|
474 CFLAGS_REQUIRED_i586 += -xregs=no%frameptr |
|
475 CFLAGS_REQUIRED_amd64 += -xregs=no%frameptr |
|
476 # We MUST allow data alignment of 4 for sparc V8 (32bit) |
|
477 # Presents an ABI issue with customer JNI libs? We must be able to |
|
478 # to handle 4byte aligned objects? (rare occurance, but possible?) |
|
479 CFLAGS_REQUIRED_sparc += -xmemalign=4s |
|
480 endif |
|
481 # Just incase someone trys to use the SOS9 compilers |
|
482 ifeq ($(CC_VER), 5.6) |
|
483 # We MUST allow data alignment of 4 for sparc (sparcv9 is ok at 8s) |
|
484 CFLAGS_REQUIRED_sparc += -xmemalign=4s |
|
485 endif |
|
486 # Automatic precompiled header option to use (if COMPILE_APPROACH=batch) |
|
487 # (See Rules.gmk) The SS11 -xpch=auto* options appear to be broken. |
|
488 AUTOMATIC_PCH_OPTION = |
|
489 endif |
|
490 CC_NO_OPT = |
|
491 |
|
492 # If NO_OPTIMIZATIONS is defined in the environment, turn all optimzations off |
|
493 ifdef NO_OPTIMIZATIONS |
|
494 CC_HIGHEST_OPT = $(CC_NO_OPT) |
|
495 CC_HIGHER_OPT = $(CC_NO_OPT) |
|
496 CC_LOWER_OPT = $(CC_NO_OPT) |
|
497 endif |
|
498 |
|
499 # Flags required all the time |
|
500 CFLAGS_REQUIRED = $(CFLAGS_REQUIRED_$(ARCH)) |
|
501 |
|
502 # Add processor specific options for optimizations |
|
503 CC_HIGHEST_OPT += $(_OPT_$(ARCH)) |
|
504 CC_HIGHER_OPT += $(_OPT_$(ARCH)) |
|
505 CC_LOWER_OPT += $(_OPT_$(ARCH)) |
|
506 |
|
507 # Secret compiler optimization options that should be in the above macros |
|
508 # but since they differ in format from C to C++, are added into the C or |
|
509 # C++ specific macros for compiler flags. |
|
510 # |
|
511 # On i586 we need to tell the code generator to ALWAYS use a |
|
512 # frame pointer. |
|
513 ifeq ($(ARCH_FAMILY), i586) |
|
514 # Note that in 5.7, this is done with -xregs=no%frameptr |
|
515 ifeq ($(CC_VER), 5.5) |
|
516 # It's not exactly clear when this optimization kicks in, the |
|
517 # current assumption is -xO4 or greater and for C++ with |
|
518 # the -features=no%except option and -xO4 and greater. |
|
519 # Bottom line is, we ALWAYS want a frame pointer! |
|
520 CXXFLAGS_OPT += -Qoption ube -Z~B |
|
521 CFLAGS_OPT += -Wu,-Z~B |
|
522 ifeq ($(FASTDEBUG), true) |
|
523 CXXFLAGS_DBG += -Qoption ube -Z~B |
|
524 CFLAGS_DBG += -Wu,-Z~B |
|
525 endif |
|
526 endif |
|
527 endif |
|
528 # |
|
529 # Optimizer for sparc needs to be told not to do certain things |
|
530 # related to frames or save instructions. |
|
531 ifeq ($(ARCH_FAMILY), sparc) |
|
532 # NOTE: Someday the compilers will provide a high-level option for this. |
|
533 # Use save instructions instead of add instructions |
|
534 # This was an optimization starting in SC5.0 that made it hard for us to |
|
535 # find the "save" instruction (which got turned into an "add") |
|
536 CXXFLAGS_OPT += -Qoption cg -Qrm-s |
|
537 CFLAGS_OPT += -Wc,-Qrm-s |
|
538 ifeq ($(FASTDEBUG), true) |
|
539 CXXFLAGS_DBG += -Qoption cg -Qrm-s |
|
540 CFLAGS_DBG += -Wc,-Qrm-s |
|
541 endif |
|
542 # |
|
543 # NOTE: Someday the compilers will provide a high-level option for this. |
|
544 # Don't allow tail call code optimization. Started in SC5.0. |
|
545 # We don't like code of this form: |
|
546 # save |
|
547 # <code> |
|
548 # call foo |
|
549 # restore |
|
550 # because we can't tell if the method will have a stack frame |
|
551 # and register windows or not. |
|
552 CXXFLAGS_OPT += -Qoption cg -Qiselect-T0 |
|
553 CFLAGS_OPT += -Wc,-Qiselect-T0 |
|
554 ifeq ($(FASTDEBUG), true) |
|
555 CXXFLAGS_DBG += -Qoption cg -Qiselect-T0 |
|
556 CFLAGS_DBG += -Wc,-Qiselect-T0 |
|
557 endif |
|
558 endif |
|
559 |
|
560 # |
|
561 # Path and option to link against the VM, if you have to. Note that |
|
562 # there are libraries that link against only -ljava, but they do get |
|
563 # -L to the -ljvm, this is because -ljava depends on -ljvm, whereas |
|
564 # the library itself should not. |
|
565 # |
|
566 VM_NAME = server |
|
567 JVMLIB = -L$(BOOTDIR)/jre/lib/$(LIBARCH)/server -ljvm |
|
568 JAVALIB = |
|
569 |
|
570 # Part of INCREMENTAL_BUILD mechanism. |
|
571 # Compiler emits things like: path/file.o: file.h |
|
572 # We want something like: relative_path/file.o relative_path/file.d: file.h |
|
573 # In addition on Solaris, any include file starting with / is deleted, |
|
574 # this gets rid of things like /usr/include files, which never change. |
|
575 CC_DEPEND = -xM1 |
|
576 CC_DEPEND_FILTER = $(SED) -e '/:[ ]*[/]/d' -e 's!$*\.$(OBJECT_SUFFIX)!$(dir $@)& $(dir $@)$*.$(DEPEND_SUFFIX)!g' | $(SORT) -u |
|
577 |
|
578 # Location of openwin libraries (do we really need this anymore?) |
|
579 OPENWIN_HOME = /usr/openwin |
|
580 OPENWIN_LIB = $(OPENWIN_HOME)/lib$(ISA_DIR) |
|
581 |
|
582 # Runtime graphics library search paths... |
|
583 OPENWIN_RUNTIME_LIB = /usr/openwin/lib$(ISA_DIR) |
|
584 AWT_RUNPATH = -R/usr/dt/lib$(ISA_DIR) -R$(OPENWIN_RUNTIME_LIB) |
|
585 |
|
586 # C++ Runtime library (libCrun.so), use instead of -lCrun. |
|
587 # Originally used instead of -lCrun to guarantee use of the system |
|
588 # .so version and not the .a or .so that came with the compilers. |
|
589 # With the newer compilers this could probably change back to -lCrun but |
|
590 # in general this is ok to continue to do. |
|
591 LIBCXX = /usr/lib$(ISA_DIR)/libCrun.so.1 |
|
592 |
|
593 # Math Library (libm.so), do not use -lm. |
|
594 # There might be two versions of libm.so on the build system: |
|
595 # libm.so.1 and libm.so.2, and we want libm.so.1. |
|
596 # Depending on the Solaris release being used to build with, |
|
597 # /usr/lib/libm.so could point at a libm.so.2, so we are |
|
598 # explicit here so that the libjvm.so you have built will work on an |
|
599 # older Solaris release that might not have libm.so.2. |
|
600 # This is a critical factor in allowing builds on Solaris 10 or newer |
|
601 # to run on Solaris 8 or 9. |
|
602 # |
|
603 # Note: Historically there was also a problem picking up a static version |
|
604 # of libm.a from the compiler area, but that problem has gone away |
|
605 # with the newer compilers. Use of libm.a would cause .so bloat. |
|
606 # |
|
607 LIBM = /usr/lib$(ISA_DIR)/libm.so.1 |
|
608 |
|
609 # Socket library |
|
610 LIBSOCKET = -lsocket |
|
611 |
|
612 # GLOBAL_KPIC: If set means all libraries are PIC, position independent code |
|
613 # EXCEPT for select compiles |
|
614 # If a .o file is compiled non-PIC then it should be forced |
|
615 # into the RW data segment with a mapfile option. This is done |
|
616 # with object files which generated from .s files. |
|
617 # The -ztext enforces that no relocations remain in the text segment |
|
618 # so that it remains purely read-only for optimum system performance. |
|
619 # Some libraries may use a smaller size (13bit -Kpic) on sparc instead of |
|
620 # (32 bit -KPIC) and will override GLOBAL_KPIC appropriately. |
|
621 # |
|
622 PIC_CODE_LARGE = -KPIC |
|
623 PIC_CODE_SMALL = -Kpic |
|
624 ifndef TCOV_BUILD |
|
625 GLOBAL_KPIC = $(PIC_CODE_LARGE) |
|
626 CXXFLAGS_COMMON += $(GLOBAL_KPIC) |
|
627 CFLAGS_COMMON += $(GLOBAL_KPIC) |
|
628 LDFLAGS_COMMON += -ztext |
|
629 endif # TCOV_BUILD |
|
630 |
|
631 # If your platform has DPS, it will have Type1 fonts too, in which case |
|
632 # it is best to enable DPS support until such time as 2D's rasteriser |
|
633 # can fully handle Type1 fonts in all cases. Default is "yes". |
|
634 # HAVE_DPS should only be "no" if the platform has no DPS headers or libs |
|
635 # DPS (Displayable PostScript) is available on Solaris machines |
|
636 |
|
637 HAVE_DPS = yes |
|
638 |
|
639 # |
|
640 # Japanese manpages |
|
641 # |
|
642 JA_SOURCE_ENCODING = eucJP |
|
643 JA_TARGET_ENCODINGS = eucJP UTF-8 PCK |
|
644 |