comparison make/solaris/makefiles/sparcWorks.make @ 430:4d20a3aaf1ab

6769748: Fix solaris makefiles for the case when "CC -V" produces several lines Summary: Fix solaris makefiles for 5.10 compilers Reviewed-by: jcoomes
author kvn
date Wed, 12 Nov 2008 11:01:31 -0800
parents 4852f4a82e58
children 2bf529ef0adb
comparison
equal deleted inserted replaced
429:364141474b40 430:4d20a3aaf1ab
39 39
40 # Check for the versions of C++ and C compilers ($CPP and $CC) used. 40 # Check for the versions of C++ and C compilers ($CPP and $CC) used.
41 41
42 # Get the last thing on the line that looks like x.x+ (x is a digit). 42 # Get the last thing on the line that looks like x.x+ (x is a digit).
43 COMPILER_REV := \ 43 COMPILER_REV := \
44 $(shell $(CPP) -V 2>&1 | sed -e 's/^.*\([1-9]\.[0-9][0-9]*\).*/\1/') 44 $(shell $(CPP) -V 2>&1 | sed -n 's/^.*[ ,\t]C++[ ,\t]\([1-9]\.[0-9][0-9]*\).*/\1/p')
45 C_COMPILER_REV := \ 45 C_COMPILER_REV := \
46 $(shell $(CC) -V 2>&1 | grep -i "cc:" | sed -e 's/^.*\([1-9]\.[0-9][0-9]*\).*/\1/') 46 $(shell $(CC) -V 2>&1 | sed -n 's/^.*[ ,\t]C[ ,\t]\([1-9]\.[0-9][0-9]*\).*/\1/p')
47 47
48 # Pick which compiler is validated 48 # Pick which compiler is validated
49 ifeq ($(JDK_MINOR_VERSION),6) 49 ifeq ($(JDK_MINOR_VERSION),6)
50 # Validated compiler for JDK6 is SS11 (5.8) 50 # Validated compiler for JDK6 is SS11 (5.8)
51 VALIDATED_COMPILER_REV := 5.8 51 VALIDATED_COMPILER_REV := 5.8
58 58
59 # Warning messages about not using the above validated version 59 # Warning messages about not using the above validated version
60 ENFORCE_COMPILER_REV${ENFORCE_COMPILER_REV} := ${VALIDATED_COMPILER_REV} 60 ENFORCE_COMPILER_REV${ENFORCE_COMPILER_REV} := ${VALIDATED_COMPILER_REV}
61 ifneq (${COMPILER_REV},${ENFORCE_COMPILER_REV}) 61 ifneq (${COMPILER_REV},${ENFORCE_COMPILER_REV})
62 dummy_target_to_enforce_compiler_rev:=\ 62 dummy_target_to_enforce_compiler_rev:=\
63 $(info WARNING: You are using CC version ${COMPILER_REV} \ 63 $(shell echo >&2 WARNING: You are using CC version ${COMPILER_REV} \
64 and should be using version ${ENFORCE_COMPILER_REV}) 64 and should be using version ${ENFORCE_COMPILER_REV}. Set ENFORCE_COMPILER_REV=${COMPILER_REV} to avoid this warning.)
65 endif 65 endif
66 66
67 ENFORCE_C_COMPILER_REV${ENFORCE_C_COMPILER_REV} := ${VALIDATED_C_COMPILER_REV} 67 ENFORCE_C_COMPILER_REV${ENFORCE_C_COMPILER_REV} := ${VALIDATED_C_COMPILER_REV}
68 ifneq (${C_COMPILER_REV},${ENFORCE_C_COMPILER_REV}) 68 ifneq (${C_COMPILER_REV},${ENFORCE_C_COMPILER_REV})
69 dummy_target_to_enforce_c_compiler_rev:=\ 69 dummy_target_to_enforce_c_compiler_rev:=\
70 $(info WARNING: You are using cc version ${C_COMPILER_REV} \ 70 $(shell echo >&2 WARNING: You are using cc version ${C_COMPILER_REV} \
71 and should be using version ${ENFORCE_C_COMPILER_REV}) 71 and should be using version ${ENFORCE_C_COMPILER_REV}. Set ENFORCE_C_COMPILER_REV=${C_COMPILER_REV} to avoid this warning.)
72 endif 72 endif
73
74 COMPILER_REV_NUMERIC := $(shell echo $(COMPILER_REV) | awk -F. '{ print $$1 * 100 + $$2 }')
73 75
74 # Fail the build if __fabsf is used. __fabsf exists only in Solaris 8 2/04 76 # Fail the build if __fabsf is used. __fabsf exists only in Solaris 8 2/04
75 # and newer; objects with a dependency on this symbol will not run on older 77 # and newer; objects with a dependency on this symbol will not run on older
76 # Solaris 8. 78 # Solaris 8.
77 JVM_FAIL_IF_UNDEFINED = __fabsf 79 JVM_FAIL_IF_UNDEFINED = __fabsf
118 ARCHFLAG_NEW/i486 = -m32 120 ARCHFLAG_NEW/i486 = -m32
119 ARCHFLAG_OLD/amd64 = -xarch=amd64 121 ARCHFLAG_OLD/amd64 = -xarch=amd64
120 ARCHFLAG_NEW/amd64 = -m64 122 ARCHFLAG_NEW/amd64 = -m64
121 123
122 # Select the ARCHFLAGs and other SS12 (5.9) options 124 # Select the ARCHFLAGs and other SS12 (5.9) options
123 ifeq ($(shell expr $(COMPILER_REV) \>= 5.9), 1) 125 ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 509), 1)
124 ARCHFLAG/sparc = $(ARCHFLAG_NEW/sparc) 126 ARCHFLAG/sparc = $(ARCHFLAG_NEW/sparc)
125 ARCHFLAG/sparcv9 = $(ARCHFLAG_NEW/sparcv9) 127 ARCHFLAG/sparcv9 = $(ARCHFLAG_NEW/sparcv9)
126 ARCHFLAG/i486 = $(ARCHFLAG_NEW/i486) 128 ARCHFLAG/i486 = $(ARCHFLAG_NEW/i486)
127 ARCHFLAG/amd64 = $(ARCHFLAG_NEW/amd64) 129 ARCHFLAG/amd64 = $(ARCHFLAG_NEW/amd64)
128 else 130 else
148 150
149 ################################################# 151 #################################################
150 # Begin current (>=5.6) Forte compiler options # 152 # Begin current (>=5.6) Forte compiler options #
151 ################################################# 153 #################################################
152 154
153 ifeq ($(shell expr $(COMPILER_REV) \>= 5.6), 1) 155 ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 506), 1)
154 156
155 ifeq ("${Platform_arch}", "sparc") 157 ifeq ("${Platform_arch}", "sparc")
156 158
157 # We MUST allow data alignment of 4 for sparc (sparcv9 is ok at 8s) 159 # We MUST allow data alignment of 4 for sparc (sparcv9 is ok at 8s)
158 ifndef LP64 160 ifndef LP64
165 167
166 ################################################# 168 #################################################
167 # Begin current (>=5.5) Forte compiler options # 169 # Begin current (>=5.5) Forte compiler options #
168 ################################################# 170 #################################################
169 171
170 ifeq ($(shell expr $(COMPILER_REV) \>= 5.5), 1) 172 ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 505), 1)
171 173
172 CFLAGS += $(ARCHFLAG) 174 CFLAGS += $(ARCHFLAG)
173 AOUT_FLAGS += $(ARCHFLAG) 175 AOUT_FLAGS += $(ARCHFLAG)
174 LIB_FLAGS += $(ARCHFLAG) 176 LIB_FLAGS += $(ARCHFLAG)
175 LFLAGS += $(ARCHFLAG) 177 LFLAGS += $(ARCHFLAG)
253 CFLAGS += -library=%none 255 CFLAGS += -library=%none
254 LFLAGS += -library=%none 256 LFLAGS += -library=%none
255 257
256 LFLAGS += -mt 258 LFLAGS += -mt
257 259
258 endif # COMPILER_REV >= 5.5 260 endif # COMPILER_REV_NUMERIC >= 505
259 261
260 ###################################### 262 ######################################
261 # End 5.5 Forte compiler options # 263 # End 5.5 Forte compiler options #
262 ###################################### 264 ######################################
263 265
264 ###################################### 266 ######################################
265 # Begin 5.2 Forte compiler options # 267 # Begin 5.2 Forte compiler options #
266 ###################################### 268 ######################################
267 269
268 ifeq ($(COMPILER_REV), 5.2) 270 ifeq ($(COMPILER_REV_NUMERIC), 502)
269 271
270 CFLAGS += $(ARCHFLAG) 272 CFLAGS += $(ARCHFLAG)
271 AOUT_FLAGS += $(ARCHFLAG) 273 AOUT_FLAGS += $(ARCHFLAG)
272 LIB_FLAGS += $(ARCHFLAG) 274 LIB_FLAGS += $(ARCHFLAG)
273 LFLAGS += $(ARCHFLAG) 275 LFLAGS += $(ARCHFLAG)
322 # Would be better if these weren't needed, since we link with CC, but 324 # Would be better if these weren't needed, since we link with CC, but
323 # at present removing them causes run-time errors 325 # at present removing them causes run-time errors
324 LFLAGS += -library=Crun 326 LFLAGS += -library=Crun
325 LIBS += -library=Crun -lCrun 327 LIBS += -library=Crun -lCrun
326 328
327 endif # COMPILER_REV == 5.2 329 endif # COMPILER_REV_NUMERIC == 502
328 330
329 ################################## 331 ##################################
330 # End 5.2 Forte compiler options # 332 # End 5.2 Forte compiler options #
331 ################################## 333 ##################################
332 334
333 ################################## 335 ##################################
334 # Begin old 5.1 compiler options # 336 # Begin old 5.1 compiler options #
335 ################################## 337 ##################################
336 ifeq ($(COMPILER_REV), 5.1) 338 ifeq ($(COMPILER_REV_NUMERIC), 501)
337 339
338 _JUNK_ := $(shell echo >&2 \ 340 _JUNK_ := $(shell echo >&2 \
339 "*** ERROR: sparkWorks.make incomplete for 5.1 compiler") 341 "*** ERROR: sparkWorks.make incomplete for 5.1 compiler")
340 @exit 1 342 @exit 1
341 endif 343 endif
345 347
346 ################################## 348 ##################################
347 # Begin old 5.0 compiler options # 349 # Begin old 5.0 compiler options #
348 ################################## 350 ##################################
349 351
350 ifeq (${COMPILER_REV}, 5.0) 352 ifeq (${COMPILER_REV_NUMERIC}, 500)
351 353
352 # Had to hoist this higher apparently because of other changes. Must 354 # Had to hoist this higher apparently because of other changes. Must
353 # come before -xarch specification. 355 # come before -xarch specification.
354 # NOTE: native says optimize for the machine doing the compile, bad news. 356 # NOTE: native says optimize for the machine doing the compile, bad news.
355 CFLAGS += -xtarget=native 357 CFLAGS += -xtarget=native
377 379
378 endif # sparc 380 endif # sparc
379 381
380 ifeq ("${Platform_arch_model}", "x86_32") 382 ifeq ("${Platform_arch_model}", "x86_32")
381 OPT_CFLAGS=-xtarget=pentium $(EXTRA_OPT_CFLAGS) 383 OPT_CFLAGS=-xtarget=pentium $(EXTRA_OPT_CFLAGS)
382 ifeq ("${COMPILER_REV}", "5.0") 384 ifeq ("${COMPILER_REV_NUMERIC}", "500")
383 # SC5.0 tools on x86 are flakey at -xO4 385 # SC5.0 tools on x86 are flakey at -xO4
384 OPT_CFLAGS+=-xO3 386 OPT_CFLAGS+=-xO3
385 else 387 else
386 OPT_CFLAGS+=-xO4 388 OPT_CFLAGS+=-xO4
387 endif 389 endif
403 # [RGV] Need to figure which files to remove to get link to work 405 # [RGV] Need to figure which files to remove to get link to work
404 #PICFLAG/BETTER = -pic 406 #PICFLAG/BETTER = -pic
405 PICFLAG/BETTER = $(PICFLAG/DEFAULT) 407 PICFLAG/BETTER = $(PICFLAG/DEFAULT)
406 PICFLAG/BYFILE = $(PICFLAG/$@)$(PICFLAG/DEFAULT$(PICFLAG/$@)) 408 PICFLAG/BYFILE = $(PICFLAG/$@)$(PICFLAG/DEFAULT$(PICFLAG/$@))
407 409
408 endif # COMPILER_REV = 5.0 410 endif # COMPILER_REV_NUMERIC = 500
409 411
410 ################################ 412 ################################
411 # End old 5.0 compiler options # 413 # End old 5.0 compiler options #
412 ################################ 414 ################################
413 415
414 ifeq ("${COMPILER_REV}", "4.2") 416 ifeq ("${COMPILER_REV_NUMERIC}", "402")
415 # 4.2 COMPILERS SHOULD NO LONGER BE USED 417 # 4.2 COMPILERS SHOULD NO LONGER BE USED
416 _JUNK_ := $(shell echo >&2 \ 418 _JUNK_ := $(shell echo >&2 \
417 "*** ERROR: SC4.2 compilers are not supported by this code base!") 419 "*** ERROR: SC4.2 compilers are not supported by this code base!")
418 @exit 1 420 @exit 1
419 endif 421 endif
441 LINK_MODE = $(LINK_MODE/$(VERSION)) 443 LINK_MODE = $(LINK_MODE/$(VERSION))
442 LINK_MODE/debug = 444 LINK_MODE/debug =
443 LINK_MODE/optimized = -Bsymbolic -znodefs 445 LINK_MODE/optimized = -Bsymbolic -znodefs
444 446
445 # Have thread local errnos 447 # Have thread local errnos
446 ifeq ($(shell expr $(COMPILER_REV) \>= 5.5), 1) 448 ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 505), 1)
447 CFLAGS += -mt 449 CFLAGS += -mt
448 else 450 else
449 CFLAGS += -D_REENTRANT 451 CFLAGS += -D_REENTRANT
450 endif 452 endif
451 453
458 DEBUG_CFLAGS = -g 460 DEBUG_CFLAGS = -g
459 FASTDEBUG_CFLAGS = -g0 461 FASTDEBUG_CFLAGS = -g0
460 # The -g0 setting allows the C++ frontend to inline, which is a big win. 462 # The -g0 setting allows the C++ frontend to inline, which is a big win.
461 463
462 # Special global options for SS12 464 # Special global options for SS12
463 ifeq ($(COMPILER_REV),5.9) 465 ifeq ($(COMPILER_REV_NUMERIC),509)
464 # There appears to be multiple issues with the new Dwarf2 debug format, so 466 # There appears to be multiple issues with the new Dwarf2 debug format, so
465 # we tell the compiler to use the older 'stabs' debug format all the time. 467 # we tell the compiler to use the older 'stabs' debug format all the time.
466 # Note that this needs to be used in optimized compiles too to be 100%. 468 # Note that this needs to be used in optimized compiles too to be 100%.
467 # This is a workaround for SS12 (5.9) bug 6694600 469 # This is a workaround for SS12 (5.9) bug 6694600
468 CFLAGS += -xdebugformat=stabs 470 CFLAGS += -xdebugformat=stabs
477 # a static globalization prefix based on the source filepath so the 479 # a static globalization prefix based on the source filepath so the
478 # objects from two identical compilations are the same. 480 # objects from two identical compilations are the same.
479 #DEBUG_CFLAGS += -Qoption ccfe -xglobalstatic 481 #DEBUG_CFLAGS += -Qoption ccfe -xglobalstatic
480 #FASTDEBUG_CFLAGS += -Qoption ccfe -xglobalstatic 482 #FASTDEBUG_CFLAGS += -Qoption ccfe -xglobalstatic
481 483
482 ifeq (${COMPILER_REV}, 5.2) 484 ifeq (${COMPILER_REV_NUMERIC}, 502)
483 COMPILER_DATE := $(shell $(CPP) -V 2>&1 | awk '{ print $$NF; }') 485 COMPILER_DATE := $(shell $(CPP) -V 2>&1 | sed -n '/^.*[ ]C++[ ]\([1-9]\.[0-9][0-9]*\)/p' | awk '{ print $$NF; }')
484 ifeq (${COMPILER_DATE}, 2001/01/31) 486 ifeq (${COMPILER_DATE}, 2001/01/31)
485 # disable -g0 in fastdebug since SC6.1 dated 2001/01/31 seems to be buggy 487 # disable -g0 in fastdebug since SC6.1 dated 2001/01/31 seems to be buggy
486 # use an innocuous value because it will get -g if it's empty 488 # use an innocuous value because it will get -g if it's empty
487 FASTDEBUG_CFLAGS = -c 489 FASTDEBUG_CFLAGS = -c
488 endif 490 endif
491 # Uncomment or 'gmake CFLAGS_BROWSE=-sbfast' to get source browser information. 493 # Uncomment or 'gmake CFLAGS_BROWSE=-sbfast' to get source browser information.
492 # CFLAGS_BROWSE = -sbfast 494 # CFLAGS_BROWSE = -sbfast
493 CFLAGS += $(CFLAGS_BROWSE) 495 CFLAGS += $(CFLAGS_BROWSE)
494 496
495 # ILD is gone as of SS11 (5.8), not supportted in SS10 (5.7) 497 # ILD is gone as of SS11 (5.8), not supportted in SS10 (5.7)
496 ifeq ($(shell expr $(COMPILER_REV) \< 5.7), 1) 498 ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \< 507), 1)
497 # use ild when debugging (but when optimizing we want reproducible results) 499 # use ild when debugging (but when optimizing we want reproducible results)
498 ILDFLAG = $(ILDFLAG/$(VERSION)) 500 ILDFLAG = $(ILDFLAG/$(VERSION))
499 ILDFLAG/debug = -xildon 501 ILDFLAG/debug = -xildon
500 ILDFLAG/optimized = 502 ILDFLAG/optimized =
501 AOUT_FLAGS += $(ILDFLAG) 503 AOUT_FLAGS += $(ILDFLAG)