jdk/make/common/shared/Compiler-gcc.gmk
author ohair
Sun, 27 Jul 2008 18:42:57 -0700
changeset 849 be386e469547
parent 715 f16baef3a20e
child 2158 68869a085470
permissions -rw-r--r--
6727683: Cleanup use of COMPILER_WARNINGS_FATAL in makefiles Reviewed-by: tbell
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
#
715
f16baef3a20e 6719955: Update copyright year
xdono
parents: 308
diff changeset
     2
# Copyright 2005-2008 Sun Microsystems, Inc.  All Rights Reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
# published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
# by Sun in the LICENSE file that accompanied this code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
# accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
# CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
# have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
# GCC Compiler settings
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
COMPILER_NAME=GCC
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
ifeq ($(PLATFORM), windows)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
  # Settings specific to Windows, pretty stale, hasn't been used
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
  CC           = $(COMPILER_PATH)gcc
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
  CPP          = $(COMPILER_PATH)gcc -E
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
  CXX          = $(COMPILER_PATH)g++
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
  CCC          = $(COMPILER_PATH)g++
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
  LIBEXE       = $(COMPILER_PATH)lib
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
  LINK         = $(COMPILER_PATH)link
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
  RC           = $(MSDEVTOOLS_PATH)link
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
  LINK32       = $(LINK)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
  RSC          = $(RC)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
  # unset any GNU Make settings of MFLAGS and MAKEFLAGS which may mess up nmake
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
  NMAKE          = MFLAGS= MAKEFLAGS= $(COMPILER_PATH)nmake -nologo
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
  ifeq ($(ARCH_DATA_MODEL), 32)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
    CC_VER  = UNKNOWN
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
  else
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
    CC_VER  = UNKNOWN
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
  endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
  _LINK_VER :=$(shell $(LINK) 2>&1 | $(HEAD) -n 1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
  LINK_VER  :=$(call GetVersion,"$(_LINK_VER)")
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
ifeq ($(PLATFORM), linux)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
  # Settings specific to Linux
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
  CC             = $(COMPILER_PATH)gcc
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
  CPP            = $(COMPILER_PATH)gcc -E
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
  # statically link libstdc++ before C++ ABI is stablized on Linux
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
  STATIC_CXX     = true
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
  ifeq ($(STATIC_CXX),true)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    # g++ always dynamically links libstdc++, even we use "-Wl,-Bstatic -lstdc++"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    # We need to use gcc to statically link the C++ runtime. gcc and g++ use
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    # the same subprocess to compile C++ files, so it is OK to build using gcc.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    CXX            = $(COMPILER_PATH)gcc
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
  else
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    CXX            = $(COMPILER_PATH)g++
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
  endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
  ifneq ("$(findstring sparc,$(ARCH))", "")
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    # sparc or sparcv9
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    REQUIRED_CC_VER = 4.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    REQUIRED_GCC_VER = 4.0.*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
  else
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    REQUIRED_CC_VER = 3.2
849
be386e469547 6727683: Cleanup use of COMPILER_WARNINGS_FATAL in makefiles
ohair
parents: 715
diff changeset
    77
    ifeq ($(ARCH_DATA_MODEL), 32)
be386e469547 6727683: Cleanup use of COMPILER_WARNINGS_FATAL in makefiles
ohair
parents: 715
diff changeset
    78
      REQUIRED_GCC_VER = 3.2.1*
be386e469547 6727683: Cleanup use of COMPILER_WARNINGS_FATAL in makefiles
ohair
parents: 715
diff changeset
    79
      REQUIRED_GCC_VER_INT = 3.2.1-7a
be386e469547 6727683: Cleanup use of COMPILER_WARNINGS_FATAL in makefiles
ohair
parents: 715
diff changeset
    80
    else
be386e469547 6727683: Cleanup use of COMPILER_WARNINGS_FATAL in makefiles
ohair
parents: 715
diff changeset
    81
      ifeq ($(ARCH), amd64)
be386e469547 6727683: Cleanup use of COMPILER_WARNINGS_FATAL in makefiles
ohair
parents: 715
diff changeset
    82
        REQUIRED_GCC_VER = 3.2.*
be386e469547 6727683: Cleanup use of COMPILER_WARNINGS_FATAL in makefiles
ohair
parents: 715
diff changeset
    83
      endif
be386e469547 6727683: Cleanup use of COMPILER_WARNINGS_FATAL in makefiles
ohair
parents: 715
diff changeset
    84
      ifeq ($(ARCH), ia64)
be386e469547 6727683: Cleanup use of COMPILER_WARNINGS_FATAL in makefiles
ohair
parents: 715
diff changeset
    85
        REQUIRED_GCC_VER = 2.9[56789].*
be386e469547 6727683: Cleanup use of COMPILER_WARNINGS_FATAL in makefiles
ohair
parents: 715
diff changeset
    86
      endif
be386e469547 6727683: Cleanup use of COMPILER_WARNINGS_FATAL in makefiles
ohair
parents: 715
diff changeset
    87
    endif
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
  endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
  # Option used to create a shared library
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
  SHARED_LIBRARY_FLAG = -shared -mimpure-text
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
  SUN_COMP_VER := $(shell $(CC) --verbose 2>&1 )
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
ifeq ($(PLATFORM), solaris)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
  # Settings specific to Solaris
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
  CC             = $(COMPILER_PATH)gcc
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
  CPP            = $(COMPILER_PATH)gcc -E
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
  CXX            = $(COMPILER_PATH)g++
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
  REQUIRED_CC_VER = 3.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
  # Option used to create a shared library
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
  SHARED_LIBRARY_FLAG = -G
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
  # But gcc is still needed no matter what on 32bit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
  ifeq ($(ARCH_DATA_MODEL), 32)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    REQUIRED_GCC_VER = 2.95
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    GCC =$(GCC_COMPILER_PATH)gcc
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    _GCC_VER :=$(shell $(GCC) -dumpversion 2>&1 )
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    GCC_VER  :=$(call GetVersion,"$(_GCC_VER)")
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
  endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
# Get gcc version
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
_CC_VER :=$(shell $(CC) -dumpversion 2>&1 )
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
CC_VER  :=$(call GetVersion,"$(_CC_VER)")
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118