jdk/make/common/shared/Compiler-gcc.gmk
author ohair
Thu, 21 Apr 2011 18:26:04 -0700
changeset 9350 799e0bb89242
parent 7665 bc5dbdc44e1e
child 12056 1f93da3840f7
permissions -rw-r--r--
7038711: Fix CC_VER checks for compiler options, fix use of -Wno-clobber Reviewed-by: igor
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
#
7665
bc5dbdc44e1e 6360517: ALT_MSDEVTOOLS_PATH and rc.exe location, and rebase location
ohair
parents: 5506
diff changeset
     2
# Copyright (c) 2005, 2010, Oracle and/or its affiliates. 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
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2186
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2186
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
2
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
#
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2186
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2186
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2186
diff changeset
    23
# questions.
2
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
ifeq ($(PLATFORM), windows)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
  # Settings specific to Windows, pretty stale, hasn't been used
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
  CC           = $(COMPILER_PATH)gcc
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
  CPP          = $(COMPILER_PATH)gcc -E
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
  CXX          = $(COMPILER_PATH)g++
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
  CCC          = $(COMPILER_PATH)g++
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
  LIBEXE       = $(COMPILER_PATH)lib
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
  LINK         = $(COMPILER_PATH)link
7665
bc5dbdc44e1e 6360517: ALT_MSDEVTOOLS_PATH and rc.exe location, and rebase location
ohair
parents: 5506
diff changeset
    39
  RC           = $(COMPILER_PATH)rc
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
  LINK32       = $(LINK)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
  RSC          = $(RC)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
  # unset any GNU Make settings of MFLAGS and MAKEFLAGS which may mess up nmake
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
  NMAKE          = MFLAGS= MAKEFLAGS= $(COMPILER_PATH)nmake -nologo
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
  ifeq ($(ARCH_DATA_MODEL), 32)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
    CC_VER  = UNKNOWN
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
  else
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
    CC_VER  = UNKNOWN
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
  endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
  _LINK_VER :=$(shell $(LINK) 2>&1 | $(HEAD) -n 1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
  LINK_VER  :=$(call GetVersion,"$(_LINK_VER)")
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
ifeq ($(PLATFORM), linux)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
  # Settings specific to Linux
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
  CC             = $(COMPILER_PATH)gcc
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
  CPP            = $(COMPILER_PATH)gcc -E
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
  # statically link libstdc++ before C++ ABI is stablized on Linux
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
  STATIC_CXX     = true
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
  ifeq ($(STATIC_CXX),true)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    # g++ always dynamically links libstdc++, even we use "-Wl,-Bstatic -lstdc++"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    # We need to use gcc to statically link the C++ runtime. gcc and g++ use
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    # the same subprocess to compile C++ files, so it is OK to build using gcc.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    CXX            = $(COMPILER_PATH)gcc
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
  else
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    CXX            = $(COMPILER_PATH)g++
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
  endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
  # Option used to create a shared library
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
  SHARED_LIBRARY_FLAG = -shared -mimpure-text
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
  SUN_COMP_VER := $(shell $(CC) --verbose 2>&1 )
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
ifeq ($(PLATFORM), solaris)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
  # Settings specific to Solaris
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
  CC             = $(COMPILER_PATH)gcc
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
  CPP            = $(COMPILER_PATH)gcc -E
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
  CXX            = $(COMPILER_PATH)g++
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
  # Option used to create a shared library
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
  SHARED_LIBRARY_FLAG = -G
2158
68869a085470 6799141: Build with --hash-style=both so that binaries can work on SuSE 10
ohair
parents: 849
diff changeset
    84
  
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
# Get gcc version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
_CC_VER :=$(shell $(CC) -dumpversion 2>&1 )
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
CC_VER  :=$(call GetVersion,"$(_CC_VER)")
9350
799e0bb89242 7038711: Fix CC_VER checks for compiler options, fix use of -Wno-clobber
ohair
parents: 7665
diff changeset
    90
CC_MAJORVER  :=$(call MajorVersion,$(CC_VER))
799e0bb89242 7038711: Fix CC_VER checks for compiler options, fix use of -Wno-clobber
ohair
parents: 7665
diff changeset
    91
CC_MINORVER  :=$(call MinorVersion,$(CC_VER))
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
2186
53da56fa3bf9 6816311: Changes to allow builds with latest Windows SDK 6.1 on 64bit Windows 2003
ohair
parents: 2158
diff changeset
    93
# Name of compiler
53da56fa3bf9 6816311: Changes to allow builds with latest Windows SDK 6.1 on 64bit Windows 2003
ohair
parents: 2158
diff changeset
    94
COMPILER_NAME = GCC$(call MajorVersion,$(CC_VER))
53da56fa3bf9 6816311: Changes to allow builds with latest Windows SDK 6.1 on 64bit Windows 2003
ohair
parents: 2158
diff changeset
    95
COMPILER_VERSION = $(COMPILER_NAME)
53da56fa3bf9 6816311: Changes to allow builds with latest Windows SDK 6.1 on 64bit Windows 2003
ohair
parents: 2158
diff changeset
    96